diff options
| author | Dan Willemsen <dwillemsen@google.com> | 2016-09-20 13:35:16 -0700 |
|---|---|---|
| committer | Dan Willemsen <dwillemsen@google.com> | 2016-09-20 13:36:59 -0700 |
| commit | 38315d2f21d9db622b90f307737f1e370ff9cea9 (patch) | |
| tree | a762d85e42d042acf8682366a2f9741fa1eb92b9 | |
| parent | e1de29e5429454e581fb7ff5ae224812cd465739 (diff) | |
| parent | 5e45e973c38c92c42cc86aa5dafeca13e6823b5f (diff) | |
Merge remote-tracking branch 'aosp/upstream' into master
* aosp/upstream:
Workaround lifetime problem identified by ASAN
Stop using .PHONY as a build target in phony.mk
Don't ignore all date/echo commands
ninja: Don't emit special targets (.*)
Add --regen_debug
Fix unused parameter warning for !SSE4.2
Bug: 30947985
Test: Passes upstream kati test suite, manual android testing
Change-Id: I5cd822b7b56085f8784c40fa6d03e6ac0db67f8b
| -rw-r--r-- | find.cc | 16 | ||||
| -rw-r--r-- | find.h | 2 | ||||
| -rw-r--r-- | flags.cc | 3 | ||||
| -rw-r--r-- | flags.h | 1 | ||||
| -rw-r--r-- | func.cc | 4 | ||||
| -rw-r--r-- | ninja.cc | 3 | ||||
| -rw-r--r-- | regen.cc | 10 | ||||
| -rw-r--r-- | strutil.cc | 2 | ||||
| -rw-r--r-- | testcase/phony.mk | 3 |
9 files changed, 25 insertions, 19 deletions
@@ -585,7 +585,7 @@ class FindCommandParser { } else if (tok.find_first_of("|;&><*'\"") != string::npos) { return false; } else { - fc_->finddirs.push_back(tok); + fc_->finddirs.push_back(tok.as_string()); } } } @@ -594,7 +594,7 @@ class FindCommandParser { fc_->type = FindCommandType::FINDLEAVES; fc_->follows_symlinks = true; StringPiece tok; - vector<StringPiece> findfiles; + vector<string> findfiles; while (true) { if (!GetNextToken(&tok)) return false; @@ -604,13 +604,13 @@ class FindCommandParser { if (findfiles.size() < 2) return false; fc_->finddirs.swap(findfiles); - fc_->print_cond.reset(new NameCond(fc_->finddirs.back().as_string())); + fc_->print_cond.reset(new NameCond(fc_->finddirs.back())); fc_->finddirs.pop_back(); } else { if (findfiles.size() < 1) return false; for (auto& file : findfiles) { - FindCond* cond = new NameCond(file.as_string()); + FindCond* cond = new NameCond(file); if (fc_->print_cond.get()) { cond = new OrCond(fc_->print_cond.release(), cond); } @@ -640,12 +640,12 @@ class FindCommandParser { fc_->mindepth = d; } else if (HasPrefix(tok, "--dir=")) { StringPiece dir= tok.substr(strlen("--dir=")); - fc_->finddirs.push_back(dir); + fc_->finddirs.push_back(dir.as_string()); } else if (HasPrefix(tok, "--")) { WARN("Unknown flag in findleaves.py: %.*s", SPF(tok)); return false; } else { - findfiles.push_back(tok); + findfiles.push_back(tok.as_string()); } } } @@ -788,7 +788,7 @@ class FindEmulatorImpl : public FindEmulator { } const size_t orig_out_size = out->size(); - for (StringPiece finddir : fc.finddirs) { + for (const string& finddir : fc.finddirs) { const string dir = ConcatDir(fc.chdir, finddir); if (!CanHandle(dir)) { @@ -813,7 +813,7 @@ class FindEmulatorImpl : public FindEmulator { continue; } - string path = finddir.as_string(); + string path = finddir; unordered_map<const DirentNode*, string> cur_read_dirs; if (!base->RunFind(fc, 0, &path, &cur_read_dirs, out)) { LOG("FindEmulator: RunFind failed: %s", cmd.c_str()); @@ -41,7 +41,7 @@ struct FindCommand { FindCommandType type; string chdir; string testdir; - vector<StringPiece> finddirs; + vector<string> finddirs; bool follows_symlinks; unique_ptr<FindCond> print_cond; unique_ptr<FindCond> prune_cond; @@ -86,10 +86,13 @@ void Flags::Parse(int argc, char** argv) { } else if (!strcmp(arg, "--regen")) { // TODO: Make this default. regen = true; + } else if (!strcmp(arg, "--regen_debug")) { + regen_debug = true; } else if (!strcmp(arg, "--regen_ignoring_kati_binary")) { regen_ignoring_kati_binary = true; } else if (!strcmp(arg, "--dump_kati_stamp")) { dump_kati_stamp = true; + regen_debug = true; } else if (!strcmp(arg, "--detect_android_echo")) { detect_android_echo = true; } else if (!strcmp(arg, "--detect_depfiles")) { @@ -36,6 +36,7 @@ struct Flags { bool is_silent_mode; bool is_syntax_check_only; bool regen; + bool regen_debug; bool regen_ignoring_kati_binary; bool use_find_emulator; const char* goma_dir; @@ -533,7 +533,9 @@ static void ShellFuncImpl(const string& shell, const string& cmd, static vector<CommandResult*> g_command_results; bool ShouldStoreCommandResult(StringPiece cmd) { - if (HasWord(cmd, "date") || HasWord(cmd, "echo")) + // We really just want to ignore this one, or remove BUILD_DATETIME from + // Android completely + if (cmd == "date +%s") return false; Pattern pat(g_flags.ignore_dirty_pattern); @@ -483,6 +483,9 @@ class NinjaGenerator { string rule_name = "phony"; bool use_local_pool = false; + if (node->output.get(0) == '.') { + return; + } if (g_flags.enable_debug) { *o << "# " << (node->loc.filename ? node->loc.filename : "(null)") << ':' << node->loc.lineno << "\n"; @@ -132,7 +132,7 @@ class StampChecker { const string& stamp_filename = GetNinjaStampFilename(); FILE* fp = fopen(stamp_filename.c_str(), "rb"); if (!fp) { - if (g_flags.dump_kati_stamp) + if (g_flags.regen_debug) printf("%s: %s\n", stamp_filename.c_str(), strerror(errno)); return true; } @@ -145,7 +145,7 @@ class StampChecker { fprintf(stderr, "incomplete kati_stamp, regenerating...\n"); RETURN_TRUE; } - if (g_flags.dump_kati_stamp) + if (g_flags.regen_debug) printf("Generated time: %f\n", gen_time); string s, s2; @@ -163,7 +163,7 @@ class StampChecker { } } if (ShouldIgnoreDirty(s)) { - if (g_flags.dump_kati_stamp) + if (g_flags.regen_debug) printf("file %s: ignored (%f)\n", s.c_str(), ts); continue; } @@ -325,7 +325,7 @@ class StampChecker { bool CheckShellResult(const ShellResult* sr, string* err) { if (!ShouldRunCommand(sr)) { - if (g_flags.dump_kati_stamp) + if (g_flags.regen_debug) printf("shell %s: clean (no rerun)\n", sr->cmd.c_str()); return false; } @@ -351,7 +351,7 @@ class StampChecker { //*err += StringPrintf("%s => %s\n", expected.c_str(), result.c_str()); } return true; - } else if (g_flags.dump_kati_stamp) { + } else if (g_flags.regen_debug) { printf("shell %s: clean (rerun)\n", sr->cmd.c_str()); } return false; @@ -57,7 +57,7 @@ static int SkipUntilSSE42(const char* s, int len, template <typename Cond> static int SkipUntil(const char* s, int len, - const char* ranges, int ranges_size, + const char* ranges UNUSED, int ranges_size UNUSED, Cond cond) { int i = 0; #ifdef __SSE4_2__ diff --git a/testcase/phony.mk b/testcase/phony.mk index 59fb911..64a67bb 100644 --- a/testcase/phony.mk +++ b/testcase/phony.mk @@ -11,9 +11,6 @@ baz: foo test1: foo bar baz echo PASS test1 from foo bar baz -# Actually, you can use .PHONY! -test2: .PHONY - test3: touch test4 |
