Bug 1203232 - Fix -Wshadow warnings in some ipc/chromium headers. r=njn
authorChris Peterson <cpeterson@mozilla.com>
Sun, 13 Sep 2015 02:06:14 -0700
changeset 295347 05e1fdf35ee3504b67f95b488cfc54c7145afc6c
parent 295346 5320f1017b81832d630eab97cfed89507ce8c660
child 295348 212427250df615ead46d5fe0cea5be1656ad7100
push id5245
push userraliiev@mozilla.com
push dateThu, 29 Oct 2015 11:30:51 +0000
treeherdermozilla-beta@dac831dc1bd0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersnjn
bugs1203232
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1203232 - Fix -Wshadow warnings in some ipc/chromium headers. r=njn
ipc/chromium/src/base/hash_tables.h
ipc/chromium/src/base/message_loop.h
ipc/chromium/src/base/process.h
ipc/chromium/src/base/revocable_store.h
ipc/chromium/src/base/string_piece.h
ipc/chromium/src/base/tracked.h
ipc/chromium/src/chrome/common/child_process_info.h
ipc/chromium/src/chrome/common/ipc_message.cc
ipc/chromium/src/chrome/common/ipc_message.h
--- a/ipc/chromium/src/base/hash_tables.h
+++ b/ipc/chromium/src/base/hash_tables.h
@@ -19,18 +19,36 @@
 
 #include "base/string16.h"
 
 #if defined(COMPILER_MSVC) || (defined(ANDROID) && defined(_STLP_STD_NAME))
 #ifdef COMPILER_MSVC
 #pragma push_macro("_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS")
 #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
 #endif
+
+// Suppress -Wshadow warnings from stlport headers.
+#ifdef __GNUC__
+#  pragma GCC diagnostic push
+#  pragma GCC diagnostic ignored "-Wshadow"
+#  if MOZ_GCC_VERSION_AT_LEAST(4, 9, 0)
+#    pragma GCC diagnostic ignored "-Wshadow-local"
+#  endif
+#endif
+
 #include <hash_map>
 #include <hash_set>
