From a1614feea3f3c0beb75fb2dc43ec45b3e5d57223 Mon Sep 17 00:00:00 2001 From: Igor Sugak Date: Wed, 27 Jan 2016 19:34:02 -0800 Subject: [PATCH] folly: build with -Wunused-parameter Summary: Mechanical changes (using custom clang-tidy) to fix all of the `-Wunused-parameter` violations in folly. Reviewed By: yfeldblum Differential Revision: D2872406 fb-gh-sync-id: bdb1941f3dadf6ab854e7a9f271f50fda93f9480 --- folly/ApplyTuple.h | 6 +- folly/Arena.h | 8 +- folly/AtomicHashArray.h | 11 +- folly/AtomicUnorderedMap.h | 2 +- folly/Benchmark.h | 3 +- folly/ConcurrentSkipList-inl.h | 2 +- folly/Conv.h | 31 ++- folly/DynamicConverter.h | 4 +- folly/FBString.h | 15 +- folly/Format-inl.h | 8 +- folly/Memory.h | 6 +- folly/SharedMutex.h | 4 +- folly/Singleton.h | 9 +- folly/ThreadCachedArena.h | 2 +- folly/ThreadName.h | 2 +- folly/detail/CacheLocality.cpp | 2 +- folly/detail/CacheLocality.h | 2 +- folly/detail/DiscriminatedPtrDetail.h | 4 +- folly/detail/FileUtilDetail.h | 2 +- folly/dynamic-inl.h | 4 +- folly/experimental/Instructions.h | 4 +- folly/experimental/NestedCommandLineApp.cpp | 2 +- folly/experimental/ProgramOptions.cpp | 8 +- folly/experimental/StringKeyedMap.h | 5 +- folly/experimental/StringKeyedUnorderedMap.h | 5 +- folly/experimental/StringKeyedUnorderedSet.h | 4 +- .../exception_tracer/ExceptionTracerTest.cpp | 2 +- .../fibers/GuardPageAllocator.cpp | 2 +- folly/experimental/fibers/WhenN-inl.h | 2 +- folly/experimental/fibers/test/FibersTest.cpp | 23 +- folly/experimental/io/AsyncIO.cpp | 4 +- .../experimental/symbolizer/SignalHandler.cpp | 2 +- .../symbolizer/test/StackTraceTest.cpp | 2 +- folly/experimental/test/CodingTestUtils.h | 6 +- .../test/NestedCommandLineAppTestHelper.cpp | 4 +- folly/experimental/test/TupleOpsTest.cpp | 2 +- folly/futures/Future-inl.h | 47 +++-- folly/futures/ScheduledExecutor.h | 2 +- folly/futures/detail/Core.h | 6 +- folly/futures/test/Benchmark.cpp | 10 +- folly/futures/test/CollectTest.cpp | 2 +- folly/futures/test/ExecutorTest.cpp | 4 +- folly/futures/test/FutureTest.cpp | 196 +++++++++++------- folly/futures/test/InterruptTest.cpp | 10 +- folly/futures/test/ReduceTest.cpp | 27 +-- folly/futures/test/ThenTest.cpp | 10 +- folly/futures/test/TimesTest.cpp | 23 +- folly/futures/test/ViaTest.cpp | 22 +- folly/futures/test/WhileDoTest.cpp | 17 +- folly/futures/test/WindowTest.cpp | 18 +- folly/gen/Base-inl.h | 16 +- folly/io/IOBuf.cpp | 15 +- folly/io/async/AsyncSSLSocket.cpp | 22 +- folly/io/async/AsyncServerSocket.cpp | 5 +- folly/io/async/AsyncSignalHandler.cpp | 5 +- folly/io/async/AsyncSocket.cpp | 4 +- folly/io/async/SSLContext.cpp | 13 +- folly/io/async/ScopedEventBaseThread.cpp | 4 +- folly/io/async/test/AsyncSSLSocketTest.h | 49 ++--- folly/io/async/test/AsyncSSLSocketTest2.cpp | 4 +- folly/io/async/test/AsyncSocketTest2.cpp | 142 +++++++------ folly/io/async/test/AsyncUDPSocketTest.cpp | 2 +- folly/io/async/test/BlockingSocket.h | 2 +- folly/io/async/test/EventBaseTest.cpp | 4 +- folly/io/async/test/EventHandlerTest.cpp | 124 +++++------ folly/io/async/test/NotificationQueueTest.cpp | 8 +- folly/test/AtomicHashArrayTest.cpp | 4 +- folly/test/AtomicHashMapTest.cpp | 2 +- folly/test/AtomicUnorderedMapTest.cpp | 22 +- folly/test/CacheLocalityTest.cpp | 2 +- folly/test/ConcurrentSkipListBenchmark.cpp | 6 +- folly/test/DeterministicSchedule.cpp | 6 +- folly/test/DeterministicSchedule.h | 19 +- folly/test/DiscriminatedPtrTest.cpp | 16 +- folly/test/ExceptionWrapperTest.cpp | 4 +- folly/test/FBStringTestBenchmarks.cpp.h | 8 +- folly/test/FBVectorBenchmark.cpp | 2 +- folly/test/FBVectorTest.cpp | 2 +- folly/test/FBVectorTestBenchmarks.cpp.h | 6 +- folly/test/FileUtilTest.cpp | 4 +- folly/test/MPMCQueueTest.cpp | 11 +- folly/test/ProducerConsumerQueueBenchmark.cpp | 2 +- folly/test/ProducerConsumerQueueTest.cpp | 2 +- folly/test/ThreadLocalTest.cpp | 17 +- folly/test/TimeoutQueueTest.cpp | 28 ++- folly/test/small_vector_test.cpp | 6 +- 86 files changed, 621 insertions(+), 565 deletions(-) diff --git a/folly/ApplyTuple.h b/folly/ApplyTuple.h index a592704f..1cc398a7 100644 --- a/folly/ApplyTuple.h +++ b/folly/ApplyTuple.h @@ -81,10 +81,10 @@ struct CallTuple { ); } - template + template static typename std::enable_if::value, - Ret - >::type call(const F& f, Tuple&& t, Unpacked&&... unp) { + Ret>::type + call(const F& f, Tuple&& /* t */, Unpacked&&... unp) { return makeCallable(f)(std::forward(unp)...); } }; diff --git a/folly/Arena.h b/folly/Arena.h index 530e0505..b9622a94 100644 --- a/folly/Arena.h +++ b/folly/Arena.h @@ -99,7 +99,7 @@ class Arena { return r; } - void deallocate(void* p) { + void deallocate(void* /* p */) { // Deallocate? Never! } @@ -215,14 +215,12 @@ struct IsArenaAllocator> : std::true_type { }; */ template struct ArenaAllocatorTraits { - static size_t goodSize(const Alloc& alloc, size_t size) { - return size; - } + static size_t goodSize(const Alloc& /* alloc */, size_t size) { return size; } }; template <> struct ArenaAllocatorTraits { - static size_t goodSize(const SysAlloc& alloc, size_t size) { + static size_t goodSize(const SysAlloc& /* alloc */, size_t size) { return goodMallocSize(size); } }; diff --git a/folly/AtomicHashArray.h b/folly/AtomicHashArray.h index 33c59247..433ce30c 100644 --- a/folly/AtomicHashArray.h +++ b/folly/AtomicHashArray.h @@ -44,7 +44,9 @@ namespace folly { struct AtomicHashArrayLinearProbeFcn { - inline size_t operator()(size_t idx, size_t numProbes, size_t capacity) const{ + inline size_t operator()(size_t idx, + size_t /* numProbes */, + size_t capacity) const { idx += 1; // linear probing // Avoid modulus because it's slow @@ -75,9 +77,10 @@ class AHAIdentity { }; template -inline void checkLegalKeyIfKeyTImpl(NotKeyT ignored, KeyT emptyKey, - KeyT lockedKey, KeyT erasedKey) { -} +inline void checkLegalKeyIfKeyTImpl(NotKeyT /* ignored */, + KeyT /* emptyKey */, + KeyT /* lockedKey */, + KeyT /* erasedKey */) {} template inline void checkLegalKeyIfKeyTImpl(KeyT key_in, KeyT emptyKey, diff --git a/folly/AtomicUnorderedMap.h b/folly/AtomicUnorderedMap.h index 9f139de0..df668cf5 100644 --- a/folly/AtomicUnorderedMap.h +++ b/folly/AtomicUnorderedMap.h @@ -178,7 +178,7 @@ struct AtomicUnorderedInsertMap { } // post-increment - ConstIterator operator++ (int dummy) { + ConstIterator operator++(int /* dummy */) { auto prev = *this; ++*this; return prev; diff --git a/folly/Benchmark.h b/folly/Benchmark.h index c25ca280..6db441b0 100644 --- a/folly/Benchmark.h +++ b/folly/Benchmark.h @@ -260,8 +260,7 @@ void doNotOptimizeAway(T&& datum) { #elif defined(__clang__) template -__attribute__((__optnone__)) void doNotOptimizeAway(T&& datum) { -} +__attribute__((__optnone__)) void doNotOptimizeAway(T&& /* datum */) {} #else diff --git a/folly/ConcurrentSkipList-inl.h b/folly/ConcurrentSkipList-inl.h index a875b69f..befa0c95 100644 --- a/folly/ConcurrentSkipList-inl.h +++ b/folly/ConcurrentSkipList-inl.h @@ -322,7 +322,7 @@ class NodeRecycler -inline size_t estimateSpaceNeeded(std::nullptr_t value) { +template <> +inline size_t estimateSpaceNeeded(std::nullptr_t /* value */) { return 0; } @@ -754,9 +754,8 @@ toAppendStrImpl(const T& v, const Ts&... vs) { template typename std::enable_if< - IsSomeString::type> - ::value>::type -toAppendDelimStrImpl(const Delimiter& delim, const T& v, Tgt result) { + IsSomeString::type>::value>::type +toAppendDelimStrImpl(const Delimiter& /* delim */, const T& v, Tgt result) { toAppend(v, result); } @@ -821,24 +820,22 @@ void toAppendFit(const Ts&) {} * Variadic base case: do nothing. */ template -typename std::enable_if::value>::type -toAppend(Tgt* result) { -} +typename std::enable_if::value>::type toAppend( + Tgt* /* result */) {} /** * Variadic base case: do nothing. */ template -typename std::enable_if::value>::type -toAppendDelim(const Delimiter& delim, Tgt* result) { -} +typename std::enable_if::value>::type toAppendDelim( + const Delimiter& /* delim */, Tgt* /* result */) {} /** * 1 element: same as toAppend. */ template -typename std::enable_if::value>::type -toAppendDelim(const Delimiter& delim, const T& v, Tgt* tgt) { +typename std::enable_if::value>::type toAppendDelim( + const Delimiter& /* delim */, const T& v, Tgt* tgt) { toAppend(v, tgt); } @@ -893,10 +890,10 @@ to(const Ts&... vs) { * toDelim(SomeString str) returns itself. */ template -typename std::enable_if< - IsSomeString::value && std::is_same::value, - Tgt>::type -toDelim(const Delim& delim, const Src & value) { +typename std::enable_if::value && + std::is_same::value, + Tgt>::type +toDelim(const Delim& /* delim */, const Src& value) { return value; } diff --git a/folly/DynamicConverter.h b/folly/DynamicConverter.h index 4c8b910c..fbbcbe9a 100644 --- a/folly/DynamicConverter.h +++ b/folly/DynamicConverter.h @@ -115,8 +115,8 @@ namespace dynamicconverter_detail { template struct Dereferencer { - static inline void - derefToCache(T* mem, const dynamic::const_item_iterator& it) { + static inline void derefToCache( + T* /* mem */, const dynamic::const_item_iterator& /* it */) { throw TypeError("array", dynamic::Type::OBJECT); } diff --git a/folly/FBString.h b/folly/FBString.h index 2acaaf79..2c8e5e19 100644 --- a/folly/FBString.h +++ b/folly/FBString.h @@ -1038,8 +1038,10 @@ public: } #endif - basic_fbstring(const basic_fbstring& str, size_type pos, - size_type n = npos, const A& a = A()) { + basic_fbstring(const basic_fbstring& str, + size_type pos, + size_type n = npos, + const A& /* a */ = A()) { assign(str, pos, n); } @@ -1682,9 +1684,12 @@ private: } private: - template - bool replaceAliased(iterator i1, iterator i2, - FwdIterator s1, FwdIterator s2, std::false_type) { + template + bool replaceAliased(iterator /* i1 */, + iterator /* i2 */, + FwdIterator /* s1 */, + FwdIterator /* s2 */, + std::false_type) { return false; } diff --git a/folly/Format-inl.h b/folly/Format-inl.h index ea9ce875..77df9e20 100644 --- a/folly/Format-inl.h +++ b/folly/Format-inl.h @@ -771,7 +771,9 @@ template class TryFormatValue { public: template - static void formatOrFail(T& value, FormatArg& arg, FormatCallback& cb) { + static void formatOrFail(T& /* value */, + FormatArg& arg, + FormatCallback& /* cb */) { arg.error("No formatter available for this type"); } }; @@ -1047,8 +1049,8 @@ class FormatValue> { static constexpr size_t valueCount = std::tuple_size::value; template - typename std::enable_if::type - doFormatFrom(size_t i, FormatArg& arg, Callback& cb) const { + typename std::enable_if::type doFormatFrom( + size_t i, FormatArg& arg, Callback& /* cb */) const { arg.enforce("tuple index out of range, max=", i); } diff --git a/folly/Memory.h b/folly/Memory.h index 374f1e0e..f2502219 100644 --- a/folly/Memory.h +++ b/folly/Memory.h @@ -202,13 +202,11 @@ class StlAllocator { template StlAllocator(const StlAllocator& other) : alloc_(other.alloc()) { } - T* allocate(size_t n, const void* hint = nullptr) { + T* allocate(size_t n, const void* /* hint */ = nullptr) { return static_cast(alloc_->allocate(n * sizeof(T))); } - void deallocate(T* p, size_t n) { - alloc_->deallocate(p); - } + void deallocate(T* p, size_t /* n */) { alloc_->deallocate(p); } size_t max_size() const { return std::numeric_limits::max(); diff --git a/folly/SharedMutex.h b/folly/SharedMutex.h index ebe8d794..a76959be 100644 --- a/folly/SharedMutex.h +++ b/folly/SharedMutex.h @@ -496,7 +496,9 @@ class SharedMutexImpl { bool canTimeOut() { return true; } bool shouldTimeOut() { return true; } - bool doWait(Futex& futex, uint32_t expected, uint32_t waitMask) { + bool doWait(Futex& /* futex */, + uint32_t /* expected */, + uint32_t /* waitMask */) { return false; } }; diff --git a/folly/Singleton.h b/folly/Singleton.h index 8f55a49a..174f3ca4 100644 --- a/folly/Singleton.h +++ b/folly/Singleton.h @@ -528,10 +528,9 @@ class Singleton { return getEntry().try_get_fast(); } - explicit Singleton(std::nullptr_t _ = nullptr, - typename Singleton::TeardownFunc t = nullptr) : - Singleton ([]() { return new T; }, std::move(t)) { - } + explicit Singleton(std::nullptr_t /* _ */ = nullptr, + typename Singleton::TeardownFunc t = nullptr) + : Singleton([]() { return new T; }, std::move(t)) {} explicit Singleton(typename Singleton::CreateFunc c, typename Singleton::TeardownFunc t = nullptr) { @@ -577,7 +576,7 @@ class Singleton { * the injection. The returned mock singleton is functionality identical to * regular singletons. */ - static void make_mock(std::nullptr_t c = nullptr, + static void make_mock(std::nullptr_t /* c */ = nullptr, typename Singleton::TeardownFunc t = nullptr) { make_mock([]() { return new T; }, t); } diff --git a/folly/ThreadCachedArena.h b/folly/ThreadCachedArena.h index e34a618d..24bc0599 100644 --- a/folly/ThreadCachedArena.h +++ b/folly/ThreadCachedArena.h @@ -52,7 +52,7 @@ class ThreadCachedArena { return arena->allocate(size); } - void deallocate(void* p) { + void deallocate(void* /* p */) { // Deallocate? Never! } diff --git a/folly/ThreadName.h b/folly/ThreadName.h index cd839594..2e028d7a 100644 --- a/folly/ThreadName.h +++ b/folly/ThreadName.h @@ -31,7 +31,7 @@ namespace folly { #endif template -inline bool setThreadName(T id, StringPiece name) { +inline bool setThreadName(T /* id */, StringPiece /* name */) { static_assert( std::is_same::value || std::is_same::value, diff --git a/folly/detail/CacheLocality.cpp b/folly/detail/CacheLocality.cpp index a6abec2a..f9e4609f 100644 --- a/folly/detail/CacheLocality.cpp +++ b/folly/detail/CacheLocality.cpp @@ -259,7 +259,7 @@ AccessSpreaderArray AccessSpreaderArray::sharedInstance = {}; /// Always claims to be on CPU zero, node zero -static int degenerateGetcpu(unsigned* cpu, unsigned* node, void* unused) { +static int degenerateGetcpu(unsigned* cpu, unsigned* node, void* /* unused */) { if (cpu != nullptr) { *cpu = 0; } diff --git a/folly/detail/CacheLocality.h b/folly/detail/CacheLocality.h index b6328887..9f0a8d3f 100644 --- a/folly/detail/CacheLocality.h +++ b/folly/detail/CacheLocality.h @@ -179,7 +179,7 @@ struct FallbackGetcpu { /// Fills the thread id into the cpu and node out params (if they /// are non-null). This method is intended to act like getcpu when a /// fast-enough form of getcpu isn't available or isn't desired - static int getcpu(unsigned* cpu, unsigned* node, void* unused) { + static int getcpu(unsigned* cpu, unsigned* node, void* /* unused */) { auto id = ThreadId::get(); if (cpu) { *cpu = id; diff --git a/folly/detail/DiscriminatedPtrDetail.h b/folly/detail/DiscriminatedPtrDetail.h index cb0b407c..d7215323 100644 --- a/folly/detail/DiscriminatedPtrDetail.h +++ b/folly/detail/DiscriminatedPtrDetail.h @@ -115,7 +115,7 @@ template struct ApplyVisitor1; template struct ApplyVisitor1 { - R operator()(size_t index, V&& visitor, void* ptr) const { + R operator()(size_t /* index */, V&& /* visitor */, void* /* ptr */) const { CHECK(false); // NOTREACHED } }; @@ -133,7 +133,7 @@ template struct ApplyConstVisitor1; template struct ApplyConstVisitor1 { - R operator()(size_t index, V&& visitor, void* ptr) const { + R operator()(size_t /* index */, V&& /* visitor */, void* /* ptr */) const { CHECK(false); // NOTREACHED } }; diff --git a/folly/detail/FileUtilDetail.h b/folly/detail/FileUtilDetail.h index 10e9819e..a5daee25 100644 --- a/folly/detail/FileUtilDetail.h +++ b/folly/detail/FileUtilDetail.h @@ -38,7 +38,7 @@ ssize_t wrapNoInt(F f, Args... args) { return r; } -inline void incr(ssize_t n) { } +inline void incr(ssize_t /* n */) {} inline void incr(ssize_t n, off_t& offset) { offset += n; } // Wrap call to read/pread/write/pwrite(fd, buf, count, offset?) to retry on diff --git a/folly/dynamic-inl.h b/folly/dynamic-inl.h index 73ab5d37..ddd8f690 100644 --- a/folly/dynamic-inl.h +++ b/folly/dynamic-inl.h @@ -731,7 +731,9 @@ struct dynamic::PrintImpl { // Otherwise, null, being (void*)0, would print as 0. template <> struct dynamic::PrintImpl { - static void print(dynamic const& d, std::ostream& out, void* const& nul) { + static void print(dynamic const& /* d */, + std::ostream& out, + void* const& nul) { DCHECK_EQ((void*)0, nul); out << "null"; } diff --git a/folly/experimental/Instructions.h b/folly/experimental/Instructions.h index cdcd5257..0211367b 100644 --- a/folly/experimental/Instructions.h +++ b/folly/experimental/Instructions.h @@ -30,9 +30,7 @@ namespace folly { namespace compression { namespace instructions { // use explicitly. struct Default { - static bool supported(const folly::CpuId& cpuId = {}) { - return true; - } + static bool supported(const folly::CpuId& /* cpuId */ = {}) { return true; } static inline uint64_t popcount(uint64_t value) { return __builtin_popcountll(value); } diff --git a/folly/experimental/NestedCommandLineApp.cpp b/folly/experimental/NestedCommandLineApp.cpp index c0499a6e..f1852572 100644 --- a/folly/experimental/NestedCommandLineApp.cpp +++ b/folly/experimental/NestedCommandLineApp.cpp @@ -96,7 +96,7 @@ void NestedCommandLineApp::addAlias(std::string newName, } void NestedCommandLineApp::displayHelp( - const po::variables_map& globalOptions, + const po::variables_map& /* globalOptions */, const std::vector& args) { if (args.empty()) { // General help diff --git a/folly/experimental/ProgramOptions.cpp b/folly/experimental/ProgramOptions.cpp index 8cf27137..0250eb68 100644 --- a/folly/experimental/ProgramOptions.cpp +++ b/folly/experimental/ProgramOptions.cpp @@ -87,7 +87,7 @@ class GFlagValueSemanticBase : public po::value_semantic { bool is_composing() const override { return false; } bool is_required() const override { return false; } // We handle setting the GFlags from parse(), so notify() does nothing. - void notify(const boost::any& valueStore) const override { } + void notify(const boost::any& /* valueStore */) const override {} bool apply_default(boost::any& valueStore) const override { // We're using the *current* rather than *default* value here, and // this is intentional; GFlags-using programs assign to FLAGS_foo @@ -101,11 +101,11 @@ class GFlagValueSemanticBase : public po::value_semantic { void parse(boost::any& valueStore, const std::vector& tokens, - bool utf8) const override; + bool /* utf8 */) const override; private: virtual T parseValue(const std::vector& tokens) const = 0; - virtual void transform(T& val) const { } + virtual void transform(T& /* val */) const {} mutable std::shared_ptr> info_; }; @@ -113,7 +113,7 @@ class GFlagValueSemanticBase : public po::value_semantic { template void GFlagValueSemanticBase::parse(boost::any& valueStore, const std::vector& tokens, - bool utf8) const { + bool /* utf8 */) const { T val; try { val = this->parseValue(tokens); diff --git a/folly/experimental/StringKeyedMap.h b/folly/experimental/StringKeyedMap.h index 5b33a727..ec1574df 100644 --- a/folly/experimental/StringKeyedMap.h +++ b/folly/experimental/StringKeyedMap.h @@ -97,9 +97,8 @@ public: : Base(std::move(other)) { } - StringKeyedMap(StringKeyedMap&& other, const allocator_type& a) noexcept - : Base(std::move(other)/*, a*/ /* not supported by gcc */) { - } + StringKeyedMap(StringKeyedMap&& other, const allocator_type& /* a */) noexcept + : Base(std::move(other) /*, a*/ /* not supported by gcc */) {} StringKeyedMap(std::initializer_list il, const key_compare& comp = key_compare(), diff --git a/folly/experimental/StringKeyedUnorderedMap.h b/folly/experimental/StringKeyedUnorderedMap.h index 28da8e96..846caa03 100644 --- a/folly/experimental/StringKeyedUnorderedMap.h +++ b/folly/experimental/StringKeyedUnorderedMap.h @@ -108,9 +108,8 @@ public: } StringKeyedUnorderedMap(StringKeyedUnorderedMap&& other, - const allocator_type& a) noexcept - : Base(std::move(other)/*, a*/ /* not supported by gcc */) { - } + const allocator_type& /* a */) noexcept + : Base(std::move(other) /*, a*/ /* not supported by gcc */) {} StringKeyedUnorderedMap(std::initializer_list il) : StringKeyedUnorderedMap(il.begin(), il.end()) { diff --git a/folly/experimental/StringKeyedUnorderedSet.h b/folly/experimental/StringKeyedUnorderedSet.h index c4f3a658..c0b5c45a 100644 --- a/folly/experimental/StringKeyedUnorderedSet.h +++ b/folly/experimental/StringKeyedUnorderedSet.h @@ -113,8 +113,8 @@ public: } BasicStringKeyedUnorderedSet(BasicStringKeyedUnorderedSet&& rhs, - const allocator_type& a) noexcept - : Base(std::move(rhs)/* , a */ /* not supported by gcc */) { + const allocator_type& /* a */) noexcept + : Base(std::move(rhs) /* , a */ /* not supported by gcc */) { assert(rhs.empty()); } diff --git a/folly/experimental/exception_tracer/ExceptionTracerTest.cpp b/folly/experimental/exception_tracer/ExceptionTracerTest.cpp index 58f10736..a9493773 100644 --- a/folly/experimental/exception_tracer/ExceptionTracerTest.cpp +++ b/folly/experimental/exception_tracer/ExceptionTracerTest.cpp @@ -89,7 +89,7 @@ void testExceptionPtr2() { } } -int main(int argc, char *argv[]) { +int main(int /* argc */, char* /* argv */ []) { foo(); testExceptionPtr1(); testExceptionPtr2(); diff --git a/folly/experimental/fibers/GuardPageAllocator.cpp b/folly/experimental/fibers/GuardPageAllocator.cpp index 858968e4..5595f14c 100644 --- a/folly/experimental/fibers/GuardPageAllocator.cpp +++ b/folly/experimental/fibers/GuardPageAllocator.cpp @@ -163,7 +163,7 @@ class CacheManager { friend class StackCacheEntry; - void giveBack(std::unique_ptr stackCache_) { + void giveBack(std::unique_ptr /* stackCache_ */) { assert(inUse_ > 0); --inUse_; /* Note: we can add a free list for each size bucket diff --git a/folly/experimental/fibers/WhenN-inl.h b/folly/experimental/fibers/WhenN-inl.h index dc1c67eb..9836ebf0 100644 --- a/folly/experimental/fibers/WhenN-inl.h +++ b/folly/experimental/fibers/WhenN-inl.h @@ -194,7 +194,7 @@ typename std::enable_if< typename std::iterator_traits::value_type()>::type, void >::value, void>::type inline collectAll(InputIterator first, InputIterator last) { - forEach(first, last, [] (size_t id) {}); + forEach(first, last, [](size_t /* id */) {}); } template diff --git a/folly/experimental/fibers/test/FibersTest.cpp b/folly/experimental/fibers/test/FibersTest.cpp index 641c8db8..c551076d 100644 --- a/folly/experimental/fibers/test/FibersTest.cpp +++ b/folly/experimental/fibers/test/FibersTest.cpp @@ -1366,17 +1366,18 @@ TEST(FiberManager, RequestContext) { folly::RequestContext::create(); auto rcontext3 = folly::RequestContext::get(); - fm.addTaskFinally([&]() { - EXPECT_EQ(rcontext3, folly::RequestContext::get()); - baton3.wait(); - EXPECT_EQ(rcontext3, folly::RequestContext::get()); - - return folly::Unit(); - }, - [&](Try&& t) { - EXPECT_EQ(rcontext3, folly::RequestContext::get()); - checkRun3 = true; - }); + fm.addTaskFinally( + [&]() { + EXPECT_EQ(rcontext3, folly::RequestContext::get()); + baton3.wait(); + EXPECT_EQ(rcontext3, folly::RequestContext::get()); + + return folly::Unit(); + }, + [&](Try&& /* t */) { + EXPECT_EQ(rcontext3, folly::RequestContext::get()); + checkRun3 = true; + }); folly::RequestContext::create(); auto rcontext = folly::RequestContext::get(); diff --git a/folly/experimental/io/AsyncIO.cpp b/folly/experimental/io/AsyncIO.cpp index 3e530468..b33c216a 100644 --- a/folly/experimental/io/AsyncIO.cpp +++ b/folly/experimental/io/AsyncIO.cpp @@ -277,9 +277,7 @@ void AsyncIOQueue::submit(OpFactory op) { maybeDequeue(); } -void AsyncIOQueue::onCompleted(AsyncIOOp* op) { - maybeDequeue(); -} +void AsyncIOQueue::onCompleted(AsyncIOOp* /* op */) { maybeDequeue(); } void AsyncIOQueue::maybeDequeue() { while (!queue_.empty() && asyncIO_->pending() < asyncIO_->capacity()) { diff --git a/folly/experimental/symbolizer/SignalHandler.cpp b/folly/experimental/symbolizer/SignalHandler.cpp index d3c81803..7719c5d4 100644 --- a/folly/experimental/symbolizer/SignalHandler.cpp +++ b/folly/experimental/symbolizer/SignalHandler.cpp @@ -422,7 +422,7 @@ std::atomic gSignalThread(kInvalidThreadId); std::atomic gInRecursiveSignalHandler(false); // Here be dragons. -void innerSignalHandler(int signum, siginfo_t* info, void* uctx) { +void innerSignalHandler(int signum, siginfo_t* info, void* /* uctx */) { // First, let's only let one thread in here at a time. pthread_t myId = pthread_self(); diff --git a/folly/experimental/symbolizer/test/StackTraceTest.cpp b/folly/experimental/symbolizer/test/StackTraceTest.cpp index d1d10a28..2130d82b 100644 --- a/folly/experimental/symbolizer/test/StackTraceTest.cpp +++ b/folly/experimental/symbolizer/test/StackTraceTest.cpp @@ -67,7 +67,7 @@ void foo2() { } volatile bool handled = false; -void handler(int num, siginfo_t* info, void* ctx) { +void handler(int /* num */, siginfo_t* /* info */, void* /* ctx */) { // Yes, getStackTrace and VLOG aren't async-signal-safe, but signals // raised with raise() aren't "async" signals. foo1(); diff --git a/folly/experimental/test/CodingTestUtils.h b/folly/experimental/test/CodingTestUtils.h index bb912c42..5c8146ca 100644 --- a/folly/experimental/test/CodingTestUtils.h +++ b/folly/experimental/test/CodingTestUtils.h @@ -302,8 +302,10 @@ void bmNext(const List& list, const std::vector& data, size_t iters) { } template -void bmSkip(const List& list, const std::vector& data, - size_t logAvgSkip, size_t iters) { +void bmSkip(const List& list, + const std::vector& /* data */, + size_t logAvgSkip, + size_t iters) { size_t avg = (size_t(1) << logAvgSkip); size_t base = avg - (avg >> 2); size_t mask = (avg > 1) ? (avg >> 1) - 1 : 0; diff --git a/folly/experimental/test/NestedCommandLineAppTestHelper.cpp b/folly/experimental/test/NestedCommandLineAppTestHelper.cpp index 08caecf2..9855ff9b 100644 --- a/folly/experimental/test/NestedCommandLineAppTestHelper.cpp +++ b/folly/experimental/test/NestedCommandLineAppTestHelper.cpp @@ -24,8 +24,8 @@ namespace po = ::boost::program_options; namespace { void init(const std::string& cmd, - const po::variables_map& options, - const std::vector& args) { + const po::variables_map& /* options */, + const std::vector& /* args */) { printf("running %s\n", cmd.c_str()); } diff --git a/folly/experimental/test/TupleOpsTest.cpp b/folly/experimental/test/TupleOpsTest.cpp index 7e044e49..3c0de661 100644 --- a/folly/experimental/test/TupleOpsTest.cpp +++ b/folly/experimental/test/TupleOpsTest.cpp @@ -80,7 +80,7 @@ template struct TupleTo; // Base case: empty typle -> empty tuple template <> struct TupleTo, std::tuple<>> { - static std::tuple<> convert(const std::tuple<>& input) { + static std::tuple<> convert(const std::tuple<>& /* input */) { return std::make_tuple(); } }; diff --git a/folly/futures/Future-inl.h b/folly/futures/Future-inl.h index fd2c7153..091357ee 100644 --- a/folly/futures/Future-inl.h +++ b/folly/futures/Future-inl.h @@ -604,7 +604,9 @@ namespace detail { template struct CollectContext { - struct Nothing { explicit Nothing(int n) {} }; + struct Nothing { + explicit Nothing(int /* n */) {} + }; using Result = typename std::conditional< std::is_void::value, @@ -861,26 +863,29 @@ Future unorderedReduce(It first, It last, T initial, F func) { auto ctx = std::make_shared( std::move(initial), std::move(func), std::distance(first, last)); - mapSetCallback(first, last, [ctx](size_t i, Try&& t) { - folly::MoveWrapper> mt(std::move(t)); - // Futures can be completed in any order, simultaneously. - // To make this non-blocking, we create a new Future chain in - // the order of completion to reduce the values. - // The spinlock just protects chaining a new Future, not actually - // executing the reduce, which should be really fast. - folly::MSLGuard lock(ctx->lock_); - ctx->memo_ = ctx->memo_.then([ctx, mt](T&& v) mutable { - // Either return a ItT&& or a Try&& depending - // on the type of the argument of func. - return ctx->func_(std::move(v), mt->template get()); - }); - if (++ctx->numThens_ == ctx->numFutures_) { - // After reducing the value of the last Future, fulfill the Promise - ctx->memo_.setCallback_([ctx](Try&& t2) { - ctx->promise_.setValue(std::move(t2)); + mapSetCallback( + first, + last, + [ctx](size_t /* i */, Try&& t) { + folly::MoveWrapper> mt(std::move(t)); + // Futures can be completed in any order, simultaneously. + // To make this non-blocking, we create a new Future chain in + // the order of completion to reduce the values. + // The spinlock just protects chaining a new Future, not actually + // executing the reduce, which should be really fast. + folly::MSLGuard lock(ctx->lock_); + ctx->memo_ = ctx->memo_.then([ctx, mt](T&& v) mutable { + // Either return a ItT&& or a Try&& depending + // on the type of the argument of func. + return ctx->func_(std::move(v), + mt->template get()); + }); + if (++ctx->numThens_ == ctx->numFutures_) { + // After reducing the value of the last Future, fulfill the Promise + ctx->memo_.setCallback_( + [ctx](Try&& t2) { ctx->promise_.setValue(std::move(t2)); }); + } }); - } - }); return ctx->promise_.getFuture(); } @@ -953,7 +958,7 @@ void waitImpl(Future& f) { if (f.isReady()) return; FutureBatonType baton; - f.setCallback_([&](const Try& t) { baton.post(); }); + f.setCallback_([&](const Try& /* t */) { baton.post(); }); baton.wait(); assert(f.isReady()); } diff --git a/folly/futures/ScheduledExecutor.h b/folly/futures/ScheduledExecutor.h index 945e40f3..f53a1522 100644 --- a/folly/futures/ScheduledExecutor.h +++ b/folly/futures/ScheduledExecutor.h @@ -45,7 +45,7 @@ namespace folly { /// Schedule a Func to be executed at time t, or as soon afterward as /// possible. Expect millisecond resolution at best. Must be threadsafe. - virtual void scheduleAt(Func&& a, TimePoint const& t) { + virtual void scheduleAt(Func&& /* a */, TimePoint const& /* t */) { throw std::logic_error("unimplemented"); } diff --git a/folly/futures/detail/Core.h b/folly/futures/detail/Core.h index 773da5e0..05cde937 100644 --- a/folly/futures/detail/Core.h +++ b/folly/futures/detail/Core.h @@ -437,14 +437,14 @@ struct CollectVariadicContext { std::move(*std::get(o))); } - static std::tuple unwrap(std::tuple...>&& o, + static std::tuple unwrap(std::tuple...>&& /* o */, Ts&&... ts) { return std::tuple(std::forward(ts)...); } }; -template