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 1d36e1a565
commit 230c67672b
9 changed files with 48 additions and 30 deletions

View File

@ -24,8 +24,26 @@
#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

View File

@ -233,9 +233,9 @@ public:
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_; }
@ -324,8 +324,8 @@ public:
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.
@ -463,7 +463,7 @@ public:
//
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.

View File

@ -29,8 +29,8 @@ typedef pid_t ProcessId;
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();
@ -38,7 +38,7 @@ class Process {
// 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;

View File

@ -20,9 +20,9 @@ class RevocableStore {
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:

View File

@ -54,14 +54,14 @@ class StringPiece {
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]; }

View File

@ -39,10 +39,10 @@ class Location {
// 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()

View File

@ -79,10 +79,10 @@ class ChildProcessInfo {
}
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;
}

View File

@ -42,7 +42,7 @@ Message::Message()
}
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;
@ -65,7 +65,7 @@ Message::Message(int32_t routing_id, msgid_t type, PriorityValue priority,
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) {
@ -96,8 +96,8 @@ Message::Message(Message&& other) : Pickle(mozilla::Move(other)) {
#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) {

View File

@ -190,16 +190,16 @@ class Message : public Pickle {
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)