Bug 1203232 - Fix -Wshadow warnings in some ipc/chromium headers. r=njn

This commit is contained in:
Chris Peterson 2015-09-13 02:06:14 -07:00
parent 2c66fb8d92
commit f1e88adb05
9 changed files with 48 additions and 30 deletions

View File

@ -24,8 +24,26 @@
#pragma push_macro("_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS") #pragma push_macro("_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS")
#define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS
#endif #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_map>
#include <hash_set> #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 #ifdef COMPILER_MSVC
#pragma pop_macro("_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS") #pragma pop_macro("_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS")
#endif #endif

View File

@ -233,9 +233,9 @@ public:
int32_t id() const { return id_; } int32_t id() const { return id_; }
// Optional call to connect the thread name with this loop. // 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!"; 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_; } const std::string& thread_name() const { return thread_name_; }
@ -324,8 +324,8 @@ public:
int sequence_num; // Secondary sort key for run time. int sequence_num; // Secondary sort key for run time.
bool nestable; // OK to dispatch from a nested loop. bool nestable; // OK to dispatch from a nested loop.
PendingTask(Task* task, bool nestable) PendingTask(Task* aTask, bool aNestable)
: task(task), sequence_num(0), nestable(nestable) { : task(aTask), sequence_num(0), nestable(aNestable) {
} }
// Used to support sorting. // Used to support sorting.
@ -463,7 +463,7 @@ public:
// //
class MessageLoopForUI : public MessageLoop { class MessageLoopForUI : public MessageLoop {
public: public:
explicit MessageLoopForUI(Type type=TYPE_UI) : MessageLoop(type) { explicit MessageLoopForUI(Type aType=TYPE_UI) : MessageLoop(aType) {
} }
// Returns the MessageLoopForUI of the current thread. // Returns the MessageLoopForUI of the current thread.

View File

@ -29,8 +29,8 @@ typedef pid_t ProcessId;
class Process { class Process {
public: public:
Process() : process_(0), last_working_set_size_(0) {} Process() : process_(0), last_working_set_size_(0) {}
explicit Process(ProcessHandle handle) : explicit Process(ProcessHandle aHandle) :
process_(handle), last_working_set_size_(0) {} process_(aHandle), last_working_set_size_(0) {}
// A handle to the current process. // A handle to the current process.
static Process Current(); static Process Current();
@ -38,7 +38,7 @@ class Process {
// Get/Set the handle for this process. The handle will be 0 if the process // Get/Set the handle for this process. The handle will be 0 if the process
// is no longer running. // is no longer running.
ProcessHandle handle() const { return process_; } 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. // Get the PID for this process.
ProcessId pid() const; ProcessId pid() const;

View File

@ -20,9 +20,9 @@ class RevocableStore {
class StoreRef final { class StoreRef final {
public: public:
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(StoreRef) 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_; } RevocableStore* store() const { return store_; }
protected: protected:

View File

@ -54,14 +54,14 @@ class StringPiece {
bool empty() const { return length_ == 0; } bool empty() const { return length_ == 0; }
void clear() { ptr_ = NULL; 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) { void set(const char* str) {
ptr_ = str; ptr_ = str;
length_ = str ? strlen(str) : 0; length_ = str ? strlen(str) : 0;
} }
void set(const void* data, size_type len) { void set(const void* aData, size_type aLen) {
ptr_ = reinterpret_cast<const char*>(data); ptr_ = reinterpret_cast<const char*>(aData);
length_ = len; length_ = aLen;
} }
char operator[](size_type i) const { return ptr_[i]; } char operator[](size_type i) const { return ptr_[i]; }

View File

@ -39,10 +39,10 @@ class Location {
// Constructor should be called with a long-lived char*, such as __FILE__. // 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 // It assumes the provided value will persist as a global constant, and it
// will not make a copy of it. // will not make a copy of it.
Location(const char* function_name, const char* file_name, int line_number) Location(const char* aFunctionName, const char* aFilename, int aLineNumber)
: function_name_(function_name), : function_name_(aFunctionName),
file_name_(file_name), file_name_(aFilename),
line_number_(line_number) { } line_number_(aLineNumber) { }
// Provide a default constructor for easy of debugging. // Provide a default constructor for easy of debugging.
Location() Location()

View File

@ -79,10 +79,10 @@ class ChildProcessInfo {
} }
protected: protected:
void set_type(ProcessType type) { type_ = type; } void set_type(ProcessType aType) { type_ = aType; }
void set_name(const std::wstring& name) { name_ = name; } void set_name(const std::wstring& aName) { name_ = aName; }
void set_handle(base::ProcessHandle handle) { void set_handle(base::ProcessHandle aHandle) {
process_.set_handle(handle); process_.set_handle(aHandle);
pid_ = -1; pid_ = -1;
} }

View File

@ -42,7 +42,7 @@ Message::Message()
} }
Message::Message(int32_t routing_id, msgid_t type, PriorityValue priority, 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)) { : Pickle(sizeof(Header)) {
header()->routing = routing_id; header()->routing = routing_id;
header()->type = type; header()->type = type;
@ -65,7 +65,7 @@ Message::Message(int32_t routing_id, msgid_t type, PriorityValue priority,
header()->parent_task_id = 0; header()->parent_task_id = 0;
header()->source_event_type = SourceEventType::Unknown; header()->source_event_type = SourceEventType::Unknown;
#endif #endif
InitLoggingVariables(name); InitLoggingVariables(aName);
} }
Message::Message(const char* data, int data_len) : Pickle(data, data_len) { Message::Message(const char* data, int data_len) : Pickle(data, data_len) {
@ -96,8 +96,8 @@ Message::Message(Message&& other) : Pickle(mozilla::Move(other)) {
#endif #endif
} }
void Message::InitLoggingVariables(const char* const name) { void Message::InitLoggingVariables(const char* const aName) {
name_ = name; name_ = aName;
} }
Message& Message::operator=(const Message& other) { Message& Message::operator=(const Message& other) {

View File

@ -190,16 +190,16 @@ class Message : public Pickle {
return header()->seqno; return header()->seqno;
} }
void set_seqno(int32_t seqno) { void set_seqno(int32_t aSeqno) {
header()->seqno = seqno; header()->seqno = aSeqno;
} }
const char* const name() const { const char* const name() const {
return name_; return name_;
} }
void set_name(const char* const name) { void set_name(const char* const aName) {
name_ = name; name_ = aName;
} }
#if defined(OS_POSIX) #if defined(OS_POSIX)