summaryrefslogtreecommitdiff
path: root/base
diff options
context:
space:
mode:
authorChristopher Wiley <wiley@google.com>2015-12-17 12:31:17 -0800
committerGerrit Code Review <noreply-gerritcodereview@google.com>2015-12-29 14:57:47 +0000
commitb636ff6a8ac3b54b3067289f01848252ab71eceb (patch)
tree67ad0598f49fab615606e7e20d93081bf28cdb3b /base
parent69420b8b1f03c3a610b9d9291a3802799c18c99b (diff)
downloadlibchrome-b636ff6a8ac3b54b3067289f01848252ab71eceb.tar.gz
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
Diffstat (limited to 'base')
-rw-r--r--base/bind_helpers.h2
-rw-r--r--base/bind_unittest.cc5
-rw-r--r--base/command_line.cc4
-rw-r--r--base/debug/alias.cc2
-rw-r--r--base/debug/stack_trace_posix.cc24
-rw-r--r--base/files/file_path.cc4
-rw-r--r--base/files/file_util_posix.cc2
-rw-r--r--base/lazy_instance.h4
-rw-r--r--base/logging.cc5
-rw-r--r--base/memory/scoped_ptr.h2
-rw-r--r--base/message_loop/incoming_task_queue.cc9
-rw-r--r--base/message_loop/message_pump_libevent.cc5
-rw-r--r--base/metrics/histogram.cc5
-rw-r--r--base/metrics/histogram_base.cc2
-rw-r--r--base/metrics/histogram_samples.cc2
-rw-r--r--base/metrics/sparse_histogram.cc14
-rw-r--r--base/metrics/statistics_recorder.cc2
-rw-r--r--base/numerics/safe_conversions_impl.h2
-rw-r--r--base/numerics/safe_math_impl.h2
-rw-r--r--base/process/launch_posix.cc2
-rw-r--r--base/process/process_posix.cc2
-rw-r--r--base/strings/string_number_conversions.cc2
-rw-r--r--base/strings/utf_string_conversion_utils.cc2
-rw-r--r--base/sync_socket_posix.cc5
-rw-r--r--base/task/cancelable_task_tracker.cc2
-rw-r--r--base/third_party/nspr/prtime.cc4
-rw-r--r--base/threading/platform_thread_linux.cc6
-rw-r--r--base/threading/thread_local_storage.h2
-rw-r--r--base/threading/thread_restrictions.h6
-rw-r--r--base/threading/worker_pool_posix.cc3
-rw-r--r--base/time/pr_time_unittest.cc40
-rw-r--r--base/time/time_unittest.cc27
-rw-r--r--base/trace_event/trace_event.h2
-rw-r--r--base/trace_event/trace_event_impl.cc9
-rw-r--r--base/trace_event/trace_event_memory.cc2
-rw-r--r--base/tracked_objects.cc3
-rw-r--r--base/values.cc22
37 files changed, 132 insertions, 106 deletions
diff --git a/base/bind_helpers.h b/base/bind_helpers.h
index 4003dea74a..4068d37108 100644
--- a/base/bind_helpers.h
+++ b/base/bind_helpers.h
@@ -520,7 +520,7 @@ struct MaybeScopedRefPtr<false, T[n], Rest...> {
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 f885403c92..140b2c31e3 100644
--- a/base/bind_unittest.cc
+++ b/base/bind_unittest.cc
@@ -57,6 +57,7 @@ static const int kChildValue = 2;
class Parent {
public:
+ virtual ~Parent() = default;
void AddRef(void) const {}
void Release(void) const {}
virtual void VirtualSet() { value = kParentValue; }
@@ -66,18 +67,22 @@ class Parent {
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 3fcf22ac52..c6f3197091 100644
--- a/base/command_line.cc
+++ b/base/command_line.cc
@@ -145,7 +145,7 @@ string16 QuoteForCommandLineToArgvW(const string16& arg,
} // namespace
-CommandLine::CommandLine(NoProgram no_program)
+CommandLine::CommandLine(NoProgram /* no_program */)
: argv_(1),
begin_args_(1) {
}
@@ -434,7 +434,7 @@ CommandLine::StringType CommandLine::GetCommandLineStringInternal(
}
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 6b0caaa6d1..d49808491b 100644
--- a/base/debug/alias.cc
+++ b/base/debug/alias.cc
@@ -12,7 +12,7 @@ namespace debug {
#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 5e704dc0db..4506cbef6f 100644
--- a/base/debug/stack_trace_posix.cc
+++ b/base/debug/stack_trace_posix.cc
@@ -69,12 +69,10 @@ const char kSymbolCharacters[] =
// "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 @@ void DemangleSymbols(std::string* text) {
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 @@ class BacktraceOutputHandler {
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 @@ void OutputPointer(void* pointer, BacktraceOutputHandler* handler) {
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 @@ void OutputFrameId(intptr_t frame_id, BacktraceOutputHandler* handler) {
}
#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 @@ void ProcessBacktrace(void *const *trace,
}
#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 @@ void PrintToStderr(const char* output) {
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 de8927ac5b..b04a01df26 100644
--- a/base/files/file_path.cc
+++ b/base/files/file_path.cc
@@ -45,7 +45,7 @@ const FilePath::CharType kStringTerminator = FILE_PATH_LITERAL('\0');
// 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 @@ FilePath FilePath::NormalizePathSeparators() const {
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 af0cde4af9..62ca6a56e3 100644
--- a/base/files/file_util_posix.cc
+++ b/base/files/file_util_posix.cc
@@ -559,7 +559,7 @@ bool CreateTemporaryDirInDir(const FilePath& base_dir,
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 fb19379c8c..95f1308b4e 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 @@ struct LeakyLazyInstanceTraits {
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 1c86779526..4173885577 100644
--- a/base/logging.cc
+++ b/base/logging.cc
@@ -194,7 +194,8 @@ class LoggingLock {
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 @@ void LogMessage::Init(const char* file, int line) {
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 987ccfa804..69a98262c8 100644
--- a/base/memory/scoped_ptr.h
+++ b/base/memory/scoped_ptr.h
@@ -105,7 +105,7 @@ class RefCountedThreadSafeBase;
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 642222efc8..67a813f3bf 100644
--- a/base/message_loop/incoming_task_queue.cc
+++ b/base/message_loop/incoming_task_queue.cc
@@ -26,16 +26,17 @@ const int kTaskDelayWarningThresholdInSeconds =
// 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
+bool AlwaysNotifyPump(MessageLoop::Type /* type */) {
return false;
-#endif
}
+#endif
} // namespace
diff --git a/base/message_loop/message_pump_libevent.cc b/base/message_loop/message_pump_libevent.cc
index e022c8c989..cb703cee0e 100644
--- a/base/message_loop/message_pump_libevent.cc
+++ b/base/message_loop/message_pump_libevent.cc
@@ -218,7 +218,7 @@ void MessagePumpLibevent::RemoveIOObserver(IOObserver *obs) {
}
// 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 @@ void MessagePumpLibevent::OnLibeventNotification(int fd, short flags,
// 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 1a9c220199..6198cffbeb 100644
--- a/base/metrics/histogram.cc
+++ b/base/metrics/histogram.cc
@@ -313,7 +313,7 @@ Histogram::Histogram(const std::string& name,
Histogram::~Histogram() {
}
-bool Histogram::PrintEmptyBucket(size_t index) const {
+bool Histogram::PrintEmptyBucket(size_t /* index */) const {
return true;
}
@@ -775,7 +775,8 @@ bool CustomHistogram::SerializeInfoImpl(Pickle* pickle) const {
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 de34c79d4b..c4306fd9bb 100644
--- a/base/metrics/histogram_base.cc
+++ b/base/metrics/histogram_base.cc
@@ -92,7 +92,7 @@ bool HistogramBase::SerializeInfo(Pickle* pickle) const {
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 f5e03b979e..5a9ceab211 100644
--- a/base/metrics/histogram_samples.cc
+++ b/base/metrics/histogram_samples.cc
@@ -130,7 +130,7 @@ void HistogramSamples::IncreaseRedundantCount(HistogramBase::Count diff) {
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 e5cdb43c04..d5fd4a32be 100644
--- a/base/metrics/sparse_histogram.cc
+++ b/base/metrics/sparse_histogram.cc
@@ -38,9 +38,9 @@ HistogramType SparseHistogram::GetHistogramType() const {
}
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 @@ HistogramBase* SparseHistogram::DeserializeInfoImpl(PickleIterator* iter) {
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 a08730da55..fc952bfbe0 100644
--- a/base/metrics/statistics_recorder.cc
+++ b/base/metrics/statistics_recorder.cc
@@ -253,7 +253,7 @@ StatisticsRecorder::StatisticsRecorder() {
}
// 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 4157067160..3db045f568 100644
--- a/base/numerics/safe_conversions_impl.h
+++ b/base/numerics/safe_conversions_impl.h
@@ -135,7 +135,7 @@ struct DstRangeRelationToSrcRangeImpl<Dst,
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 08f2e88345..2ed64ae472 100644
--- a/base/numerics/safe_math_impl.h
+++ b/base/numerics/safe_math_impl.h
@@ -399,7 +399,7 @@ class CheckedNumericState<T, NUMERIC_FLOATING> {
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 574772715b..7f490c3919 100644
--- a/base/process/launch_posix.cc
+++ b/base/process/launch_posix.cc
@@ -152,7 +152,7 @@ int sys_rt_sigaction(int sig, const struct kernel_sigaction* act,
// 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 43e27cd4b4..03e762b3c7 100644
--- a/base/process/process_posix.cc
+++ b/base/process/process_posix.cc
@@ -293,7 +293,7 @@ void Process::Close() {
}
#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 025278268b..cd7481810c 100644
--- a/base/strings/string_number_conversions.cc
+++ b/base/strings/string_number_conversions.cc
@@ -50,7 +50,7 @@ struct IntToStringT {
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 022c0dffd8..1a3a1c30ea 100644
--- a/base/strings/utf_string_conversion_utils.cc
+++ b/base/strings/utf_string_conversion_utils.cc
@@ -55,7 +55,7 @@ bool ReadUnicodeCharacter(const char16* src,
#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 51b38a586d..47196f4b5a 100644
--- a/base/sync_socket_posix.cc
+++ b/base/sync_socket_posix.cc
@@ -103,8 +103,9 @@ SyncSocket::Handle SyncSocket::UnwrapHandle(
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 a2e4799f43..96aadc74c6 100644
--- a/base/task/cancelable_task_tracker.cc
+++ b/base/task/cancelable_task_tracker.cc
@@ -37,7 +37,7 @@ void RunIfNotCanceledThenUntrack(const CancellationFlag* flag,
}
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 9335b01de8..2e69b93a9e 100644
--- a/base/third_party/nspr/prtime.cc
+++ b/base/third_party/nspr/prtime.cc
@@ -160,7 +160,7 @@ PR_ImplodeTime(const PRExplodedTime *exploded)
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 @@ PR_NormalizeTime(PRExplodedTime *time, PRTimeParamFn params)
*/
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 9f7437418a..64a97279d9 100644
--- a/base/threading/platform_thread_linux.cc
+++ b/base/threading/platform_thread_linux.cc
@@ -37,7 +37,7 @@ const ThreadPriorityToNiceValuePair kThreadPriorityToNiceValueMap[4] = {
{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 @@ bool SetThreadPriorityForPlatform(PlatformThreadHandle handle,
#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 InitOnThread() {}
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 50f88685a5..8c48440f41 100644
--- a/base/threading/thread_local_storage.h
+++ b/base/threading/thread_local_storage.h
@@ -87,7 +87,7 @@ class BASE_EXPORT ThreadLocalStorage {
// 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 54f50ebca8..4ba70a9c94 100644
--- a/base/threading/thread_restrictions.h
+++ b/base/threading/thread_restrictions.h
@@ -160,9 +160,9 @@ class BASE_EXPORT ThreadRestrictions {
#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 @@ class BASE_EXPORT ThreadRestrictions {
#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 349b5d751c..1757f5e09b 100644
--- a/base/threading/worker_pool_posix.cc
+++ b/base/threading/worker_pool_posix.cc
@@ -49,7 +49,8 @@ WorkerPoolImpl::~WorkerPoolImpl() {
}
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 06043a5b8e..06f4d27af6 100644
--- a/base/time/pr_time_unittest.cc
+++ b/base/time/pr_time_unittest.cc
@@ -31,15 +31,16 @@ class PRTimeTest : public testing::Test {
// 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 @@ class PRTimeTest : public testing::Test {
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 @@ TEST_F(PRTimeTest, ParseTimeTest1) {
time(&current_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, &current_time);
diff --git a/base/time/time_unittest.cc b/base/time/time_unittest.cc
index b7e05b786b..8ea600269e 100644
--- a/base/time/time_unittest.cc
+++ b/base/time/time_unittest.cc
@@ -31,15 +31,16 @@ class TimeTest : public testing::Test {
// 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 @@ TEST_F(TimeTest, FromExplodedWithMilliseconds) {
// 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 @@ TEST_F(TimeTest, ParseTimeTest1) {
time(&current_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, &current_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 c41ca1e56b..95e88679f5 100644
--- a/base/trace_event/trace_event.h
+++ b/base/trace_event/trace_event.h
@@ -1232,7 +1232,7 @@ class TraceID {
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 0babcc3508..9d9165361a 100644
--- a/base/trace_event/trace_event_impl.cc
+++ b/base/trace_event/trace_event_impl.cc
@@ -238,17 +238,18 @@ class TraceBufferRingBuffer : public TraceBuffer {
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 @@ class TraceBufferRingBuffer : public TraceBuffer {
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 40e1d4a663..ece006554e 100644
--- a/base/trace_event/trace_event_memory.cc
+++ b/base/trace_event/trace_event_memory.cc
@@ -119,7 +119,7 @@ TraceMemoryStack* GetTraceMemoryStack() {
// 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 4534e6e58f..93bac6d872 100644
--- a/base/tracked_objects.cc
+++ b/base/tracked_objects.cc
@@ -776,7 +776,8 @@ TrackedTime ThreadData::Now() {
}
// 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 4534d27dff..c5e0ecc9f0 100644
--- a/base/values.cc
+++ b/base/values.cc
@@ -92,47 +92,47 @@ scoped_ptr<Value> Value::CreateNullValue() {
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;
}