From ff4f2a0db21b738bba743ad543d8553417aca7b0 Mon Sep 17 00:00:00 2001 From: Michael Jones Date: Sat, 6 Jun 2020 17:23:54 -0500 Subject: Add 'using namespace std;' to all cc files to prepare for removing it from header files --- src/browse.cc | 2 ++ src/build.cc | 2 ++ src/build_log.cc | 2 ++ src/build_log_perftest.cc | 2 ++ src/build_log_test.cc | 2 ++ src/build_test.cc | 2 ++ src/canon_perftest.cc | 2 ++ src/clean.cc | 2 ++ src/clean_test.cc | 2 ++ src/clparser.cc | 2 ++ src/clparser_perftest.cc | 2 ++ src/clparser_test.cc | 2 ++ src/depfile_parser.cc | 2 ++ src/depfile_parser.in.cc | 2 ++ src/depfile_parser_perftest.cc | 2 ++ src/depfile_parser_test.cc | 2 ++ src/deps_log.cc | 2 ++ src/deps_log_test.cc | 2 ++ src/disk_interface.cc | 2 ++ src/disk_interface_test.cc | 2 ++ src/dyndep.cc | 2 ++ src/dyndep_parser.cc | 2 ++ src/dyndep_parser_test.cc | 2 ++ src/edit_distance.cc | 2 ++ src/eval_env.cc | 2 ++ src/graph.cc | 2 ++ src/graph_test.cc | 2 ++ src/graphviz.cc | 2 ++ src/hash_collision_bench.cc | 3 ++- src/includes_normalize-win32.cc | 2 ++ src/includes_normalize_test.cc | 2 ++ src/lexer.in.cc | 2 ++ src/lexer_test.cc | 2 ++ src/line_printer.cc | 2 ++ src/manifest_parser.cc | 2 ++ src/manifest_parser_perftest.cc | 2 ++ src/manifest_parser_test.cc | 2 ++ src/metrics.cc | 2 ++ src/minidump-win32.cc | 2 ++ src/msvc_helper-win32.cc | 2 ++ src/msvc_helper_main-win32.cc | 2 ++ src/msvc_helper_test.cc | 2 ++ src/ninja.cc | 2 ++ src/ninja_test.cc | 2 ++ src/parser.cc | 2 ++ src/state.cc | 1 + src/state_test.cc | 2 ++ src/string_piece_util_test.cc | 2 ++ src/subprocess-posix.cc | 2 ++ src/subprocess-win32.cc | 2 ++ src/subprocess_test.cc | 2 ++ src/test.cc | 2 ++ src/util.cc | 2 ++ src/util_test.cc | 2 ++ src/version.cc | 2 ++ 55 files changed, 109 insertions(+), 1 deletion(-) diff --git a/src/browse.cc b/src/browse.cc index c08c9f4..76bee07 100644 --- a/src/browse.cc +++ b/src/browse.cc @@ -22,6 +22,8 @@ #include "build/browse_py.h" +using namespace std; + void RunBrowsePython(State* state, const char* ninja_command, const char* input_file, int argc, char* argv[]) { // Fork off a Python process and have it run our code via its stdin. diff --git a/src/build.cc b/src/build.cc index 8c6ada5..e3131e2 100644 --- a/src/build.cc +++ b/src/build.cc @@ -40,6 +40,8 @@ #include "subprocess.h" #include "util.h" +using namespace std; + namespace { /// A CommandRunner that doesn't actually run the commands. diff --git a/src/build_log.cc b/src/build_log.cc index e5f179c..0a2fac6 100644 --- a/src/build_log.cc +++ b/src/build_log.cc @@ -41,6 +41,8 @@ #define strtoll _strtoi64 #endif +using namespace std; + // Implementation details: // Each run's log appends to the log file. // To load, we run through all log entries in series, throwing away diff --git a/src/build_log_perftest.cc b/src/build_log_perftest.cc index e471d13..ced0df9 100644 --- a/src/build_log_perftest.cc +++ b/src/build_log_perftest.cc @@ -26,6 +26,8 @@ #include #endif +using namespace std; + const char kTestFilename[] = "BuildLogPerfTest-tempfile"; struct NoDeadPaths : public BuildLogUser { diff --git a/src/build_log_test.cc b/src/build_log_test.cc index c81f570..3718299 100644 --- a/src/build_log_test.cc +++ b/src/build_log_test.cc @@ -27,6 +27,8 @@ #endif #include +using namespace std; + namespace { const char kTestFilename[] = "BuildLogTest-tempfile"; diff --git a/src/build_test.cc b/src/build_test.cc index 12c3383..078080d 100644 --- a/src/build_test.cc +++ b/src/build_test.cc @@ -21,6 +21,8 @@ #include "graph.h" #include "test.h" +using namespace std; + struct CompareEdgesByOutput { static bool cmp(const Edge* a, const Edge* b) { return a->outputs_[0]->path() < b->outputs_[0]->path(); diff --git a/src/canon_perftest.cc b/src/canon_perftest.cc index 03f4a2f..088bd45 100644 --- a/src/canon_perftest.cc +++ b/src/canon_perftest.cc @@ -18,6 +18,8 @@ #include "util.h" #include "metrics.h" +using namespace std; + const char kPath[] = "../../third_party/WebKit/Source/WebCore/" "platform/leveldb/LevelDBWriteBatch.cpp"; diff --git a/src/clean.cc b/src/clean.cc index 55d7277..3e57437 100644 --- a/src/clean.cc +++ b/src/clean.cc @@ -22,6 +22,8 @@ #include "state.h" #include "util.h" +using namespace std; + Cleaner::Cleaner(State* state, const BuildConfig& config, DiskInterface* disk_interface) diff --git a/src/clean_test.cc b/src/clean_test.cc index d068f3c..1b843a2 100644 --- a/src/clean_test.cc +++ b/src/clean_test.cc @@ -22,6 +22,8 @@ #include #endif +using namespace std; + namespace { const char kTestFilename[] = "CleanTest-tempfile"; diff --git a/src/clparser.cc b/src/clparser.cc index 7994c06..275641e 100644 --- a/src/clparser.cc +++ b/src/clparser.cc @@ -28,6 +28,8 @@ #include "util.h" #endif +using namespace std; + namespace { /// Return true if \a input ends with \a needle. diff --git a/src/clparser_perftest.cc b/src/clparser_perftest.cc index 7ac5230..008ac46 100644 --- a/src/clparser_perftest.cc +++ b/src/clparser_perftest.cc @@ -18,6 +18,8 @@ #include "clparser.h" #include "metrics.h" +using namespace std; + int main(int argc, char* argv[]) { // Output of /showIncludes from #include string perf_testdata = diff --git a/src/clparser_test.cc b/src/clparser_test.cc index 1549ab1..0b829c1 100644 --- a/src/clparser_test.cc +++ b/src/clparser_test.cc @@ -17,6 +17,8 @@ #include "test.h" #include "util.h" +using namespace std; + TEST(CLParserTest, ShowIncludes) { ASSERT_EQ("", CLParser::FilterShowIncludes("", "")); diff --git a/src/depfile_parser.cc b/src/depfile_parser.cc index 0b7dce1..bffeb76 100644 --- a/src/depfile_parser.cc +++ b/src/depfile_parser.cc @@ -18,6 +18,8 @@ #include +using namespace std; + DepfileParser::DepfileParser(DepfileParserOptions options) : options_(options) { diff --git a/src/depfile_parser.in.cc b/src/depfile_parser.in.cc index 95b4346..75ba982 100644 --- a/src/depfile_parser.in.cc +++ b/src/depfile_parser.in.cc @@ -17,6 +17,8 @@ #include +using namespace std; + DepfileParser::DepfileParser(DepfileParserOptions options) : options_(options) { diff --git a/src/depfile_parser_perftest.cc b/src/depfile_parser_perftest.cc index b215221..52555e6 100644 --- a/src/depfile_parser_perftest.cc +++ b/src/depfile_parser_perftest.cc @@ -19,6 +19,8 @@ #include "util.h" #include "metrics.h" +using namespace std; + int main(int argc, char* argv[]) { if (argc < 2) { printf("usage: %s \n", argv[0]); diff --git a/src/depfile_parser_test.cc b/src/depfile_parser_test.cc index 8e2cd25..8886258 100644 --- a/src/depfile_parser_test.cc +++ b/src/depfile_parser_test.cc @@ -16,6 +16,8 @@ #include "test.h" +using namespace std; + struct DepfileParserTest : public testing::Test { bool Parse(const char* input, string* err); diff --git a/src/deps_log.cc b/src/deps_log.cc index 1fb65ae..0567c95 100644 --- a/src/deps_log.cc +++ b/src/deps_log.cc @@ -30,6 +30,8 @@ typedef unsigned __int32 uint32_t; #include "state.h" #include "util.h" +using namespace std; + // The version is stored as 4 bytes after the signature and also serves as a // byte order mark. Signature and version combined are 16 bytes long. const char kFileSignature[] = "# ninjadeps\n"; diff --git a/src/deps_log_test.cc b/src/deps_log_test.cc index 0cdeb45..4055941 100644 --- a/src/deps_log_test.cc +++ b/src/deps_log_test.cc @@ -23,6 +23,8 @@ #include "util.h" #include "test.h" +using namespace std; + namespace { const char kTestFilename[] = "DepsLogTest-tempfile"; diff --git a/src/disk_interface.cc b/src/disk_interface.cc index 594bc51..49af001 100644 --- a/src/disk_interface.cc +++ b/src/disk_interface.cc @@ -33,6 +33,8 @@ #include "metrics.h" #include "util.h" +using namespace std; + namespace { string DirName(const string& path) { diff --git a/src/disk_interface_test.cc b/src/disk_interface_test.cc index 866d1d6..066c770 100644 --- a/src/disk_interface_test.cc +++ b/src/disk_interface_test.cc @@ -23,6 +23,8 @@ #include "graph.h" #include "test.h" +using namespace std; + namespace { struct DiskInterfaceTest : public testing::Test { diff --git a/src/dyndep.cc b/src/dyndep.cc index 2aee601..b388e9b 100644 --- a/src/dyndep.cc +++ b/src/dyndep.cc @@ -24,6 +24,8 @@ #include "state.h" #include "util.h" +using namespace std; + bool DyndepLoader::LoadDyndeps(Node* node, std::string* err) const { DyndepFile ddf; return LoadDyndeps(node, &ddf, err); diff --git a/src/dyndep_parser.cc b/src/dyndep_parser.cc index baebbac..56da16f 100644 --- a/src/dyndep_parser.cc +++ b/src/dyndep_parser.cc @@ -22,6 +22,8 @@ #include "util.h" #include "version.h" +using namespace std; + DyndepParser::DyndepParser(State* state, FileReader* file_reader, DyndepFile* dyndep_file) : Parser(state, file_reader) diff --git a/src/dyndep_parser_test.cc b/src/dyndep_parser_test.cc index 39ec657..1bba7ba 100644 --- a/src/dyndep_parser_test.cc +++ b/src/dyndep_parser_test.cc @@ -22,6 +22,8 @@ #include "state.h" #include "test.h" +using namespace std; + struct DyndepParserTest : public testing::Test { void AssertParse(const char* input) { DyndepParser parser(&state_, &fs_, &dyndep_file_); diff --git a/src/edit_distance.cc b/src/edit_distance.cc index 3bb62b8..34bf0e5 100644 --- a/src/edit_distance.cc +++ b/src/edit_distance.cc @@ -17,6 +17,8 @@ #include #include +using namespace std; + int EditDistance(const StringPiece& s1, const StringPiece& s2, bool allow_replacements, diff --git a/src/eval_env.cc b/src/eval_env.cc index e9b6c43..796a326 100644 --- a/src/eval_env.cc +++ b/src/eval_env.cc @@ -16,6 +16,8 @@ #include "eval_env.h" +using namespace std; + string BindingEnv::LookupVariable(const string& var) { map::iterator i = bindings_.find(var); if (i != bindings_.end()) diff --git a/src/graph.cc b/src/graph.cc index 28a9653..ea11360 100644 --- a/src/graph.cc +++ b/src/graph.cc @@ -28,6 +28,8 @@ #include "state.h" #include "util.h" +using namespace std; + bool Node::Stat(DiskInterface* disk_interface, string* err) { return (mtime_ = disk_interface->Stat(path_, err)) != -1; } diff --git a/src/graph_test.cc b/src/graph_test.cc index 660943f..14f6375 100644 --- a/src/graph_test.cc +++ b/src/graph_test.cc @@ -17,6 +17,8 @@ #include "test.h" +using namespace std; + struct GraphTest : public StateTestWithBuiltinRules { GraphTest() : scan_(&state_, NULL, NULL, &fs_, NULL) {} diff --git a/src/graphviz.cc b/src/graphviz.cc index 0d07251..37b7108 100644 --- a/src/graphviz.cc +++ b/src/graphviz.cc @@ -20,6 +20,8 @@ #include "dyndep.h" #include "graph.h" +using namespace std; + void GraphViz::AddTarget(Node* node) { if (visited_nodes_.find(node) != visited_nodes_.end()) return; diff --git a/src/hash_collision_bench.cc b/src/hash_collision_bench.cc index ff947dc..52ff56d 100644 --- a/src/hash_collision_bench.cc +++ b/src/hash_collision_bench.cc @@ -15,11 +15,12 @@ #include "build_log.h" #include -using namespace std; #include #include +using namespace std; + int random(int low, int high) { return int(low + (rand() / double(RAND_MAX)) * (high - low) + 0.5); } diff --git a/src/includes_normalize-win32.cc b/src/includes_normalize-win32.cc index 79bf5b4..9f8dfc2 100644 --- a/src/includes_normalize-win32.cc +++ b/src/includes_normalize-win32.cc @@ -24,6 +24,8 @@ #include +using namespace std; + namespace { bool InternalGetFullPathName(const StringPiece& file_name, char* buffer, diff --git a/src/includes_normalize_test.cc b/src/includes_normalize_test.cc index dbcdbe0..9214f53 100644 --- a/src/includes_normalize_test.cc +++ b/src/includes_normalize_test.cc @@ -22,6 +22,8 @@ #include "test.h" #include "util.h" +using namespace std; + namespace { string GetCurDir() { diff --git a/src/lexer.in.cc b/src/lexer.in.cc index c1fb822..88007e7 100644 --- a/src/lexer.in.cc +++ b/src/lexer.in.cc @@ -19,6 +19,8 @@ #include "eval_env.h" #include "util.h" +using namespace std; + bool Lexer::Error(const string& message, string* err) { // Compute line/column. int line = 1; diff --git a/src/lexer_test.cc b/src/lexer_test.cc index 331d8e1..c5c416d 100644 --- a/src/lexer_test.cc +++ b/src/lexer_test.cc @@ -17,6 +17,8 @@ #include "eval_env.h" #include "test.h" +using namespace std; + TEST(Lexer, ReadVarValue) { Lexer lexer("plain text $var $VaR ${x}\n"); EvalString eval; diff --git a/src/line_printer.cc b/src/line_printer.cc index c93173e..68c58ad 100644 --- a/src/line_printer.cc +++ b/src/line_printer.cc @@ -30,6 +30,8 @@ #include "util.h" +using namespace std; + LinePrinter::LinePrinter() : have_blank_line_(true), console_locked_(false) { const char* term = getenv("TERM"); #ifndef _WIN32 diff --git a/src/manifest_parser.cc b/src/manifest_parser.cc index bb53dc2..860a8fc 100644 --- a/src/manifest_parser.cc +++ b/src/manifest_parser.cc @@ -23,6 +23,8 @@ #include "util.h" #include "version.h" +using namespace std; + ManifestParser::ManifestParser(State* state, FileReader* file_reader, ManifestParserOptions options) : Parser(state, file_reader), diff --git a/src/manifest_parser_perftest.cc b/src/manifest_parser_perftest.cc index 67d11f9..92f5e13 100644 --- a/src/manifest_parser_perftest.cc +++ b/src/manifest_parser_perftest.cc @@ -37,6 +37,8 @@ #include "state.h" #include "util.h" +using namespace std; + bool WriteFakeManifests(const string& dir, string* err) { RealDiskInterface disk_interface; TimeStamp mtime = disk_interface.Stat(dir + "/build.ninja", err); diff --git a/src/manifest_parser_test.cc b/src/manifest_parser_test.cc index f4aee2d..ec2eeed 100644 --- a/src/manifest_parser_test.cc +++ b/src/manifest_parser_test.cc @@ -21,6 +21,8 @@ #include "state.h" #include "test.h" +using namespace std; + struct ParserTest : public testing::Test { void AssertParse(const char* input) { ManifestParser parser(&state, &fs_); diff --git a/src/metrics.cc b/src/metrics.cc index a7d3c7a..dbaf221 100644 --- a/src/metrics.cc +++ b/src/metrics.cc @@ -28,6 +28,8 @@ #include "util.h" +using namespace std; + Metrics* g_metrics = NULL; namespace { diff --git a/src/minidump-win32.cc b/src/minidump-win32.cc index ca93638..9aea767 100644 --- a/src/minidump-win32.cc +++ b/src/minidump-win32.cc @@ -19,6 +19,8 @@ #include "util.h" +using namespace std; + typedef BOOL (WINAPI *MiniDumpWriteDumpFunc) ( IN HANDLE, IN DWORD, diff --git a/src/msvc_helper-win32.cc b/src/msvc_helper-win32.cc index de6147a..1148ae5 100644 --- a/src/msvc_helper-win32.cc +++ b/src/msvc_helper-win32.cc @@ -18,6 +18,8 @@ #include "util.h" +using namespace std; + namespace { string Replace(const string& input, const string& find, const string& replace) { diff --git a/src/msvc_helper_main-win32.cc b/src/msvc_helper_main-win32.cc index 644b2a2..7d59307 100644 --- a/src/msvc_helper_main-win32.cc +++ b/src/msvc_helper_main-win32.cc @@ -24,6 +24,8 @@ #include "getopt.h" +using namespace std; + namespace { void Usage() { diff --git a/src/msvc_helper_test.cc b/src/msvc_helper_test.cc index eaae51f..d9e2ee6 100644 --- a/src/msvc_helper_test.cc +++ b/src/msvc_helper_test.cc @@ -17,6 +17,8 @@ #include "test.h" #include "util.h" +using namespace std; + TEST(EscapeForDepfileTest, SpacesInFilename) { ASSERT_EQ("sub\\some\\ sdk\\foo.h", EscapeForDepfile("sub\\some sdk\\foo.h")); diff --git a/src/ninja.cc b/src/ninja.cc index 00e3a5c..471a023 100644 --- a/src/ninja.cc +++ b/src/ninja.cc @@ -46,6 +46,8 @@ #include "util.h" #include "version.h" +using namespace std; + #ifdef _MSC_VER // Defined in msvc_helper_main-win32.cc. int MSVCHelperMain(int argc, char** argv); diff --git a/src/ninja_test.cc b/src/ninja_test.cc index d642c5c..b40e176 100644 --- a/src/ninja_test.cc +++ b/src/ninja_test.cc @@ -28,6 +28,8 @@ #include "test.h" #include "line_printer.h" +using namespace std; + struct RegisteredTest { testing::Test* (*factory)(); const char *name; diff --git a/src/parser.cc b/src/parser.cc index 745c532..756922d 100644 --- a/src/parser.cc +++ b/src/parser.cc @@ -17,6 +17,8 @@ #include "disk_interface.h" #include "metrics.h" +using namespace std; + bool Parser::Load(const string& filename, string* err, Lexer* parent) { METRIC_RECORD(".ninja parse"); string contents; diff --git a/src/state.cc b/src/state.cc index 74cf4c1..d3a9e29 100644 --- a/src/state.cc +++ b/src/state.cc @@ -22,6 +22,7 @@ #include "metrics.h" #include "util.h" +using namespace std; void Pool::EdgeScheduled(const Edge& edge) { if (depth_ != 0) diff --git a/src/state_test.cc b/src/state_test.cc index 458b519..96469f9 100644 --- a/src/state_test.cc +++ b/src/state_test.cc @@ -16,6 +16,8 @@ #include "state.h" #include "test.h" +using namespace std; + namespace { TEST(State, Basic) { diff --git a/src/string_piece_util_test.cc b/src/string_piece_util_test.cc index 648c647..b77ae84 100644 --- a/src/string_piece_util_test.cc +++ b/src/string_piece_util_test.cc @@ -16,6 +16,8 @@ #include "test.h" +using namespace std; + TEST(StringPieceUtilTest, SplitStringPiece) { { string input("a:b:c"); diff --git a/src/subprocess-posix.cc b/src/subprocess-posix.cc index 74785d1..0c5f556 100644 --- a/src/subprocess-posix.cc +++ b/src/subprocess-posix.cc @@ -34,6 +34,8 @@ extern char** environ; #include "util.h" +using namespace std; + Subprocess::Subprocess(bool use_console) : fd_(-1), pid_(-1), use_console_(use_console) { } diff --git a/src/subprocess-win32.cc b/src/subprocess-win32.cc index d221476..ff3baac 100644 --- a/src/subprocess-win32.cc +++ b/src/subprocess-win32.cc @@ -21,6 +21,8 @@ #include "util.h" +using namespace std; + Subprocess::Subprocess(bool use_console) : child_(NULL) , overlapped_(), is_reading_(false), use_console_(use_console) { diff --git a/src/subprocess_test.cc b/src/subprocess_test.cc index 6e487db..073fe86 100644 --- a/src/subprocess_test.cc +++ b/src/subprocess_test.cc @@ -24,6 +24,8 @@ #include #endif +using namespace std; + namespace { #ifdef _WIN32 diff --git a/src/test.cc b/src/test.cc index 021005e..11b1c9e 100644 --- a/src/test.cc +++ b/src/test.cc @@ -43,6 +43,8 @@ extern "C" { } #endif +using namespace std; + namespace { #ifdef _WIN32 diff --git a/src/util.cc b/src/util.cc index 4df2bb2..c76f730 100644 --- a/src/util.cc +++ b/src/util.cc @@ -54,6 +54,8 @@ #include "edit_distance.h" #include "metrics.h" +using namespace std; + void Fatal(const char* msg, ...) { va_list ap; fprintf(stderr, "ninja: fatal: "); diff --git a/src/util_test.cc b/src/util_test.cc index b43788d..1621c91 100644 --- a/src/util_test.cc +++ b/src/util_test.cc @@ -16,6 +16,8 @@ #include "test.h" +using namespace std; + namespace { bool CanonicalizePath(string* path, string* err) { diff --git a/src/version.cc b/src/version.cc index 9d27e87..f25a30a 100644 --- a/src/version.cc +++ b/src/version.cc @@ -18,6 +18,8 @@ #include "util.h" +using namespace std; + const char* kNinjaVersion = "1.10.1.git"; void ParseVersion(const string& version, int* major, int* minor) { -- cgit v0.12