From 1eaa9ed33488bbc8fe3d9185fd053e5aa1246681 Mon Sep 17 00:00:00 2001 From: Christopher Wiley Date: Mon, 24 Aug 2015 14:07:32 -0700 Subject: [PATCH] Do not merge namespaces It is good practice to not include the whole std:: namespace into the global namespace. This is doubly true in headers. TEST=aidl compiles Change-Id: I910ca8082f61cce4f23f8564b8a12c2828b75b3c --- tools/aidl/AST.h | 4 +++- tools/aidl/Type.h | 3 ++- tools/aidl/aidl.cpp | 5 ++++- tools/aidl/generate_java.h | 3 ++- tools/aidl/options.h | 3 ++- tools/aidl/options_test.cpp | 3 ++- tools/aidl/search_path.h | 5 ++++- 7 files changed, 19 insertions(+), 7 deletions(-) diff --git a/tools/aidl/AST.h b/tools/aidl/AST.h index ead5e7ae3439c..8eaf0adea775d 100644 --- a/tools/aidl/AST.h +++ b/tools/aidl/AST.h @@ -7,7 +7,9 @@ #include #include -using namespace std; +using std::set; +using std::string; +using std::vector; class Type; diff --git a/tools/aidl/Type.h b/tools/aidl/Type.h index ae12720142e88..dfb80accc49ef 100644 --- a/tools/aidl/Type.h +++ b/tools/aidl/Type.h @@ -5,7 +5,8 @@ #include #include -using namespace std; +using std::string; +using std::vector; class Type { diff --git a/tools/aidl/aidl.cpp b/tools/aidl/aidl.cpp index 438007f527d5d..2d8f0acf8bb55 100644 --- a/tools/aidl/aidl.cpp +++ b/tools/aidl/aidl.cpp @@ -31,7 +31,10 @@ #define MIN_USER_SET_METHOD_ID 0 #define MAX_USER_SET_METHOD_ID 16777214 -using namespace std; +using std::map; +using std::set; +using std::string; +using std::vector; static void test_document(document_item_type* d) diff --git a/tools/aidl/generate_java.h b/tools/aidl/generate_java.h index 4bfcfeba07c86..be32364410a39 100644 --- a/tools/aidl/generate_java.h +++ b/tools/aidl/generate_java.h @@ -6,7 +6,8 @@ #include -using namespace std; +using std::string; +using std::vector; int generate_java(const string& filename, const string& originalSrc, interface_type* iface); diff --git a/tools/aidl/options.h b/tools/aidl/options.h index 387e37d087322..53ac47813dceb 100644 --- a/tools/aidl/options.h +++ b/tools/aidl/options.h @@ -5,7 +5,8 @@ #include #include -using namespace std; +using std::string; +using std::vector; enum { COMPILE_AIDL, diff --git a/tools/aidl/options_test.cpp b/tools/aidl/options_test.cpp index bd106ce54f2d2..7ac527dc9e4f4 100644 --- a/tools/aidl/options_test.cpp +++ b/tools/aidl/options_test.cpp @@ -3,7 +3,8 @@ const bool VERBOSE = false; -using namespace std; +using std::string; +using std::vector; struct Answer { const char* argv[8]; diff --git a/tools/aidl/search_path.h b/tools/aidl/search_path.h index 2bf94b12bbf10..9dd199ebf886d 100644 --- a/tools/aidl/search_path.h +++ b/tools/aidl/search_path.h @@ -6,7 +6,10 @@ #if __cplusplus #include #include -using namespace std; + +using std::string; +using std::vector; + extern "C" { #endif