aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-06-27 16:58:36 +0900
committerShinichiro Hamaji <shinichiro.hamaji@gmail.com>2015-06-29 12:26:47 +0900
commit64cd806d57dfdc9d2b848f47aa583a872a7c6dcb (patch)
tree916f11700f297278f3815e3b6631d4c0123d7d9e
parente36dd56bebb7d364d9e2596458ff332d0a9a3411 (diff)
downloadandroid_build_kati-64cd806d57dfdc9d2b848f47aa583a872a7c6dcb.tar.gz
android_build_kati-64cd806d57dfdc9d2b848f47aa583a872a7c6dcb.tar.bz2
android_build_kati-64cd806d57dfdc9d2b848f47aa583a872a7c6dcb.zip
[C++] Fix -c flag and add -i flag
-rw-r--r--exec.cc2
-rw-r--r--flags.cc2
-rw-r--r--flags.h2
-rw-r--r--main.cc8
4 files changed, 10 insertions, 4 deletions
diff --git a/exec.cc b/exec.cc
index bc4497f..9e6b1ab 100644
--- a/exec.cc
+++ b/exec.cc
@@ -161,7 +161,7 @@ class Executor {
printf("%s\n", runner->cmd->c_str());
fflush(stdout);
}
- if (!g_is_syntax_check_only) {
+ if (!g_is_dry_run) {
int result = system(runner->cmd->c_str());
if (result != 0) {
if (runner->ignore_error) {
diff --git a/flags.cc b/flags.cc
index 0c611df..de95408 100644
--- a/flags.cc
+++ b/flags.cc
@@ -16,4 +16,4 @@
#include "flags.h"
-bool g_is_syntax_check_only;
+bool g_is_dry_run;
diff --git a/flags.h b/flags.h
index 570d6b1..a2e806a 100644
--- a/flags.h
+++ b/flags.h
@@ -15,6 +15,6 @@
#ifndef FLAGS_H_
#define FLAGS_H_
-extern bool g_is_syntax_check_only;
+extern bool g_is_dry_run;
#endif // FLAGS_H_
diff --git a/main.cc b/main.cc
index 3bb9fe6..3b503fa 100644
--- a/main.cc
+++ b/main.cc
@@ -36,6 +36,7 @@
#include "var.h"
static const char* g_makefile;
+static bool g_is_syntax_check_only;
static void ParseCommandLine(int argc, char* argv[],
vector<StringPiece>* targets,
@@ -46,6 +47,8 @@ static void ParseCommandLine(int argc, char* argv[],
g_makefile = argv[++i];
} else if (!strcmp(arg, "-c")) {
g_is_syntax_check_only = true;
+ } else if (!strcmp(arg, "-i")) {
+ g_is_dry_run = true;
} else if (arg[0] == '-') {
ERROR("Unknown flag: %s", arg);
} else {
@@ -179,6 +182,9 @@ static int Run(const vector<StringPiece>& targets,
}
}
+ if (g_is_syntax_check_only)
+ return 0;
+
Exec(nodes, ev);
for (AST* ast : bootstrap_asts)
@@ -187,7 +193,7 @@ static int Run(const vector<StringPiece>& targets,
delete vars;
delete cache_mgr;
- return mk == 0;
+ return 0;
}
int main(int argc, char* argv[]) {