From a0cbe297e994410ce9acdae8f92d1b7592eb64b7 Mon Sep 17 00:00:00 2001 From: Hidehiko Abe Date: Mon, 19 Feb 2018 18:14:11 +0900 Subject: Remove ALLOW_UNUSED_PARAM macro. Now libchrome is built with -Wunused-parameter, so we no longer need the macro. Bug: 73270448 Test: Built locally. Treehugger. Change-Id: Ie02279df60b26f78019e28d383c50084695fb07a --- Android.bp | 2 -- base/allocator/allocator_shim.cc | 1 - base/allocator/allocator_shim_default_dispatch_to_glibc.cc | 8 -------- .../allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc | 8 -------- base/command_line.cc | 1 - base/compiler_specific.h | 3 --- base/debug/stack_trace.cc | 4 +--- base/debug/stack_trace_posix.cc | 3 --- base/memory/shared_memory_tracker.cc | 1 - base/metrics/histogram.cc | 2 -- base/process/memory_stubs.cc | 5 ----- base/threading/sequenced_worker_pool.cc | 5 ----- base/trace_event/trace_event_filter.cc | 6 +----- base/trace_event/trace_log.cc | 2 -- base/tracked_objects.cc | 1 - 15 files changed, 2 insertions(+), 50 deletions(-) diff --git a/Android.bp b/Android.bp index 202076beec..eaa5cc5849 100644 --- a/Android.bp +++ b/Android.bp @@ -65,7 +65,6 @@ cc_defaults { name: "libchrome-test-defaults", defaults: ["libchrome-defaults"], cflags: [ - "-Wno-unused-parameter", "-Wno-unused-function", "-Wno-unused-variable", "-Wno-missing-field-initializers", @@ -353,7 +352,6 @@ cc_library_shared { "crypto/sha2.cc", ], - cflags: ["-Wno-unused-parameter"], shared_libs: [ "libchrome", "libcrypto", diff --git a/base/allocator/allocator_shim.cc b/base/allocator/allocator_shim.cc index 4887142d25..f511b53088 100644 --- a/base/allocator/allocator_shim.cc +++ b/base/allocator/allocator_shim.cc @@ -58,7 +58,6 @@ bool CallNewHandler(size_t size) { #if defined(OS_WIN) return base::allocator::WinCallNewHandler(size); #else - ALLOW_UNUSED_PARAM(size); // TODO(primiano): C++11 has introduced ::get_new_handler() which is supposed // to be thread safe and would avoid the spinlock boilerplate here. However // it doesn't seem to be available yet in the Linux chroot headers yet. diff --git a/base/allocator/allocator_shim_default_dispatch_to_glibc.cc b/base/allocator/allocator_shim_default_dispatch_to_glibc.cc index 6f386d4cc0..8574da3eb3 100644 --- a/base/allocator/allocator_shim_default_dispatch_to_glibc.cc +++ b/base/allocator/allocator_shim_default_dispatch_to_glibc.cc @@ -6,8 +6,6 @@ #include -#include "base/compiler_specific.h" - // This translation unit defines a default dispatch for the allocator shim which // routes allocations to libc functions. // The code here is strongly inspired from tcmalloc's libc_override_glibc.h. @@ -25,7 +23,6 @@ namespace { using base::allocator::AllocatorDispatch; void* GlibcMalloc(const AllocatorDispatch*, size_t size, void* context) { - ALLOW_UNUSED_PARAM(context); return __libc_malloc(size); } @@ -33,7 +30,6 @@ void* GlibcCalloc(const AllocatorDispatch*, size_t n, size_t size, void* context) { - ALLOW_UNUSED_PARAM(context); return __libc_calloc(n, size); } @@ -41,7 +37,6 @@ void* GlibcRealloc(const AllocatorDispatch*, void* address, size_t size, void* context) { - ALLOW_UNUSED_PARAM(context); return __libc_realloc(address, size); } @@ -49,12 +44,10 @@ void* GlibcMemalign(const AllocatorDispatch*, size_t alignment, size_t size, void* context) { - ALLOW_UNUSED_PARAM(context); return __libc_memalign(alignment, size); } void GlibcFree(const AllocatorDispatch*, void* address, void* context) { - ALLOW_UNUSED_PARAM(context); __libc_free(address); } @@ -63,7 +56,6 @@ size_t GlibcGetSizeEstimate(const AllocatorDispatch*, void* context) { // TODO(siggi, primiano): malloc_usable_size may need redirection in the // presence of interposing shims that divert allocations. - ALLOW_UNUSED_PARAM(context); return malloc_usable_size(address); } diff --git a/base/allocator/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc b/base/allocator/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc index 3ad13ef98f..e33754a443 100644 --- a/base/allocator/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc +++ b/base/allocator/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc @@ -5,7 +5,6 @@ #include #include "base/allocator/allocator_shim.h" -#include "base/compiler_specific.h" #include "build/build_config.h" #if defined(OS_ANDROID) && __ANDROID_API__ < 17 @@ -34,7 +33,6 @@ namespace { using base::allocator::AllocatorDispatch; void* RealMalloc(const AllocatorDispatch*, size_t size, void* context) { - ALLOW_UNUSED_PARAM(context); return __real_malloc(size); } @@ -42,7 +40,6 @@ void* RealCalloc(const AllocatorDispatch*, size_t n, size_t size, void* context) { - ALLOW_UNUSED_PARAM(context); return __real_calloc(n, size); } @@ -50,7 +47,6 @@ void* RealRealloc(const AllocatorDispatch*, void* address, size_t size, void* context) { - ALLOW_UNUSED_PARAM(context); return __real_realloc(address, size); } @@ -58,12 +54,10 @@ void* RealMemalign(const AllocatorDispatch*, size_t alignment, size_t size, void* context) { - ALLOW_UNUSED_PARAM(context); return __real_memalign(alignment, size); } void RealFree(const AllocatorDispatch*, void* address, void* context) { - ALLOW_UNUSED_PARAM(context); __real_free(address); } @@ -74,8 +68,6 @@ size_t DummyMallocUsableSize(const void*) { return 0; } size_t RealSizeEstimate(const AllocatorDispatch*, void* address, void* context) { - ALLOW_UNUSED_PARAM(address); - ALLOW_UNUSED_PARAM(context); #if defined(OS_ANDROID) #if __ANDROID_API__ < 17 // malloc_usable_size() is available only starting from API 17. diff --git a/base/command_line.cc b/base/command_line.cc index 3033fcfc6e..b939201e5c 100644 --- a/base/command_line.cc +++ b/base/command_line.cc @@ -455,7 +455,6 @@ CommandLine::StringType CommandLine::GetCommandLineStringInternal( CommandLine::StringType CommandLine::GetArgumentsStringInternal( bool quote_placeholders) const { - ALLOW_UNUSED_PARAM(quote_placeholders); StringType params; // Append switches and arguments. bool parse_switches = true; diff --git a/base/compiler_specific.h b/base/compiler_specific.h index 358a5c9ca3..327e3fabc0 100644 --- a/base/compiler_specific.h +++ b/base/compiler_specific.h @@ -85,9 +85,6 @@ // ALLOW_UNUSED_LOCAL(x); #define ALLOW_UNUSED_LOCAL(x) false ? (void)x : (void)0 -// Used for Arc++ where -Wno-unused-parameter is used. -#define ALLOW_UNUSED_PARAM(x) false ? (void)x : (void)0 - // Annotate a typedef or function indicating it's ok if it's not used. // Use like: // typedef Foo Bar ALLOW_UNUSED_TYPE; diff --git a/base/debug/stack_trace.cc b/base/debug/stack_trace.cc index 08dcacfa30..43a23d95ac 100644 --- a/base/debug/stack_trace.cc +++ b/base/debug/stack_trace.cc @@ -126,10 +126,8 @@ uintptr_t ScanStackForNextFrame(uintptr_t fp, uintptr_t stack_end) { } } } -#else - ALLOW_UNUSED_PARAM(fp); - ALLOW_UNUSED_PARAM(stack_end); #endif // defined(OS_LINUX) + return 0; } diff --git a/base/debug/stack_trace_posix.cc b/base/debug/stack_trace_posix.cc index 78bc650c79..c134f494eb 100644 --- a/base/debug/stack_trace_posix.cc +++ b/base/debug/stack_trace_posix.cc @@ -79,7 +79,6 @@ const char kSymbolCharacters[] = void DemangleSymbols(std::string* text) { // Note: code in this function is NOT async-signal safe (std::string uses // malloc internally). - ALLOW_UNUSED_PARAM(text); #if defined(__GLIBCXX__) && !defined(__UCLIBC__) std::string::size_type search_from = 0; @@ -214,7 +213,6 @@ void PrintToStderr(const char* output) { } void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) { - ALLOW_UNUSED_PARAM(void_context); // unused depending on build context // NOTE: This code MUST be async-signal safe. // NO malloc or stdio is allowed here. @@ -730,7 +728,6 @@ StackTrace::StackTrace(size_t count) { // return values, we take no chance. count_ = base::saturated_cast(backtrace(trace_, count)); #else - ALLOW_UNUSED_PARAM(count); count_ = 0; #endif } diff --git a/base/memory/shared_memory_tracker.cc b/base/memory/shared_memory_tracker.cc index cfd4c85c53..8613f59533 100644 --- a/base/memory/shared_memory_tracker.cc +++ b/base/memory/shared_memory_tracker.cc @@ -48,7 +48,6 @@ void SharedMemoryTracker::DecrementMemoryUsage( bool SharedMemoryTracker::OnMemoryDump(const trace_event::MemoryDumpArgs& args, trace_event::ProcessMemoryDump* pmd) { - ALLOW_UNUSED_PARAM(args); std::unordered_map sizes; { diff --git a/base/metrics/histogram.cc b/base/metrics/histogram.cc index de2ac336d3..d455c87b0f 100644 --- a/base/metrics/histogram.cc +++ b/base/metrics/histogram.cc @@ -534,7 +534,6 @@ Histogram::~Histogram() { } bool Histogram::PrintEmptyBucket(uint32_t index) const { - ALLOW_UNUSED_PARAM(index); return true; } @@ -1139,7 +1138,6 @@ bool CustomHistogram::SerializeInfoImpl(Pickle* pickle) const { } double CustomHistogram::GetBucketSize(Count current, uint32_t i) const { - ALLOW_UNUSED_PARAM(i); // If this is a histogram of enum values, normalizing the bucket count // by the bucket range is not helpful, so just return the bucket count. return current; diff --git a/base/process/memory_stubs.cc b/base/process/memory_stubs.cc index 67deb4f58b..787d9aef21 100644 --- a/base/process/memory_stubs.cc +++ b/base/process/memory_stubs.cc @@ -7,8 +7,6 @@ #include #include -#include "base/compiler_specific.h" - namespace base { void EnableTerminationOnOutOfMemory() { @@ -18,13 +16,10 @@ void EnableTerminationOnHeapCorruption() { } bool AdjustOOMScore(ProcessId process, int score) { - ALLOW_UNUSED_PARAM(process); - ALLOW_UNUSED_PARAM(score); return false; } void TerminateBecauseOutOfMemory(size_t size) { - ALLOW_UNUSED_PARAM(size); abort(); } diff --git a/base/threading/sequenced_worker_pool.cc b/base/threading/sequenced_worker_pool.cc index 866a8b3b3b..ecf6e2c8e0 100644 --- a/base/threading/sequenced_worker_pool.cc +++ b/base/threading/sequenced_worker_pool.cc @@ -807,8 +807,6 @@ bool SequencedWorkerPool::Inner::PostTaskToTaskScheduler( const TimeDelta& delay) { #if 1 NOTREACHED(); - ALLOW_UNUSED_PARAM(sequenced); - ALLOW_UNUSED_PARAM(delay); return false; #else DCHECK_EQ(AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER, g_all_pools_state); @@ -849,8 +847,6 @@ SequencedWorkerPool::Inner::GetTaskSchedulerTaskRunner( const TaskTraits& traits) { #if 1 NOTREACHED(); - ALLOW_UNUSED_PARAM(sequence_token_id); - ALLOW_UNUSED_PARAM(traits); return scoped_refptr(); #else DCHECK_EQ(AllPoolsState::REDIRECTED_TO_TASK_SCHEDULER, g_all_pools_state); @@ -1479,7 +1475,6 @@ void SequencedWorkerPool::EnableWithRedirectionToTaskSchedulerForProcess( TaskPriority max_task_priority) { #if 1 NOTREACHED(); - ALLOW_UNUSED_PARAM(max_task_priority); #else // TODO(fdoray): Uncomment this line. It is initially commented to avoid a // revert of the CL that adds debug::DumpWithoutCrashing() in case of diff --git a/base/trace_event/trace_event_filter.cc b/base/trace_event/trace_event_filter.cc index d50c5fe251..6265295864 100644 --- a/base/trace_event/trace_event_filter.cc +++ b/base/trace_event/trace_event_filter.cc @@ -2,7 +2,6 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "base/compiler_specific.h" #include "base/trace_event/trace_event_filter.h" namespace base { @@ -12,10 +11,7 @@ TraceEventFilter::TraceEventFilter() {} TraceEventFilter::~TraceEventFilter() {} void TraceEventFilter::EndEvent(const char* category_name, - const char* event_name) const { - ALLOW_UNUSED_PARAM(category_name); - ALLOW_UNUSED_PARAM(event_name); -} + const char* event_name) const {} } // namespace trace_event } // namespace base diff --git a/base/trace_event/trace_log.cc b/base/trace_event/trace_log.cc index d798a9539b..dbdd4db06a 100644 --- a/base/trace_event/trace_log.cc +++ b/base/trace_event/trace_log.cc @@ -398,7 +398,6 @@ void TraceLog::InitializeThreadLocalEventBufferIfSupported() { bool TraceLog::OnMemoryDump(const MemoryDumpArgs& args, ProcessMemoryDump* pmd) { - ALLOW_UNUSED_PARAM(args); // TODO(ssid): Use MemoryDumpArgs to create light dumps when requested // (crbug.com/499731). TraceEventMemoryOverhead overhead; @@ -1406,7 +1405,6 @@ std::string TraceLog::EventToConsoleMessage(unsigned char phase, void TraceLog::EndFilteredEvent(const unsigned char* category_group_enabled, const char* name, TraceEventHandle handle) { - ALLOW_UNUSED_PARAM(handle); const char* category_name = GetCategoryGroupName(category_group_enabled); ForEachCategoryFilter( category_group_enabled, diff --git a/base/tracked_objects.cc b/base/tracked_objects.cc index 131af14a3a..1507c0986c 100644 --- a/base/tracked_objects.cc +++ b/base/tracked_objects.cc @@ -824,7 +824,6 @@ TrackedTime ThreadData::Now() { // static void ThreadData::EnsureCleanupWasCalled(int major_threads_shutdown_count) { - ALLOW_UNUSED_PARAM(major_threads_shutdown_count); base::AutoLock lock(*list_lock_.Pointer()); // TODO(jar): until this is working on XP, don't run the real test. -- cgit v1.2.3