+
+#ifdef __GNUC__
+#  if MOZ_GCC_VERSION_AT_LEAST(4, 9, 0)
+#    pragma GCC diagnostic pop // -Wshadow-local
+#  endif
+#  pragma GCC diagnostic pop // -Wshadow
+#endif
+
 #ifdef COMPILER_MSVC
 #pragma pop_macro("_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS")
 #endif
 namespace base {
 #ifdef ANDROID
 using _STLP_STD_NAME::hash_map;
 using _STLP_STD_NAME::hash_set;
 #else
--- a/ipc/chromium/src/base/message_loop.h
+++ b/ipc/chromium/src/base/message_loop.h
@@ -228,19 +228,19 @@ public:
 
   // Returns the type passed to the constructor.
   Type type() const { return type_; }
 
   // Unique, non-repeating ID for this message loop.
   int32_t id() const { return id_; }
 
   // Optional call to connect the thread name with this loop.
-  void set_thread_name(const std::string& thread_name) {
+  void set_thread_name(const std::string& aThreadName) {
     DCHECK(thread_name_.empty()) << "Should not rename this thread!";
-    thread_name_ = thread_name;
+    thread_name_ = aThreadName;
   }
   const std::string& thread_name() const { return thread_name_; }
 
   // Returns the MessageLoop object for the current thread, or null if none.
   static MessageLoop* current();
 
   // Enables or disables the recursive task processing. This happens in the case
   // of recursive message loops. Some unwanted message loop may occurs when
@@ -319,18 +319,18 @@ public:
 
   // This structure is copied around by value.
   struct PendingTask {
     Task* task;                        // The task to run.
     base::TimeTicks delayed_run_time;  // The time when the task should be run.
     int sequence_num;                  // Secondary sort key for run time.
     bool nestable;                     // OK to dispatch from a nested loop.
 
-    PendingTask(Task* task, bool nestable)
-        : task(task), sequence_num(0), nestable(nestable) {
+    PendingTask(Task* aTask, bool aNestable)
+        : task(aTask), sequence_num(0), nestable(aNestable) {
     }
 
     // Used to support sorting.
     bool operator<(const PendingTask& other) const;
   };
 
   typedef std::queue<PendingTask> TaskQueue;
   typedef std::priority_queue<PendingTask> DelayedTaskQueue;
@@ -458,17 +458,17 @@ public:
 // MessageLoopForUI extends MessageLoop with methods that are particular to a
 // MessageLoop instantiated with TYPE_UI.
 //
 // This class is typically used like so:
 //   MessageLoopForUI::current()->...call some method...
 //
 class MessageLoopForUI : public MessageLoop {
  public:
-  explicit MessageLoopForUI(Type type=TYPE_UI) : MessageLoop(type) {
+  explicit MessageLoopForUI(Type aType=TYPE_UI) : MessageLoop(aType) {
   }
 
   // Returns the MessageLoopForUI of the current thread.
   static MessageLoopForUI* current() {
     MessageLoop* loop = MessageLoop::current();
     if (!loop)
       return NULL;
     Type type = loop->type();
--- a/ipc/chromium/src/base/process.h
+++ b/ipc/chromium/src/base/process.h
@@ -24,26 +24,26 @@ typedef DWORD ProcessId;
 // On POSIX, our ProcessHandle will just be the PID.
 typedef pid_t ProcessHandle;
 typedef pid_t ProcessId;
 #endif
 
 class Process {
  public:
   Process() : process_(0), last_working_set_size_(0) {}
-  explicit Process(ProcessHandle handle) :
-    process_(handle), last_working_set_size_(0) {}
+  explicit Process(ProcessHandle aHandle) :
+    process_(aHandle), last_working_set_size_(0) {}
 
   // A handle to the current process.
   static Process Current();
 
   // Get/Set the handle for this process. The handle will be 0 if the process
   // is no longer running.
   ProcessHandle handle() const { return process_; }
-  void set_handle(ProcessHandle handle) { process_ = handle; }
+  void set_handle(ProcessHandle aHandle) { process_ = aHandle; }
 
   // Get the PID for this process.
   ProcessId pid() const;
 
   // Is the this process the current process.
   bool is_current() const;
 
   // Close the process handle. This will not terminate the process.
--- a/ipc/chromium/src/base/revocable_store.h
+++ b/ipc/chromium/src/base/revocable_store.h
@@ -15,19 +15,19 @@ class RevocableStore {
   // A |StoreRef| is used to link the |RevocableStore| to its items.  There is
   // one StoreRef per store, and each item holds a reference to it.  If the
   // store wishes to revoke its items, it sets |store_| to null.  Items are
   // permitted to release their reference to the |StoreRef| when they no longer
   // require the store.
   class StoreRef final {
    public:
     NS_INLINE_DECL_THREADSAFE_REFCOUNTING(StoreRef)
-    explicit StoreRef(RevocableStore* store) : store_(store) { }
+    explicit StoreRef(RevocableStore* aStore) : store_(aStore) { }
 
-    void set_store(RevocableStore* store) { store_ = store; }
+    void set_store(RevocableStore* aStore) { store_ = aStore; }
     RevocableStore* store() const { return store_; }
 
    protected:
     ~StoreRef() {}
    private:
     RevocableStore* store_;
 
     DISALLOW_EVIL_CONSTRUCTORS(StoreRef);
--- a/ipc/chromium/src/base/string_piece.h
+++ b/ipc/chromium/src/base/string_piece.h
@@ -49,24 +49,24 @@ class StringPiece {
   // typically a mistake to pass data() to a routine that expects a NUL
   // terminated string.
   const char* data() const { return ptr_; }
   size_type size() const { return length_; }
   size_type length() const { return length_; }
   bool empty() const { return length_ == 0; }
 
   void clear() { ptr_ = NULL; length_ = 0; }
-  void set(const char* data, size_type len) { ptr_ = data; length_ = len; }
+  void set(const char* aData, size_type aLen) { ptr_ = aData; length_ = aLen; }
   void set(const char* str) {
     ptr_ = str;
     length_ = str ? strlen(str) : 0;
   }
-  void set(const void* data, size_type len) {
-    ptr_ = reinterpret_cast<const char*>(data);
-    length_ = len;
+  void set(const void* aData, size_type aLen) {
+    ptr_ = reinterpret_cast<const char*>(aData);
+    length_ = aLen;
   }
 
   char operator[](size_type i) const { return ptr_[i]; }
 
   void remove_prefix(size_type n) {
     ptr_ += n;
     length_ -= n;
   }
--- a/ipc/chromium/src/base/tracked.h
+++ b/ipc/chromium/src/base/tracked.h
@@ -34,20 +34,20 @@ namespace tracked_objects {
 // Location provides basic info where of an object was constructed, or was
 // significantly brought to life.
 
 class Location {
  public:
   // Constructor should be called with a long-lived char*, such as __FILE__.
   // It assumes the provided value will persist as a global constant, and it
   // will not make a copy of it.
-  Location(const char* function_name, const char* file_name, int line_number)
-      : function_name_(function_name),
-        file_name_(file_name),
-        line_number_(line_number) { }
+  Location(const char* aFunctionName, const char* aFilename, int aLineNumber)
+      : function_name_(aFunctionName),
+        file_name_(aFilename),
+        line_number_(aLineNumber) { }
 
   // Provide a default constructor for easy of debugging.
   Location()
       : function_name_("Unknown"),
         file_name_("Unknown"),
         line_number_(-1) { }
 
   // Comparison operator for insertion into a std::map<> hash tables.
--- a/ipc/chromium/src/chrome/common/child_process_info.h
+++ b/ipc/chromium/src/chrome/common/child_process_info.h
@@ -74,20 +74,20 @@ class ChildProcessInfo {
     return false;
   }
 
   bool operator ==(const ChildProcessInfo& rhs) const {
     return process_.handle() == rhs.process_.handle();
   }
 
  protected:
-  void set_type(ProcessType type) { type_ = type; }
-  void set_name(const std::wstring& name) { name_ = name; }
-  void set_handle(base::ProcessHandle handle) {
-    process_.set_handle(handle);
+  void set_type(ProcessType aType) { type_ = aType; }
+  void set_name(const std::wstring& aName) { name_ = aName; }
+  void set_handle(base::ProcessHandle aHandle) {
+    process_.set_handle(aHandle);
     pid_ = -1;
   }
 
   // Derived objects need to use this constructor so we know what type we are.
   explicit ChildProcessInfo(ProcessType type);
 
  private:
   ProcessType type_;
--- a/ipc/chromium/src/chrome/common/ipc_message.cc
+++ b/ipc/chromium/src/chrome/common/ipc_message.cc
@@ -37,17 +37,17 @@ Message::Message()
   header()->source_event_id = 0;
   header()->parent_task_id = 0;
   header()->source_event_type = SourceEventType::Unknown;
 #endif
   InitLoggingVariables();
 }
 
 Message::Message(int32_t routing_id, msgid_t type, PriorityValue priority,
-                 MessageCompression compression, const char* const name)
+                 MessageCompression compression, const char* const aName)
     : Pickle(sizeof(Header)) {
   header()->routing = routing_id;
   header()->type = type;
   header()->flags = priority;
   if (compression == COMPRESSION_ENABLED)
     header()->flags |= COMPRESS_BIT;
   else if (compression == COMPRESSION_ALL)
     header()->flags |= COMPRESSALL_BIT;
@@ -60,17 +60,17 @@ Message::Message(int32_t routing_id, msg
 #if defined(OS_MACOSX)
   header()->cookie = 0;
 #endif
 #ifdef MOZ_TASK_TRACER
   header()->source_event_id = 0;
   header()->parent_task_id = 0;
   header()->source_event_type = SourceEventType::Unknown;
 #endif
-  InitLoggingVariables(name);
+  InitLoggingVariables(aName);
 }
 
 Message::Message(const char* data, int data_len) : Pickle(data, data_len) {
   InitLoggingVariables();
 }
 
 Message::Message(const Message& other) : Pickle(other) {
   InitLoggingVariables(other.name_);
@@ -91,18 +91,18 @@ Message::Message(Message&& other) : Pick
 #endif
 #ifdef MOZ_TASK_TRACER
   header()->source_event_id = other.header()->source_event_id;
   header()->parent_task_id = other.header()->parent_task_id;
   header()->source_event_type = other.header()->source_event_type;
 #endif
 }
 
-void Message::InitLoggingVariables(const char* const name) {
-  name_ = name;
+void Message::InitLoggingVariables(const char* const aName) {
+  name_ = aName;
 }
 
 Message& Message::operator=(const Message& other) {
   *static_cast<Pickle*>(this) = other;
   InitLoggingVariables(other.name_);
 #if defined(OS_POSIX)
   file_descriptor_set_ = other.file_descriptor_set_;
 #endif
--- a/ipc/chromium/src/chrome/common/ipc_message.h
+++ b/ipc/chromium/src/chrome/common/ipc_message.h
@@ -185,26 +185,26 @@ class Message : public Pickle {
     DCHECK(is_interrupt());
     header()->interrupt_local_stack_depth = depth;
   }
 
   int32_t seqno() const {
     return header()->seqno;
   }
 
-  void set_seqno(int32_t seqno) {
-    header()->seqno = seqno;
+  void set_seqno(int32_t aSeqno) {
+    header()->seqno = aSeqno;
   }
 
   const char* const name() const {
     return name_;
   }
 
-  void set_name(const char* const name) {
-    name_ = name;
+  void set_name(const char* const aName) {
+    name_ = aName;
   }
 
 #if defined(OS_POSIX)
   uint32_t num_fds() const;
 #endif
 
   template<class T>
   static bool Dispatch(const Message* msg, T* obj, void (T::*func)()) {