Fix compiler warnings in libchrome
Also fix compiler warnings in unit tests, except for unused parameter.
There are a ton of unused parameters in unit tests, and those errors
have no risk of spreading through the platform.
Bug: 26228533
Test: libchrome builds, unittests pass
Change-Id: I50431c8e143902c4b71b4381e4dbbc67cdc4507c
diff --git a/Android.mk b/Android.mk
index 71e29f4..f160434 100644
--- a/Android.mk
+++ b/Android.mk
@@ -22,11 +22,8 @@
# ========================================================
libchromeCommonCppExtension := .cc
-libchromeCommonCFlags := -Wall -Werror \
- -Wno-char-subscripts -Wno-missing-field-initializers \
- -Wno-unused-function -Wno-unused-parameter
-libchromeCommonCppFlags := -Wno-deprecated-register -Wno-sign-promo \
- -Wno-non-virtual-dtor
+libchromeCommonCFlags := -Wall -Werror
+libchromeCommonCppFlags :=
libchromeCommonCIncludes := \
external/gmock/include \
external/gtest/include \
@@ -506,7 +503,7 @@
LOCAL_SRC_FILES := $(libchromeCommonUnittestSrc)
LOCAL_RTTI_FLAG := -frtti
LOCAL_CPP_EXTENSION := $(libchromeCommonCppExtension)
-LOCAL_CFLAGS := $(libchromeCommonCFlags) $(libchromeHostCFlags) -DUNIT_TEST
+LOCAL_CFLAGS := $(libchromeCommonCFlags) $(libchromeHostCFlags) -DUNIT_TEST -Wno-unused-parameter
LOCAL_CPPFLAGS := $(libchromeCommonCppFlags)
LOCAL_C_INCLUDES := $(libchromeCommonCIncludes)
LOCAL_SHARED_LIBRARIES := libchrome libevent-host
@@ -526,7 +523,7 @@
LOCAL_SRC_FILES := $(libchromeCommonUnittestSrc)
LOCAL_RTTI_FLAG := -frtti
LOCAL_CPP_EXTENSION := $(libchromeCommonCppExtension)
-LOCAL_CFLAGS := $(libchromeCommonCFlags) -DUNIT_TEST -DDONT_EMBED_BUILD_METADATA
+LOCAL_CFLAGS := $(libchromeCommonCFlags) -DUNIT_TEST -DDONT_EMBED_BUILD_METADATA -Wno-unused-parameter
LOCAL_CPPFLAGS := $(libchromeCommonCppFlags)
LOCAL_C_INCLUDES := $(libchromeCommonCIncludes)
LOCAL_SHARED_LIBRARIES := libchrome libevent
diff --git a/base/bind_helpers.h b/base/bind_helpers.h
index 4003dea..4068d37 100644
--- a/base/bind_helpers.h
+++ b/base/bind_helpers.h
@@ -520,7 +520,7 @@
template <typename T, typename... Rest>
struct MaybeScopedRefPtr<true, T, Rest...> {
- MaybeScopedRefPtr(const T& o, const Rest&...) {}
+ MaybeScopedRefPtr(const T& /* o */, const Rest&...) {}
};
template <typename T, typename... Rest>
diff --git a/base/bind_unittest.cc b/base/bind_unittest.cc
index f885403..140b2c3 100644
--- a/base/bind_unittest.cc
+++ b/base/bind_unittest.cc
@@ -57,6 +57,7 @@
class Parent {
public:
+ virtual ~Parent() = default;
void AddRef(void) const {}
void Release(void) const {}
virtual void VirtualSet() { value = kParentValue; }
@@ -66,18 +67,22 @@
class Child : public Parent {
public:
+ ~Child() override = default;
void VirtualSet() override { value = kChildValue; }
void NonVirtualSet() { value = kChildValue; }
};
class NoRefParent {
public:
+ virtual ~NoRefParent() = default;
virtual void VirtualSet() { value = kParentValue; }
void NonVirtualSet() { value = kParentValue; }
int value;
};
class NoRefChild : public NoRefParent {
+ public:
+ ~NoRefChild() override = default;
void VirtualSet() override { value = kChildValue; }
void NonVirtualSet() { value = kChildValue; }
};
diff --git a/base/command_line.cc b/base/command_line.cc
index 3fcf22a..c6f3197 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -145,7 +145,7 @@
} // namespace
-CommandLine::CommandLine(NoProgram no_program)
+CommandLine::CommandLine(NoProgram /* no_program */)
: argv_(1),
begin_args_(1) {
}
@@ -434,7 +434,7 @@
}
CommandLine::StringType CommandLine::GetArgumentsStringInternal(
- bool quote_placeholders) const {
+ bool /* quote_placeholders */) const {
StringType params;
// Append switches and arguments.
bool parse_switches = true;
diff --git a/base/debug/alias.cc b/base/debug/alias.cc
index 6b0caaa..d498084 100644
--- a/base/debug/alias.cc
+++ b/base/debug/alias.cc
@@ -12,7 +12,7 @@
#pragma optimize("", off)
#endif
-void Alias(const void* var) {
+void Alias(const void* /* var */) {
}
#if defined(COMPILER_MSVC)
diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc
index 5e704dc..4506cbe 100644
--- a/base/debug/stack_trace_posix.cc
+++ b/base/debug/stack_trace_posix.cc
@@ -69,12 +69,10 @@
// "out/Debug/base_unittests(_ZN10StackTraceC1Ev+0x20) [0x817778c]"
// =>
// "out/Debug/base_unittests(StackTrace::StackTrace()+0x20) [0x817778c]"
+#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
void DemangleSymbols(std::string* text) {
// Note: code in this function is NOT async-signal safe (std::string uses
// malloc internally).
-
-#if defined(__GLIBCXX__) && !defined(__UCLIBC__)
-
std::string::size_type search_from = 0;
while (search_from < text->size()) {
// Look for the start of a mangled symbol, from search_from.
@@ -109,9 +107,11 @@
search_from = mangled_start + 2;
}
}
-
-#endif // defined(__GLIBCXX__) && !defined(__UCLIBC__)
}
+#elif !defined(__UCLIBC__)
+void DemangleSymbols(std::string* /* text */) {}
+#endif // defined(__GLIBCXX__) && !defined(__UCLIBC__)
+
#endif // !defined(USE_SYMBOLIZE)
class BacktraceOutputHandler {
@@ -122,6 +122,7 @@
virtual ~BacktraceOutputHandler() {}
};
+#if defined(USE_SYMBOLIZE) || !defined(__UCLIBC__)
void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
// This should be more than enough to store a 64-bit number in hex:
// 16 hex digits + 1 for null-terminator.
@@ -131,6 +132,7 @@
buf, sizeof(buf), 16, 12);
handler->HandleOutput(buf);
}
+#endif // defined(USE_SYMBOLIZE) || !defined(__UCLIBC__)
#if defined(USE_SYMBOLIZE)
void OutputFrameId(intptr_t frame_id, BacktraceOutputHandler* handler) {
@@ -144,9 +146,13 @@
}
#endif // defined(USE_SYMBOLIZE)
-void ProcessBacktrace(void *const *trace,
+#if !defined(__UCLIBC__)
+void ProcessBacktrace(void *const * trace,
size_t size,
BacktraceOutputHandler* handler) {
+ (void)trace; // unused based on build context below.
+ (void)size; // unusud based on build context below.
+ (void)handler; // unused based on build context below.
// NOTE: This code MUST be async-signal safe (it's used by in-process
// stack dumping signal handler). NO malloc or stdio is allowed here.
@@ -198,6 +204,7 @@
}
#endif // defined(USE_SYMBOLIZE)
}
+#endif // !defined(__UCLIBC__)
void PrintToStderr(const char* output) {
// NOTE: This code MUST be async-signal safe (it's used by in-process
@@ -205,7 +212,10 @@
ignore_result(HANDLE_EINTR(write(STDERR_FILENO, output, strlen(output))));
}
-void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) {
+void StackDumpSignalHandler(int signal,
+ siginfo_t* info,
+ void* void_context) {
+ (void)void_context; // unused depending on build context
// NOTE: This code MUST be async-signal safe.
// NO malloc or stdio is allowed here.
diff --git a/base/files/file_path.cc b/base/files/file_path.cc
index de8927a..b04a01d 100644
--- a/base/files/file_path.cc
+++ b/base/files/file_path.cc
@@ -45,7 +45,7 @@
// otherwise returns npos. This can only be true on Windows, when a pathname
// begins with a letter followed by a colon. On other platforms, this always
// returns npos.
-StringType::size_type FindDriveLetter(const StringType& path) {
+StringType::size_type FindDriveLetter(const StringType& /* path */) {
#if defined(FILE_PATH_USES_DRIVE_LETTERS)
// This is dependent on an ASCII-based character set, but that's a
// reasonable assumption. iswalpha can be too inclusive here.
@@ -1297,7 +1297,7 @@
return NormalizePathSeparatorsTo(kSeparators[0]);
}
-FilePath FilePath::NormalizePathSeparatorsTo(CharType separator) const {
+FilePath FilePath::NormalizePathSeparatorsTo(CharType /* separator */) const {
#if defined(FILE_PATH_USES_WIN_SEPARATORS)
DCHECK_NE(kSeparators + kSeparatorsLength,
std::find(kSeparators, kSeparators + kSeparatorsLength, separator));
diff --git a/base/files/file_util_posix.cc b/base/files/file_util_posix.cc
index af0cde4..62ca6a5 100644
--- a/base/files/file_util_posix.cc
+++ b/base/files/file_util_posix.cc
@@ -559,7 +559,7 @@
return CreateTemporaryDirInDirImpl(base_dir, mkdtemp_template, new_dir);
}
-bool CreateNewTempDirectory(const FilePath::StringType& prefix,
+bool CreateNewTempDirectory(const FilePath::StringType& /* prefix */,
FilePath* new_temp_path) {
FilePath tmpdir;
if (!GetTempDir(&tmpdir))
diff --git a/base/lazy_instance.h b/base/lazy_instance.h
index fb19379..95f1308 100644
--- a/base/lazy_instance.h
+++ b/base/lazy_instance.h
@@ -48,7 +48,7 @@
// initialization, as base's LINKER_INITIALIZED requires a constructor and on
// some compilers (notably gcc 4.4) this still ends up needing runtime
// initialization.
-#define LAZY_INSTANCE_INITIALIZER {0}
+#define LAZY_INSTANCE_INITIALIZER {}
namespace base {
@@ -96,7 +96,7 @@
static Type* New(void* instance) {
return DefaultLazyInstanceTraits<Type>::New(instance);
}
- static void Delete(Type* instance) {
+ static void Delete(Type* /* instance */) {
}
};
diff --git a/base/logging.cc b/base/logging.cc
index 1c86779..4173885 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -194,7 +194,8 @@
UnlockLogging();
}
- static void Init(LogLockingState lock_log, const PathChar* new_log_file) {
+ static void Init(LogLockingState lock_log,
+ const PathChar* /* new_log_file */) {
if (initialized)
return;
lock_log_file = lock_log;
@@ -670,7 +671,7 @@
stream_ << base::PlatformThread::CurrentId() << ':';
if (g_log_timestamp) {
time_t t = time(nullptr);
- struct tm local_time = {0};
+ struct tm local_time = {};
#ifdef _MSC_VER
localtime_s(&local_time, &t);
#else
diff --git a/base/memory/scoped_ptr.h b/base/memory/scoped_ptr.h
index 987ccfa..69a9826 100644
--- a/base/memory/scoped_ptr.h
+++ b/base/memory/scoped_ptr.h
@@ -105,7 +105,7 @@
template <class T>
struct DefaultDeleter {
DefaultDeleter() {}
- template <typename U> DefaultDeleter(const DefaultDeleter<U>& other) {
+ template <typename U> DefaultDeleter(const DefaultDeleter<U>& /* other */) {
// IMPLEMENTATION NOTE: C++11 20.7.1.1.2p2 only provides this constructor
// if U* is implicitly convertible to T* and U is not an array type.
//
diff --git a/base/message_loop/incoming_task_queue.cc b/base/message_loop/incoming_task_queue.cc
index 642222e..67a813f 100644
--- a/base/message_loop/incoming_task_queue.cc
+++ b/base/message_loop/incoming_task_queue.cc
@@ -26,16 +26,17 @@
// Returns true if MessagePump::ScheduleWork() must be called one
// time for every task that is added to the MessageLoop incoming queue.
-bool AlwaysNotifyPump(MessageLoop::Type type) {
#if defined(OS_ANDROID)
+bool AlwaysNotifyPump(MessageLoop::Type type) {
// The Android UI message loop needs to get notified each time a task is
- // added
- // to the incoming queue.
+ // added to the incoming queue.
return type == MessageLoop::TYPE_UI || type == MessageLoop::TYPE_JAVA;
-#else
- return false;
-#endif
}
+#else
+bool AlwaysNotifyPump(MessageLoop::Type /* type */) {
+ return false;
+}
+#endif
} // namespace
diff --git a/base/message_loop/message_pump_libevent.cc b/base/message_loop/message_pump_libevent.cc
index e022c8c..cb703ce 100644
--- a/base/message_loop/message_pump_libevent.cc
+++ b/base/message_loop/message_pump_libevent.cc
@@ -218,7 +218,7 @@
}
// Tell libevent to break out of inner loop.
-static void timer_callback(int fd, short events, void *context)
+static void timer_callback(int /* fd */, short /* events */, void *context)
{
event_base_loopbreak((struct event_base *)context);
}
@@ -370,7 +370,8 @@
// Called if a byte is received on the wakeup pipe.
// static
-void MessagePumpLibevent::OnWakeup(int socket, short flags, void* context) {
+void MessagePumpLibevent::OnWakeup(int socket, short /* flags */,
+ void* context) {
MessagePumpLibevent* that = static_cast<MessagePumpLibevent*>(context);
DCHECK(that->wakeup_pipe_out_ == socket);
diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc
index 1a9c220..6198cff 100644
--- a/base/metrics/histogram.cc
+++ b/base/metrics/histogram.cc
@@ -313,7 +313,7 @@
Histogram::~Histogram() {
}
-bool Histogram::PrintEmptyBucket(size_t index) const {
+bool Histogram::PrintEmptyBucket(size_t /* index */) const {
return true;
}
@@ -775,7 +775,8 @@
return true;
}
-double CustomHistogram::GetBucketSize(Count current, size_t i) const {
+double CustomHistogram::GetBucketSize(Count /* current */,
+ size_t /* i */) const {
return 1;
}
diff --git a/base/metrics/histogram_base.cc b/base/metrics/histogram_base.cc
index de34c79..c4306fd 100644
--- a/base/metrics/histogram_base.cc
+++ b/base/metrics/histogram_base.cc
@@ -92,7 +92,7 @@
return SerializeInfoImpl(pickle);
}
-int HistogramBase::FindCorruption(const HistogramSamples& samples) const {
+int HistogramBase::FindCorruption(const HistogramSamples& /* samples */) const {
// Not supported by default.
return NO_INCONSISTENCIES;
}
diff --git a/base/metrics/histogram_samples.cc b/base/metrics/histogram_samples.cc
index f5e03b9..5a9ceab 100644
--- a/base/metrics/histogram_samples.cc
+++ b/base/metrics/histogram_samples.cc
@@ -130,7 +130,7 @@
SampleCountIterator::~SampleCountIterator() {}
-bool SampleCountIterator::GetBucketIndex(size_t* index) const {
+bool SampleCountIterator::GetBucketIndex(size_t* /* index */) const {
DCHECK(!Done());
return false;
}
diff --git a/base/metrics/sparse_histogram.cc b/base/metrics/sparse_histogram.cc
index e5cdb43..d5fd4a3 100644
--- a/base/metrics/sparse_histogram.cc
+++ b/base/metrics/sparse_histogram.cc
@@ -38,9 +38,9 @@
}
bool SparseHistogram::HasConstructionArguments(
- Sample expected_minimum,
- Sample expected_maximum,
- size_t expected_bucket_count) const {
+ Sample /* expected_minimum */,
+ Sample /* expected_maximum */,
+ size_t /* expected_bucket_count */) const {
// SparseHistogram never has min/max/bucket_count limit.
return false;
}
@@ -99,13 +99,13 @@
return SparseHistogram::FactoryGet(histogram_name, flags);
}
-void SparseHistogram::GetParameters(DictionaryValue* params) const {
+void SparseHistogram::GetParameters(DictionaryValue* /* params */) const {
// TODO(kaiwang): Implement. (See HistogramBase::WriteJSON.)
}
-void SparseHistogram::GetCountAndBucketData(Count* count,
- int64* sum,
- ListValue* buckets) const {
+void SparseHistogram::GetCountAndBucketData(Count* /* count */,
+ int64* /* sum */,
+ ListValue* /* buckets */) const {
// TODO(kaiwang): Implement. (See HistogramBase::WriteJSON.)
}
diff --git a/base/metrics/statistics_recorder.cc b/base/metrics/statistics_recorder.cc
index a08730d..fc952bf 100644
--- a/base/metrics/statistics_recorder.cc
+++ b/base/metrics/statistics_recorder.cc
@@ -253,7 +253,7 @@
}
// static
-void StatisticsRecorder::DumpHistogramsToVlog(void* instance) {
+void StatisticsRecorder::DumpHistogramsToVlog(void* /* instance */) {
std::string output;
StatisticsRecorder::WriteGraph(std::string(), &output);
VLOG(1) << output;
diff --git a/base/numerics/safe_conversions_impl.h b/base/numerics/safe_conversions_impl.h
index 4157067..3db045f 100644
--- a/base/numerics/safe_conversions_impl.h
+++ b/base/numerics/safe_conversions_impl.h
@@ -135,7 +135,7 @@
DstSign,
SrcSign,
NUMERIC_RANGE_CONTAINED> {
- static RangeConstraint Check(Src value) { return RANGE_VALID; }
+ static RangeConstraint Check(Src /* value */) { return RANGE_VALID; }
};
// Signed to signed narrowing: Both the upper and lower boundaries may be
diff --git a/base/numerics/safe_math_impl.h b/base/numerics/safe_math_impl.h
index 08f2e88..2ed64ae 100644
--- a/base/numerics/safe_math_impl.h
+++ b/base/numerics/safe_math_impl.h
@@ -399,7 +399,7 @@
template <typename Src>
CheckedNumericState(
Src value,
- RangeConstraint validity,
+ RangeConstraint /* validity */,
typename enable_if<std::numeric_limits<Src>::is_integer, int>::type = 0) {
switch (DstRangeRelationToSrcRange<T>(value)) {
case RANGE_VALID:
diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc
index 5747727..7f490c3 100644
--- a/base/process/launch_posix.cc
+++ b/base/process/launch_posix.cc
@@ -152,7 +152,7 @@
// See crbug.com/177956.
void ResetChildSignalHandlersToDefaults(void) {
for (int signum = 1; ; ++signum) {
- struct kernel_sigaction act = {0};
+ struct kernel_sigaction act = {};
int sigaction_get_ret = sys_rt_sigaction(signum, NULL, &act);
if (sigaction_get_ret && errno == EINVAL) {
#if !defined(NDEBUG)
diff --git a/base/process/process_posix.cc b/base/process/process_posix.cc
index 43e27cd..03e762b 100644
--- a/base/process/process_posix.cc
+++ b/base/process/process_posix.cc
@@ -293,7 +293,7 @@
}
#if !defined(OS_NACL_NONSFI)
-bool Process::Terminate(int exit_code, bool wait) const {
+bool Process::Terminate(int /* exit_code */, bool wait) const {
// result_code isn't supportable.
DCHECK(IsValid());
DCHECK_GT(process_, 1);
diff --git a/base/strings/string_number_conversions.cc b/base/strings/string_number_conversions.cc
index 0252782..cd74818 100644
--- a/base/strings/string_number_conversions.cc
+++ b/base/strings/string_number_conversions.cc
@@ -50,7 +50,7 @@
struct TestNegT {};
template <typename INT2>
struct TestNegT<INT2, false> {
- static bool TestNeg(INT2 value) {
+ static bool TestNeg(INT2 /* value */) {
// value is unsigned, and can never be negative.
return false;
}
diff --git a/base/strings/utf_string_conversion_utils.cc b/base/strings/utf_string_conversion_utils.cc
index 022c0df..1a3a1c3 100644
--- a/base/strings/utf_string_conversion_utils.cc
+++ b/base/strings/utf_string_conversion_utils.cc
@@ -55,7 +55,7 @@
#if defined(WCHAR_T_IS_UTF32)
bool ReadUnicodeCharacter(const wchar_t* src,
- int32 src_len,
+ int32 /* src_len */,
int32* char_index,
uint32* code_point) {
// Conversion is easy since the source is 32-bit.
diff --git a/base/sync_socket_posix.cc b/base/sync_socket_posix.cc
index 51b38a5..47196f4 100644
--- a/base/sync_socket_posix.cc
+++ b/base/sync_socket_posix.cc
@@ -103,8 +103,9 @@
return descriptor.fd;
}
-bool SyncSocket::PrepareTransitDescriptor(ProcessHandle peer_process_handle,
- TransitDescriptor* descriptor) {
+bool SyncSocket::PrepareTransitDescriptor(
+ ProcessHandle /* peer_process_handle */,
+ TransitDescriptor* descriptor) {
descriptor->fd = handle();
descriptor->auto_close = false;
return descriptor->fd != kInvalidHandle;
diff --git a/base/task/cancelable_task_tracker.cc b/base/task/cancelable_task_tracker.cc
index a2e4799..96aadc7 100644
--- a/base/task/cancelable_task_tracker.cc
+++ b/base/task/cancelable_task_tracker.cc
@@ -37,7 +37,7 @@
}
bool IsCanceled(const CancellationFlag* flag,
- base::ScopedClosureRunner* cleanup_runner) {
+ base::ScopedClosureRunner* /* cleanup_runner */) {
return flag->IsSet();
}
diff --git a/base/third_party/nspr/prtime.cc b/base/third_party/nspr/prtime.cc
index 9335b01..2e69b93 100644
--- a/base/third_party/nspr/prtime.cc
+++ b/base/third_party/nspr/prtime.cc
@@ -160,7 +160,7 @@
result += exploded->tm_usec;
return result;
#elif defined(OS_POSIX)
- struct tm exp_tm = {0};
+ struct tm exp_tm = {};
exp_tm.tm_sec = exploded->tm_sec;
exp_tm.tm_min = exploded->tm_min;
exp_tm.tm_hour = exploded->tm_hour;
@@ -445,7 +445,7 @@
*/
PRTimeParameters
-PR_GMTParameters(const PRExplodedTime *gmt)
+PR_GMTParameters(const PRExplodedTime* /* gmt */)
{
PRTimeParameters retVal = { 0, 0 };
return retVal;
diff --git a/base/threading/platform_thread_linux.cc b/base/threading/platform_thread_linux.cc
index 9f74374..64a9727 100644
--- a/base/threading/platform_thread_linux.cc
+++ b/base/threading/platform_thread_linux.cc
@@ -37,7 +37,7 @@
{ThreadPriority::REALTIME_AUDIO, -10},
};
-bool SetThreadPriorityForPlatform(PlatformThreadHandle handle,
+bool SetThreadPriorityForPlatform(PlatformThreadHandle /* handle */,
ThreadPriority priority) {
#if !defined(OS_NACL)
// TODO(gab): Assess the correctness of using |pthread_self()| below instead
@@ -49,7 +49,7 @@
#endif
}
-bool GetThreadPriorityForPlatform(PlatformThreadHandle handle,
+bool GetThreadPriorityForPlatform(PlatformThreadHandle /* handle */,
ThreadPriority* priority) {
#if !defined(OS_NACL)
int maybe_sched_rr = 0;
@@ -100,7 +100,7 @@
void TerminateOnThread() {}
-size_t GetDefaultThreadStackSize(const pthread_attr_t& attributes) {
+size_t GetDefaultThreadStackSize(const pthread_attr_t& /* attributes */) {
#if !defined(THREAD_SANITIZER)
return 0;
#else
diff --git a/base/threading/thread_local_storage.h b/base/threading/thread_local_storage.h
index 50f8868..8c48440 100644
--- a/base/threading/thread_local_storage.h
+++ b/base/threading/thread_local_storage.h
@@ -87,7 +87,7 @@
// initialization, as base's LINKER_INITIALIZED requires a constructor and on
// some compilers (notably gcc 4.4) this still ends up needing runtime
// initialization.
- #define TLS_INITIALIZER {0}
+ #define TLS_INITIALIZER {}
// A key representing one value stored in TLS.
// Initialize like
diff --git a/base/threading/thread_restrictions.h b/base/threading/thread_restrictions.h
index 54f50eb..4ba70a9 100644
--- a/base/threading/thread_restrictions.h
+++ b/base/threading/thread_restrictions.h
@@ -160,9 +160,9 @@
#else
// Inline the empty definitions of these functions so that they can be
// compiled out.
- static bool SetIOAllowed(bool allowed) { return true; }
+ static bool SetIOAllowed(bool /* allowed */) { return true; }
static void AssertIOAllowed() {}
- static bool SetSingletonAllowed(bool allowed) { return true; }
+ static bool SetSingletonAllowed(bool /* allowed */) { return true; }
static void AssertSingletonAllowed() {}
static void DisallowWaiting() {}
static void AssertWaitAllowed() {}
@@ -213,7 +213,7 @@
#if ENABLE_THREAD_RESTRICTIONS
static bool SetWaitAllowed(bool allowed);
#else
- static bool SetWaitAllowed(bool allowed) { return true; }
+ static bool SetWaitAllowed(bool /* allowed */) { return true; }
#endif
// Constructing a ScopedAllowWait temporarily allows waiting on the current
diff --git a/base/threading/worker_pool_posix.cc b/base/threading/worker_pool_posix.cc
index 349b5d7..1757f5e 100644
--- a/base/threading/worker_pool_posix.cc
+++ b/base/threading/worker_pool_posix.cc
@@ -49,7 +49,8 @@
}
void WorkerPoolImpl::PostTask(const tracked_objects::Location& from_here,
- const base::Closure& task, bool task_is_slow) {
+ const base::Closure& task,
+ bool /* task_is_slow */) {
pool_->PostTask(from_here, task);
}
diff --git a/base/time/pr_time_unittest.cc b/base/time/pr_time_unittest.cc
index 06043a5..06f4d27 100644
--- a/base/time/pr_time_unittest.cc
+++ b/base/time/pr_time_unittest.cc
@@ -31,15 +31,16 @@
// must be a time guaranteed to be outside of a DST fallback hour in
// any timezone.
struct tm local_comparison_tm = {
- 0, // second
- 45, // minute
- 12, // hour
- 15, // day of month
- 10 - 1, // month
- 2007 - 1900, // year
- 0, // day of week (ignored, output only)
- 0, // day of year (ignored, output only)
- -1 // DST in effect, -1 tells mktime to figure it out
+ .tm_sec = 0,
+ .tm_min = 45,
+ .tm_hour = 12,
+ .tm_mday = 15,
+ .tm_mon = 10 - 1,
+ .tm_year = 2007 - 1900,
+ .tm_wday = 0, // (ignored, output only)
+ .tm_yday = 0, // (ignored, output only)
+ .tm_isdst = -1, // DST in effect, -1 tells mktime to figure it out
+ .tm_gmtoff = 0,
};
comparison_time_local_ =
mktime(&local_comparison_tm) * Time::kMicrosecondsPerSecond;
@@ -47,15 +48,16 @@
const int microseconds = 441381;
struct tm local_comparison_tm_2 = {
- 12, // second
- 28, // minute
- 11, // hour
- 8, // day of month
- 7 - 1, // month
- 2013 - 1900, // year
- 0, // day of week (ignored, output only)
- 0, // day of year (ignored, output only)
- -1 // DST in effect, -1 tells mktime to figure it out
+ .tm_sec = 12,
+ .tm_min = 28,
+ .tm_hour = 11,
+ .tm_mday = 8,
+ .tm_mon = 7 - 1,
+ .tm_year = 2013 - 1900,
+ .tm_wday = 0, // (ignored, output only)
+ .tm_yday = 0, // (ignored, output only)
+ .tm_isdst = -1, // DST in effect, -1 tells mktime to figure it out
+ .tm_gmtoff = 0,
};
comparison_time_local_2_ =
mktime(&local_comparison_tm_2) * Time::kMicrosecondsPerSecond;
@@ -74,7 +76,7 @@
time(¤t_time);
const int BUFFER_SIZE = 64;
- struct tm local_time = {0};
+ struct tm local_time = {};
char time_buf[BUFFER_SIZE] = {0};
#if defined(OS_WIN)
localtime_s(&local_time, ¤t_time);
diff --git a/base/time/time_unittest.cc b/base/time/time_unittest.cc
index b7e05b7..8ea6002 100644
--- a/base/time/time_unittest.cc
+++ b/base/time/time_unittest.cc
@@ -31,15 +31,16 @@
// must be a time guaranteed to be outside of a DST fallback hour in
// any timezone.
struct tm local_comparison_tm = {
- 0, // second
- 45, // minute
- 12, // hour
- 15, // day of month
- 10 - 1, // month
- 2007 - 1900, // year
- 0, // day of week (ignored, output only)
- 0, // day of year (ignored, output only)
- -1 // DST in effect, -1 tells mktime to figure it out
+ .tm_sec = 0,
+ .tm_min = 45,
+ .tm_hour = 12,
+ .tm_mday = 15,
+ .tm_mon = 10 - 1,
+ .tm_year = 2007 - 1900,
+ .tm_wday = 0, // (ignored, output only)
+ .tm_yday = 0, // (ignored, output only)
+ .tm_isdst = -1, // DST in effect, -1 tells mktime to figure it out
+ .tm_gmtoff = 0,
};
time_t converted_time = mktime(&local_comparison_tm);
@@ -115,11 +116,11 @@
// Some platform implementations of FromExploded are liable to drop
// milliseconds if we aren't careful.
Time now = Time::NowFromSystemTime();
- Time::Exploded exploded1 = {0};
+ Time::Exploded exploded1 = {};
now.UTCExplode(&exploded1);
exploded1.millisecond = 500;
Time time = Time::FromUTCExploded(exploded1);
- Time::Exploded exploded2 = {0};
+ Time::Exploded exploded2 = {};
time.UTCExplode(&exploded2);
EXPECT_EQ(exploded1.millisecond, exploded2.millisecond);
}
@@ -167,8 +168,8 @@
time(¤t_time);
const int BUFFER_SIZE = 64;
- struct tm local_time = {0};
- char time_buf[BUFFER_SIZE] = {0};
+ struct tm local_time = {};
+ char time_buf[BUFFER_SIZE] = {};
#if defined(OS_WIN)
localtime_s(&local_time, ¤t_time);
asctime_s(time_buf, arraysize(time_buf), &local_time);
diff --git a/base/trace_event/trace_event.h b/base/trace_event/trace_event.h
index c41ca1e..95e8867 100644
--- a/base/trace_event/trace_event.h
+++ b/base/trace_event/trace_event.h
@@ -1232,7 +1232,7 @@
TraceID(ForceMangle id, unsigned char* flags) : data_(id.data()) {
*flags |= TRACE_EVENT_FLAG_MANGLE_ID;
}
- TraceID(DontMangle id, unsigned char* flags) : data_(id.data()) {
+ TraceID(DontMangle id, unsigned char* /* flags */) : data_(id.data()) {
}
TraceID(unsigned long long id, unsigned char* flags)
: data_(id) { (void)flags; }
diff --git a/base/trace_event/trace_event_impl.cc b/base/trace_event/trace_event_impl.cc
index 0babcc3..9d91653 100644
--- a/base/trace_event/trace_event_impl.cc
+++ b/base/trace_event/trace_event_impl.cc
@@ -238,17 +238,18 @@
chunks_[current_iteration_index_++] : NULL;
}
- scoped_ptr<TraceBufferChunk> GetChunk(size_t* index) override {
+ scoped_ptr<TraceBufferChunk> GetChunk(size_t* /* index */) override {
NOTIMPLEMENTED();
return scoped_ptr<TraceBufferChunk>();
}
- void ReturnChunk(size_t index, scoped_ptr<TraceBufferChunk>) override {
+ void ReturnChunk(size_t /* index */,
+ scoped_ptr<TraceBufferChunk>) override {
NOTIMPLEMENTED();
}
bool IsFull() const override { return false; }
size_t Size() const override { return 0; }
size_t Capacity() const override { return 0; }
- TraceEvent* GetEventByHandle(TraceEventHandle handle) override {
+ TraceEvent* GetEventByHandle(TraceEventHandle /* handle */) override {
return NULL;
}
scoped_ptr<TraceBuffer> CloneForIteration() const override {
@@ -256,7 +257,7 @@
return scoped_ptr<TraceBuffer>();
}
void EstimateTraceMemoryOverhead(
- TraceEventMemoryOverhead* overhead) override {
+ TraceEventMemoryOverhead* /* overhead */) override {
NOTIMPLEMENTED();
}
diff --git a/base/trace_event/trace_event_memory.cc b/base/trace_event/trace_event_memory.cc
index 40e1d4a..ece0065 100644
--- a/base/trace_event/trace_event_memory.cc
+++ b/base/trace_event/trace_event_memory.cc
@@ -119,7 +119,7 @@
// stack_out[2] = "category2"
// stack_out[3] = "name2"
// Returns int instead of size_t to match the signature required by tcmalloc.
-int GetPseudoStack(int skip_count_ignored, void** stack_out) {
+int GetPseudoStack(int /* skip_count_ignored */, void** stack_out) {
// If the tracing system isn't fully initialized, just skip this allocation.
// Attempting to initialize will allocate memory, causing this function to
// be called recursively from inside the allocator.
diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc
index 4534e6e..93bac6d 100644
--- a/base/tracked_objects.cc
+++ b/base/tracked_objects.cc
@@ -776,7 +776,8 @@
}
// static
-void ThreadData::EnsureCleanupWasCalled(int major_threads_shutdown_count) {
+void ThreadData::EnsureCleanupWasCalled(
+ int /* major_threads_shutdown_count */) {
base::AutoLock lock(*list_lock_.Pointer());
if (worker_thread_data_creation_count_ == 0)
return; // We haven't really run much, and couldn't have leaked.
diff --git a/base/values.cc b/base/values.cc
index 4534d27..c5e0ecc 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -92,47 +92,47 @@
return make_scoped_ptr(new Value(TYPE_NULL));
}
-bool Value::GetAsBinary(const BinaryValue** out_value) const {
+bool Value::GetAsBinary(const BinaryValue** /* out_value */) const {
return false;
}
-bool Value::GetAsBoolean(bool* out_value) const {
+bool Value::GetAsBoolean(bool* /* out_value */) const {
return false;
}
-bool Value::GetAsInteger(int* out_value) const {
+bool Value::GetAsInteger(int* /* out_value */) const {
return false;
}
-bool Value::GetAsDouble(double* out_value) const {
+bool Value::GetAsDouble(double* /* out_value */) const {
return false;
}
-bool Value::GetAsString(std::string* out_value) const {
+bool Value::GetAsString(std::string* /* out_value */) const {
return false;
}
-bool Value::GetAsString(string16* out_value) const {
+bool Value::GetAsString(string16* /* out_value */) const {
return false;
}
-bool Value::GetAsString(const StringValue** out_value) const {
+bool Value::GetAsString(const StringValue** /* out_value */) const {
return false;
}
-bool Value::GetAsList(ListValue** out_value) {
+bool Value::GetAsList(ListValue** /* out_value */) {
return false;
}
-bool Value::GetAsList(const ListValue** out_value) const {
+bool Value::GetAsList(const ListValue** /* out_value */) const {
return false;
}
-bool Value::GetAsDictionary(DictionaryValue** out_value) {
+bool Value::GetAsDictionary(DictionaryValue** /* out_value */) {
return false;
}
-bool Value::GetAsDictionary(const DictionaryValue** out_value) const {
+bool Value::GetAsDictionary(const DictionaryValue** /* out_value */) const {
return false;
}
diff --git a/components/timers/alarm_timer_chromeos.cc b/components/timers/alarm_timer_chromeos.cc
index 341818a..6c38b4c 100644
--- a/components/timers/alarm_timer_chromeos.cc
+++ b/components/timers/alarm_timer_chromeos.cc
@@ -250,7 +250,7 @@
}
}
-void AlarmTimer::Delegate::OnFileCanWriteWithoutBlocking(int fd) {
+void AlarmTimer::Delegate::OnFileCanWriteWithoutBlocking(int /* fd */) {
NOTREACHED();
}
diff --git a/dbus/bus.cc b/dbus/bus.cc
index 7bad549..9118846 100644
--- a/dbus/bus.cc
+++ b/dbus/bus.cc
@@ -83,13 +83,13 @@
private:
// Implement MessagePumpLibevent::Watcher.
- void OnFileCanReadWithoutBlocking(int file_descriptor) override {
+ void OnFileCanReadWithoutBlocking(int /* file_descriptor */) override {
const bool success = dbus_watch_handle(raw_watch_, DBUS_WATCH_READABLE);
CHECK(success) << "Unable to allocate memory";
}
// Implement MessagePumpLibevent::Watcher.
- void OnFileCanWriteWithoutBlocking(int file_descriptor) override {
+ void OnFileCanWriteWithoutBlocking(int /* file_descriptor */) override {
const bool success = dbus_watch_handle(raw_watch_, DBUS_WATCH_WRITABLE);
CHECK(success) << "Unable to allocate memory";
}
@@ -1100,7 +1100,7 @@
}
void Bus::OnDispatchStatusChanged(DBusConnection* connection,
- DBusDispatchStatus status) {
+ DBusDispatchStatus /* status */) {
DCHECK_EQ(connection, connection_);
AssertOnDBusThread();
@@ -1213,7 +1213,7 @@
// static
DBusHandlerResult Bus::OnServiceOwnerChangedFilter(
- DBusConnection* connection,
+ DBusConnection* /* connection */,
DBusMessage* message,
void* data) {
if (dbus_message_is_signal(message,
diff --git a/dbus/exported_object.cc b/dbus/exported_object.cc
index 669b871..4014ac2 100644
--- a/dbus/exported_object.cc
+++ b/dbus/exported_object.cc
@@ -184,7 +184,7 @@
}
DBusHandlerResult ExportedObject::HandleMessage(
- DBusConnection* connection,
+ DBusConnection* /* connection */,
DBusMessage* raw_message) {
bus_->AssertOnDBusThread();
DCHECK_EQ(DBUS_MESSAGE_TYPE_METHOD_CALL, dbus_message_get_type(raw_message));
@@ -300,7 +300,7 @@
base::TimeTicks::Now() - start_time);
}
-void ExportedObject::OnUnregistered(DBusConnection* connection) {
+void ExportedObject::OnUnregistered(DBusConnection* /* connection */) {
}
DBusHandlerResult ExportedObject::HandleMessageThunk(
diff --git a/dbus/object_manager.cc b/dbus/object_manager.cc
index 851fee4..cc99f62 100644
--- a/dbus/object_manager.cc
+++ b/dbus/object_manager.cc
@@ -247,7 +247,7 @@
return self->HandleMessage(connection, raw_message);
}
-DBusHandlerResult ObjectManager::HandleMessage(DBusConnection* connection,
+DBusHandlerResult ObjectManager::HandleMessage(DBusConnection* /* connection */,
DBusMessage* raw_message) {
DCHECK(bus_);
bus_->AssertOnDBusThread();
@@ -377,9 +377,10 @@
UpdateObject(object_path, &reader);
}
-void ObjectManager::InterfacesAddedConnected(const std::string& interface_name,
- const std::string& signal_name,
- bool success) {
+void ObjectManager::InterfacesAddedConnected(
+ const std::string& /* interface_name */,
+ const std::string& /* signal_name */,
+ bool success) {
LOG_IF(WARNING, !success) << service_name_ << " " << object_path_.value()
<< ": Failed to connect to InterfacesAdded signal.";
}
@@ -402,8 +403,8 @@
}
void ObjectManager::InterfacesRemovedConnected(
- const std::string& interface_name,
- const std::string& signal_name,
+ const std::string& /* interface_name */,
+ const std::string& /* signal_name */,
bool success) {
LOG_IF(WARNING, !success) << service_name_ << " " << object_path_.value()
<< ": Failed to connect to "
diff --git a/dbus/object_manager.h b/dbus/object_manager.h
index 23a88cd..456e183 100644
--- a/dbus/object_manager.h
+++ b/dbus/object_manager.h
@@ -163,8 +163,8 @@
// called on each interface implementation with differing values of
// |interface_name| as appropriate. An implementation class will only
// receive multiple calls if it has registered for multiple interfaces.
- virtual void ObjectAdded(const ObjectPath& object_path,
- const std::string& interface_name) { }
+ virtual void ObjectAdded(const ObjectPath& /* object_path */,
+ const std::string& /* interface_name */) { }
// Called by ObjectManager to inform the implementation class than an
// object with the path |object_path| has been removed. Ths D-Bus interface
@@ -175,8 +175,8 @@
// This method will be called before the Properties structure and the
// ObjectProxy object for the given interface are cleaned up, it is safe
// to retrieve them during removal to vary processing.
- virtual void ObjectRemoved(const ObjectPath& object_path,
- const std::string& interface_name) { }
+ virtual void ObjectRemoved(const ObjectPath& /* object_path */,
+ const std::string& /* interface_name */) { }
};
// Client code should use Bus::GetObjectManager() instead of this constructor.
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc
index 441dc75..b0ba9b7 100644
--- a/dbus/object_proxy.cc
+++ b/dbus/object_proxy.cc
@@ -453,7 +453,7 @@
}
DBusHandlerResult ObjectProxy::HandleMessage(
- DBusConnection* connection,
+ DBusConnection* /* connection */,
DBusMessage* raw_message) {
bus_->AssertOnDBusThread();
diff --git a/dbus/property.cc b/dbus/property.cc
index 234036c..bec8fae 100644
--- a/dbus/property.cc
+++ b/dbus/property.cc
@@ -88,7 +88,7 @@
}
}
-void PropertySet::ChangedConnected(const std::string& interface_name,
+void PropertySet::ChangedConnected(const std::string& /* interface_name */,
const std::string& signal_name,
bool success) {
LOG_IF(WARNING, !success) << "Failed to connect to " << signal_name