folly: build with -Wunused-parameter
authorIgor Sugak <sugak@fb.com>
Thu, 28 Jan 2016 03:34:02 +0000 (19:34 -0800)
committerfacebook-github-bot-0 <folly-bot@fb.com>
Thu, 28 Jan 2016 04:20:30 +0000 (20:20 -0800)
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

86 files changed:
folly/ApplyTuple.h
folly/Arena.h
folly/AtomicHashArray.h
folly/AtomicUnorderedMap.h
folly/Benchmark.h
folly/ConcurrentSkipList-inl.h
folly/Conv.h
folly/DynamicConverter.h
folly/FBString.h
folly/Format-inl.h
folly/Memory.h
folly/SharedMutex.h
folly/Singleton.h
folly/ThreadCachedArena.h
folly/ThreadName.h
folly/detail/CacheLocality.cpp
folly/detail/CacheLocality.h
folly/detail/DiscriminatedPtrDetail.h
folly/detail/FileUtilDetail.h
folly/dynamic-inl.h
folly/experimental/Instructions.h
folly/experimental/NestedCommandLineApp.cpp
folly/experimental/ProgramOptions.cpp
folly/experimental/StringKeyedMap.h
folly/experimental/StringKeyedUnorderedMap.h
folly/experimental/StringKeyedUnorderedSet.h
folly/experimental/exception_tracer/ExceptionTracerTest.cpp
folly/experimental/fibers/GuardPageAllocator.cpp
folly/experimental/fibers/WhenN-inl.h
folly/experimental/fibers/test/FibersTest.cpp
folly/experimental/io/AsyncIO.cpp
folly/experimental/symbolizer/SignalHandler.cpp
folly/experimental/symbolizer/test/StackTraceTest.cpp
folly/experimental/test/CodingTestUtils.h
folly/experimental/test/NestedCommandLineAppTestHelper.cpp
folly/experimental/test/TupleOpsTest.cpp
folly/futures/Future-inl.h
folly/futures/ScheduledExecutor.h
folly/futures/detail/Core.h
folly/futures/test/Benchmark.cpp
folly/futures/test/CollectTest.cpp
folly/futures/test/ExecutorTest.cpp
folly/futures/test/FutureTest.cpp
folly/futures/test/InterruptTest.cpp
folly/futures/test/ReduceTest.cpp
folly/futures/test/ThenTest.cpp
folly/futures/test/TimesTest.cpp
folly/futures/test/ViaTest.cpp
folly/futures/test/WhileDoTest.cpp
folly/futures/test/WindowTest.cpp
folly/gen/Base-inl.h
folly/io/IOBuf.cpp
folly/io/async/AsyncSSLSocket.cpp
folly/io/async/AsyncServerSocket.cpp
folly/io/async/AsyncSignalHandler.cpp
folly/io/async/AsyncSocket.cpp
folly/io/async/SSLContext.cpp
folly/io/async/ScopedEventBaseThread.cpp
folly/io/async/test/AsyncSSLSocketTest.h
folly/io/async/test/AsyncSSLSocketTest2.cpp
folly/io/async/test/AsyncSocketTest2.cpp
folly/io/async/test/AsyncUDPSocketTest.cpp
folly/io/async/test/BlockingSocket.h
folly/io/async/test/EventBaseTest.cpp
folly/io/async/test/EventHandlerTest.cpp
folly/io/async/test/NotificationQueueTest.cpp
folly/test/AtomicHashArrayTest.cpp
folly/test/AtomicHashMapTest.cpp
folly/test/AtomicUnorderedMapTest.cpp
folly/test/CacheLocalityTest.cpp
folly/test/ConcurrentSkipListBenchmark.cpp
folly/test/DeterministicSchedule.cpp
folly/test/DeterministicSchedule.h
folly/test/DiscriminatedPtrTest.cpp
folly/test/ExceptionWrapperTest.cpp
folly/test/FBStringTestBenchmarks.cpp.h
folly/test/FBVectorBenchmark.cpp
folly/test/FBVectorTest.cpp
folly/test/FBVectorTestBenchmarks.cpp.h
folly/test/FileUtilTest.cpp
folly/test/MPMCQueueTest.cpp
folly/test/ProducerConsumerQueueBenchmark.cpp
folly/test/ProducerConsumerQueueTest.cpp
folly/test/ThreadLocalTest.cpp
folly/test/TimeoutQueueTest.cpp
folly/test/small_vector_test.cpp

index a592704f080883a3a48433984e8fcb15e37d8d41..1cc398a74b950abe008c21a6bff4cb6e149cdcc9 100644 (file)
@@ -81,10 +81,10 @@ struct CallTuple {
     );
   }
 
-  template<class F, class Tuple, class ...Unpacked>
+  template <class F, class Tuple, class... Unpacked>
   static typename std::enable_if<ExprIsUnpacked<Tuple, Unpacked...>::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<Unpacked>(unp)...);
   }
 };
index 530e0505ed4933df75fd07367acbe021c6ce9490..b9622a945a23fa4c953866fad9874ee11a485f40 100644 (file)
@@ -99,7 +99,7 @@ class Arena {
     return r;
   }
 
-  void deallocate(void* p) {
+  void deallocate(void* /* p */) {
     // Deallocate? Never!
   }
 
@@ -215,14 +215,12 @@ struct IsArenaAllocator<Arena<Alloc>> : std::true_type { };
  */
 template <class Alloc>
 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<SysAlloc> {
-  static size_t goodSize(const SysAlloc& alloc, size_t size) {
+  static size_t goodSize(const SysAlloc& /* alloc */, size_t size) {
     return goodMallocSize(size);
   }
 };
index 33c59247e38e5bc7e3a80b6b3499a7cbc08a0641..433ce30c56a611d771e313964ab4befa12951474 100644 (file)
@@ -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 <typename NotKeyT, typename KeyT>
-inline void checkLegalKeyIfKeyTImpl(NotKeyT ignored, KeyT emptyKey,
-                                    KeyT lockedKey, KeyT erasedKey) {
-}
+inline void checkLegalKeyIfKeyTImpl(NotKeyT /* ignored */,
+                                    KeyT /* emptyKey */,
+                                    KeyT /* lockedKey */,
+                                    KeyT /* erasedKey */) {}
 
 template <typename KeyT>
 inline void checkLegalKeyIfKeyTImpl(KeyT key_in, KeyT emptyKey,
index 9f139de0b1c07adf8d4b0570748b0510e8991420..df668cf5b98f7c1e4816e32ff9ea96664bb2c136 100644 (file)
@@ -178,7 +178,7 @@ struct AtomicUnorderedInsertMap {
     }
 
     // post-increment
-    ConstIterator operator++ (int dummy) {
+    ConstIterator operator++(int /* dummy */) {
       auto prev = *this;
       ++*this;
       return prev;
index c25ca2800f2907b62da7250553036b9881bb2c8c..6db441b097cca4c87cb760298b736e3c82e1ea48 100644 (file)
@@ -260,8 +260,7 @@ void doNotOptimizeAway(T&& datum) {
 #elif defined(__clang__)
 
 template <class T>
-__attribute__((__optnone__)) void doNotOptimizeAway(T&& datum) {
-}
+__attribute__((__optnone__)) void doNotOptimizeAway(T&& /* datum */) {}
 
 #else
 
index a875b69faecde2b22e35d38bbefe63371ecfa58b..befa0c9524ac230e216549d9ccf008ca49c29b86 100644 (file)
@@ -322,7 +322,7 @@ class NodeRecycler<NodeType, NodeAlloc, typename std::enable_if<
   void addRef() { }
   void releaseRef() { }
 
-  void add(NodeType* node) { }
+  void add(NodeType* /* node */) {}
 
   NodeAlloc& alloc() { return alloc_; }
 
index b91c4e60d6b39a70eacd5951ddd1089e2fc13f0d..e602f6ca7a3dcca31b62a120a51a14675d3840e4 100644 (file)
@@ -388,8 +388,8 @@ estimateSpaceNeeded(Src value) {
   return folly::StringPiece(value).size();
 }
 
-template<>
-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 <class Delimiter, class T, class Tgt>
 typename std::enable_if<
-  IsSomeString<typename std::remove_pointer<Tgt>::type>
-  ::value>::type
-toAppendDelimStrImpl(const Delimiter& delim, const T& v, Tgt result) {
+    IsSomeString<typename std::remove_pointer<Tgt>::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 <class Tgt>
-typename std::enable_if<IsSomeString<Tgt>::value>::type
-toAppend(Tgt* result) {
-}
+typename std::enable_if<IsSomeString<Tgt>::value>::type toAppend(
+    Tgt* /* result */) {}
 
 /**
  * Variadic base case: do nothing.
  */
 template <class Delimiter, class Tgt>
-typename std::enable_if<IsSomeString<Tgt>::value>::type
-toAppendDelim(const Delimiter& delim, Tgt* result) {
-}
+typename std::enable_if<IsSomeString<Tgt>::value>::type toAppendDelim(
+    const Delimiter& /* delim */, Tgt* /* result */) {}
 
 /**
  * 1 element: same as toAppend.
  */
 template <class Delimiter, class T, class Tgt>
-typename std::enable_if<IsSomeString<Tgt>::value>::type
-toAppendDelim(const Delimiter& delim, const T& v, Tgt* tgt) {
+typename std::enable_if<IsSomeString<Tgt>::value>::type toAppendDelim(
+    const Delimiter& /* delim */, const T& v, Tgt* tgt) {
   toAppend(v, tgt);
 }
 
@@ -893,10 +890,10 @@ to(const Ts&... vs) {
  * toDelim<SomeString>(SomeString str) returns itself.
  */
 template <class Tgt, class Delim, class Src>
-typename std::enable_if<
-  IsSomeString<Tgt>::value && std::is_same<Tgt, Src>::value,
-  Tgt>::type
-toDelim(const Delim& delim, const Src & value) {
+typename std::enable_if<IsSomeString<Tgt>::value &&
+                            std::is_same<Tgt, Src>::value,
+                        Tgt>::type
+toDelim(const Delim& /* delim */, const Src& value) {
   return value;
 }
 
index 4c8b910cc466a3af4d03ccb40e455391c2ae1250..fbbcbe9a058f75b64d7dc9fd418ede82c947d558 100644 (file)
@@ -115,8 +115,8 @@ namespace dynamicconverter_detail {
 
 template<typename T>
 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);
   }
 
index 2acaaf79bf5b924e5ec28958e8eec33459e14bb1..2c8e5e19544eede93c55eb5c7ae6fea1f7f02e98 100644 (file)
@@ -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 <class FwdIterator>
-  bool replaceAliased(iterator i1, iterator i2,
-                      FwdIterator s1, FwdIterator s2, std::false_type) {
+ template <class FwdIterator>
+ bool replaceAliased(iterator /* i1 */,
+                     iterator /* i2 */,
+                     FwdIterator /* s1 */,
+                     FwdIterator /* s2 */,
+                     std::false_type) {
     return false;
   }
 
index ea9ce8752f06b7d8938ddd156a9e5310571fa386..77df9e20640102f4734e45f31815fd5c60e9d6c4 100644 (file)
@@ -771,7 +771,9 @@ template <class T, class = void>
 class TryFormatValue {
  public:
   template <class FormatCallback>
-  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<std::tuple<Args...>> {
   static constexpr size_t valueCount = std::tuple_size<Tuple>::value;
 
   template <size_t K, class Callback>
-  typename std::enable_if<K == valueCount>::type
-  doFormatFrom(size_t i, FormatArg& arg, Callback& cb) const {
+  typename std::enable_if<K == valueCount>::type doFormatFrom(
+      size_t i, FormatArg& arg, Callback& /* cb */) const {
     arg.enforce("tuple index out of range, max=", i);
   }
 
index 374f1e0ec377a532c4b3c699c2c476567260f95e..f2502219aef0c1332185ea952a0fd3bfb265e9ca 100644 (file)
@@ -202,13 +202,11 @@ class StlAllocator {
   template <class U> StlAllocator(const StlAllocator<Alloc, U>& 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<T*>(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<size_t>::max();
index ebe8d794c385b4ead4cae7e99835f3aea6e96bbb..a76959bee0ca5c508a4ed8c7297effeecfad59aa 100644 (file)
@@ -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;
     }
   };
index 8f55a49a56153cc9d9bff78ca389641ae32acf4e..174f3ca4fed3401508bee89077f890852c8fddcd 100644 (file)
@@ -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<T>::TeardownFunc t = nullptr) {
     make_mock([]() { return new T; }, t);
   }
index e34a618dfa4b41f86cf5ecfe99de26f86e3587ff..24bc0599f8ce12267d6fcc6b5c1789e75ba30f80 100644 (file)
@@ -52,7 +52,7 @@ class ThreadCachedArena {
     return arena->allocate(size);
   }
 
-  void deallocate(void* p) {
+  void deallocate(void* /* p */) {
     // Deallocate? Never!
   }
 
index cd839594bf0f09d7c5fd45c2f09a23358358c377..2e028d7aa43443c98eb30ba2bf7bcf9b8ef0b5c4 100644 (file)
@@ -31,7 +31,7 @@ namespace folly {
 #endif
 
 template <typename T>
-inline bool setThreadName(T id, StringPiece name) {
+inline bool setThreadName(T /* id */, StringPiece /* name */) {
   static_assert(
       std::is_same<T, pthread_t>::value ||
       std::is_same<T, std::thread::native_handle_type>::value,
index a6abec2ae1aabb6f454e601b34e22b1d1050dccc..f9e4609f5877afc87aed3c9894b9f8766bb1ddb7 100644 (file)
@@ -259,7 +259,7 @@ AccessSpreaderArray<std::atomic,128>
 AccessSpreaderArray<std::atomic,128>::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;
   }
index b632888725ab1770ba4e2bc5978eb97ed2812622..9f0a8d3f796695561737b091b2211c946698bfbf 100644 (file)
@@ -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;
index cb0b407c167be43cae23753a559f2a1416ed708f..d7215323b526e6604a09011330d9bed63c3d71f5 100644 (file)
@@ -115,7 +115,7 @@ template <typename V, typename R, typename... Types> struct ApplyVisitor1;
 
 template <typename V, typename R>
 struct ApplyVisitor1<V, R> {
-  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 <typename V, typename R, typename... Types> struct ApplyConstVisitor1;
 
 template <typename V, typename R>
 struct ApplyConstVisitor1<V, R> {
-  R operator()(size_t index, V&& visitor, void* ptr) const {
+  R operator()(size_t /* index */, V&& /* visitor */, void* /* ptr */) const {
     CHECK(false);  // NOTREACHED
   }
 };
index 10e9819ef356ae3fc5136bf8d09ea13f54598296..a5daee25efe5b3eab8cb052bd33a6e222901e647 100644 (file)
@@ -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
index 73ab5d37184e535c9b0e7e60b41b0d3508420c12..ddd8f690728706b1d07101c61a961dcf8fc2f2bb 100644 (file)
@@ -731,7 +731,9 @@ struct dynamic::PrintImpl {
 // Otherwise, null, being (void*)0, would print as 0.
 template <>
 struct dynamic::PrintImpl<void*> {
-  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";
   }
index cdcd525777a34cef04883be9747d657ce5362935..0211367bfb27fefdd595c51a0db55d04fb65016f 100644 (file)
@@ -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);
   }
index c0499a6e6ce08f4bef623539d27c00f3c0a6d006..f185257248d97a5cdfffcde9e7cd658b9bd72953 100644 (file)
@@ -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<std::string>& args) {
   if (args.empty()) {
     // General help
index 8cf27137e7ba99f024254289f78c0989e335b961..0250eb68a348036d8659bb848e84123f6133c9bc 100644 (file)
@@ -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<std::string>& tokens,
-             bool utf8) const override;
+             bool /* utf8 */) const override;
 
  private:
   virtual T parseValue(const std::vector<std::string>& tokens) const = 0;
-  virtual void transform(T& val) const { }
+  virtual void transform(T& /* val */) const {}
 
   mutable std::shared_ptr<GFlagInfo<T>> info_;
 };
@@ -113,7 +113,7 @@ class GFlagValueSemanticBase : public po::value_semantic {
 template <class T>
 void GFlagValueSemanticBase<T>::parse(boost::any& valueStore,
                                       const std::vector<std::string>& tokens,
-                                      bool utf8) const {
+                                      bool /* utf8 */) const {
   T val;
   try {
     val = this->parseValue(tokens);
index 5b33a727c06fa054d85313929d9e60d4ad3d2bab..ec1574df10a90d9c63eb3c105d7514f4255d680f 100644 (file)
@@ -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<value_type> il,
      const key_compare& comp = key_compare(),
index 28da8e96b21664609d8c97e4b527bda5973ab6a3..846caa03da7e63d3576f09724e0c1e01a34fdadd 100644 (file)
@@ -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<value_type> il)
       : StringKeyedUnorderedMap(il.begin(), il.end()) {
index c4f3a65822452d8ba36bf324f2a739cdfcf069d3..c0b5c45a222805ab99c94323fa5ffce189dfde23 100644 (file)
@@ -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());
   }
 
index 58f10736f245e3f7569007236c51fed05e5a82b0..a949377388a6cca66ccd9f145e67e3f6f96bb2bb 100644 (file)
@@ -89,7 +89,7 @@ void testExceptionPtr2() {
   }
 }
 
-int main(int argc, char *argv[]) {
+int main(int /* argc */, char* /* argv */ []) {
   foo();
   testExceptionPtr1();
   testExceptionPtr2();
index 858968e47731d741315a90b2e06c9ad4984d5d1a..5595f14c21fd23046ccf1b8df98a8b73880057d8 100644 (file)
@@ -163,7 +163,7 @@ class CacheManager {
 
   friend class StackCacheEntry;
 
-  void giveBack(std::unique_ptr<StackCache> stackCache_) {
+  void giveBack(std::unique_ptr<StackCache> /* stackCache_ */) {
     assert(inUse_ > 0);
     --inUse_;
     /* Note: we can add a free list for each size bucket
index dc1c67eb9e82dd3dc03c91f86bd607fcbc872199..9836ebf0bb3f62db3bea60f86bbf3d79e8c85d63 100644 (file)
@@ -194,7 +194,7 @@ typename std::enable_if<
       typename std::iterator_traits<InputIterator>::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 <class InputIterator>
index 641c8db8111842d235b28eb74fe2c68173563c3d..c551076d519e42612aa451539b7992777a780004 100644 (file)
@@ -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<folly::Unit>&& 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<folly::Unit>&& /* t */) {
+        EXPECT_EQ(rcontext3, folly::RequestContext::get());
+        checkRun3 = true;
+      });
 
   folly::RequestContext::create();
   auto rcontext = folly::RequestContext::get();
index 3e530468672186d05cfc6760dc6d7c0a219bed02..b33c216a1a662c4a7bab91371fcb80e5a2640987 100644 (file)
@@ -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()) {
index d3c818035555a9f6998b6f1880b6537617ae68ef..7719c5d4640a24f85b06dfddedd5040ff4f45f0b 100644 (file)
@@ -422,7 +422,7 @@ std::atomic<pthread_t> gSignalThread(kInvalidThreadId);
 std::atomic<bool> 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();
 
index d1d10a280bc1f70e5e308feb508ca45b1b300036..2130d82b86688e1459d3a11b76f57085e81e9204 100644 (file)
@@ -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();
index bb912c429a9f5c0301ebfad006f332706eb1c622..5c8146ca0843ad981892848669a7c6753412218b 100644 (file)
@@ -302,8 +302,10 @@ void bmNext(const List& list, const std::vector<uint32_t>& data, size_t iters) {
 }
 
 template <class Reader, class List>
-void bmSkip(const List& list, const std::vector<uint32_t>& data,
-            size_t logAvgSkip, size_t iters) {
+void bmSkip(const List& list,
+            const std::vector<uint32_t>& /* 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;
index 08caecf2421de9c10ba40fcd2d21059e0a03a318..9855ff9b44a662253f0776213ed32b430bf9fb58 100644 (file)
@@ -24,8 +24,8 @@ namespace po = ::boost::program_options;
 namespace {
 
 void init(const std::string& cmd,
-          const po::variables_map& options,
-          const std::vector<std::string>& args) {
+          const po::variables_map& /* options */,
+          const std::vector<std::string>& /* args */) {
   printf("running %s\n", cmd.c_str());
 }
 
index 7e044e490f2723c788342cc16f57bba25b87d467..3c0de66168885563e14a21191314e59dfe1f7b6f 100644 (file)
@@ -80,7 +80,7 @@ template <class U, class T> struct TupleTo;
 // Base case: empty typle -> empty tuple
 template <>
 struct TupleTo<std::tuple<>, std::tuple<>> {
-  static std::tuple<> convert(const std::tuple<>& input) {
+  static std::tuple<> convert(const std::tuple<>& /* input */) {
     return std::make_tuple();
   }
 };
index fd2c71532d35951a37e20290d77873c599157109..091357ee5b23a796c14631cd2fcf001047b7e704 100644 (file)
@@ -604,7 +604,9 @@ namespace detail {
 
 template <typename T>
 struct CollectContext {
-  struct Nothing { explicit Nothing(int n) {} };
+  struct Nothing {
+    explicit Nothing(int /* n */) {}
+  };
 
   using Result = typename std::conditional<
     std::is_void<T>::value,
@@ -861,26 +863,29 @@ Future<T> unorderedReduce(It first, It last, T initial, F func) {
   auto ctx = std::make_shared<UnorderedReduceContext>(
     std::move(initial), std::move(func), std::distance(first, last));
 
-  mapSetCallback<ItT>(first, last, [ctx](size_t i, Try<ItT>&& t) {
-    folly::MoveWrapper<Try<ItT>> 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<ItT>&& depending
-      // on the type of the argument of func.
-      return ctx->func_(std::move(v), mt->template get<IsTry::value, Arg&&>());
-    });
-    if (++ctx->numThens_ == ctx->numFutures_) {
-      // After reducing the value of the last Future, fulfill the Promise
-      ctx->memo_.setCallback_([ctx](Try<T>&& t2) {
-        ctx->promise_.setValue(std::move(t2));
+  mapSetCallback<ItT>(
+      first,
+      last,
+      [ctx](size_t /* i */, Try<ItT>&& t) {
+        folly::MoveWrapper<Try<ItT>> 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<ItT>&& depending
+          // on the type of the argument of func.
+          return ctx->func_(std::move(v),
+                            mt->template get<IsTry::value, Arg&&>());
+        });
+        if (++ctx->numThens_ == ctx->numFutures_) {
+          // After reducing the value of the last Future, fulfill the Promise
+          ctx->memo_.setCallback_(
+              [ctx](Try<T>&& t2) { ctx->promise_.setValue(std::move(t2)); });
+        }
       });
-    }
-  });
 
   return ctx->promise_.getFuture();
 }
@@ -953,7 +958,7 @@ void waitImpl(Future<T>& f) {
   if (f.isReady()) return;
 
   FutureBatonType baton;
-  f.setCallback_([&](const Try<T>& t) { baton.post(); });
+  f.setCallback_([&](const Try<T>& /* t */) { baton.post(); });
   baton.wait();
   assert(f.isReady());
 }
index 945e40f3dce0e507cf9e473211d20a0654177e2a..f53a1522d2f72a790e1708666a50e23064e450ab 100644 (file)
@@ -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");
      }
 
index 773da5e0e146ee4cb3669fc93b5a50df3d7dd724..05cde93721acc868e50ae9d546e280148523c91e 100644 (file)
@@ -437,14 +437,14 @@ struct CollectVariadicContext {
                   std::move(*std::get<sizeof...(ts2)>(o)));
   }
 
-  static std::tuple<Ts...> unwrap(std::tuple<folly::Try<Ts>...>&& o,
+  static std::tuple<Ts...> unwrap(std::tuple<folly::Try<Ts>...>&& /* o */,
                                   Ts&&... ts) {
     return std::tuple<Ts...>(std::forward<Ts>(ts)...);
   }
 };
 
-template <template <typename ...> class T, typename... Ts>
-void collectVariadicHelper(const std::shared_ptr<T<Ts...>>& ctx) {
+template <template <typename...> class T, typename... Ts>
+void collectVariadicHelper(const std::shared_ptr<T<Ts...>>& /* ctx */) {
   // base case
 }
 
index 61518326e8fa5617a42e126c366fc5a058399b56..189919fbffdc410411ad6631bfead40814eae112 100644 (file)
@@ -190,10 +190,10 @@ void throwAndCatchImpl() {
 // will try to wrap, so no exception_ptrs/rethrows are necessary.
 void throwAndCatchWrappedImpl() {
   makeFuture()
-      .then([](Try<Unit>&&){ throw std::runtime_error("oh no"); })
+      .then([](Try<Unit>&&) { throw std::runtime_error("oh no"); })
       .then([](Try<Unit>&& t) {
         auto caught = t.withException<std::runtime_error>(
-            [](const std::runtime_error& e){
+            [](const std::runtime_error& /* e */) {
               // ...
             });
         CHECK(caught);
@@ -220,12 +220,12 @@ void throwWrappedAndCatchImpl() {
 // The new way. Wrap an exception, and access it via the wrapper upstream
 void throwWrappedAndCatchWrappedImpl() {
   makeFuture()
-      .then([](Try<Unit>&&){
+      .then([](Try<Unit>&&) {
         return makeFuture<Unit>(std::runtime_error("oh no"));
       })
-      .then([](Try<Unit>&& t){
+      .then([](Try<Unit>&& t) {
         auto caught = t.withException<std::runtime_error>(
-            [](const std::runtime_error& e){
+            [](const std::runtime_error& /* e */) {
               // ...
             });
         CHECK(caught);
index e74fe9db597961a7e675ef436bc023b87b97ab5c..c58b41ff2f285a92b7b7e00f8c123accca210a85 100644 (file)
@@ -633,7 +633,7 @@ TEST(Collect, collectAllNone) {
 
 TEST(Collect, noDefaultConstructor) {
   struct A {
-    explicit A(size_t x) {}
+    explicit A(size_t /* x */) {}
   };
 
   auto f1 = makeFuture(A(1));
index 0f0fe183a4290114bc7628b17f175b85979c1214..99d1ba9c0af885b56b965ae7f1e07e43a1e9b468 100644 (file)
@@ -170,9 +170,7 @@ TEST(Executor, ThrowableThen) {
 
 class CrappyExecutor : public Executor {
  public:
-  void add(Func f) override {
-    throw std::runtime_error("bad");
-  }
+  void add(Func /* f */) override { throw std::runtime_error("bad"); }
 };
 
 TEST(Executor, CrappyExecutor) {
index cdec62e9e1d7fd29b9772401c0b92017540101e2..9c3cedc29e304de41ca84f2b6390548c57f80a49 100644 (file)
@@ -58,85 +58,100 @@ TEST(Future, onError) {
 
   // By reference
   {
-    auto f = makeFuture()
-      .then([] { throw eggs; })
-      .onError([&] (eggs_t& e) { flag(); });
+    auto f = makeFuture().then([] {
+      throw eggs;
+    }).onError([&](eggs_t& /* e */) { flag(); });
     EXPECT_FLAG();
     EXPECT_NO_THROW(f.value());
   }
 
   {
     auto f = makeFuture()
-      .then([] { throw eggs; })
-      .onError([&] (eggs_t& e) { flag(); return makeFuture(); });
+                 .then([] { throw eggs; })
+                 .onError([&](eggs_t& /* e */) {
+                   flag();
+                   return makeFuture();
+                 });
     EXPECT_FLAG();
     EXPECT_NO_THROW(f.value());
   }
 
   // By value
   {
-    auto f = makeFuture()
-      .then([] { throw eggs; })
-      .onError([&] (eggs_t e) { flag(); });
+    auto f = makeFuture().then([] {
+      throw eggs;
+    }).onError([&](eggs_t /* e */) { flag(); });
     EXPECT_FLAG();
     EXPECT_NO_THROW(f.value());
   }
 
   {
     auto f = makeFuture()
-      .then([] { throw eggs; })
-      .onError([&] (eggs_t e) { flag(); return makeFuture(); });
+                 .then([] { throw eggs; })
+                 .onError([&](eggs_t /* e */) {
+                   flag();
+                   return makeFuture();
+                 });
     EXPECT_FLAG();
     EXPECT_NO_THROW(f.value());
   }
 
   // Polymorphic
   {
-    auto f = makeFuture()
-      .then([] { throw eggs; })
-      .onError([&] (std::exception& e) { flag(); });
+    auto f = makeFuture().then([] {
+      throw eggs;
+    }).onError([&](std::exception& /* e */) { flag(); });
     EXPECT_FLAG();
     EXPECT_NO_THROW(f.value());
   }
 
   {
     auto f = makeFuture()
-      .then([] { throw eggs; })
-      .onError([&] (std::exception& e) { flag(); return makeFuture(); });
+                 .then([] { throw eggs; })
+                 .onError([&](std::exception& /* e */) {
+                   flag();
+                   return makeFuture();
+                 });
     EXPECT_FLAG();
     EXPECT_NO_THROW(f.value());
   }
 
   // Non-exceptions
   {
-    auto f = makeFuture()
-      .then([] { throw -1; })
-      .onError([&] (int e) { flag(); });
+    auto f = makeFuture().then([] {
+      throw - 1;
+    }).onError([&](int /* e */) { flag(); });
     EXPECT_FLAG();
     EXPECT_NO_THROW(f.value());
   }
 
   {
     auto f = makeFuture()
-      .then([] { throw -1; })
-      .onError([&] (int e) { flag(); return makeFuture(); });
+                 .then([] { throw - 1; })
+                 .onError([&](int /* e */) {
+                   flag();
+                   return makeFuture();
+                 });
     EXPECT_FLAG();
     EXPECT_NO_THROW(f.value());
   }
 
   // Mutable lambda
   {
-    auto f = makeFuture()
-      .then([] { throw eggs; })
-      .onError([&] (eggs_t& e) mutable { flag(); });
+    auto f = makeFuture().then([] {
+      throw eggs;
+    }).onError([&](eggs_t& /* e */) mutable { flag(); });
     EXPECT_FLAG();
     EXPECT_NO_THROW(f.value());
   }
 
   {
     auto f = makeFuture()
-      .then([] { throw eggs; })
-      .onError([&] (eggs_t& e) mutable { flag(); return makeFuture(); });
+                 .then([] { throw eggs; })
+                 .onError([&](eggs_t& /* e */) mutable {
+                   flag();
+                   return makeFuture();
+                 });
     EXPECT_FLAG();
     EXPECT_NO_THROW(f.value());
   }
@@ -144,50 +159,61 @@ TEST(Future, onError) {
   // No throw
   {
     auto f = makeFuture()
-      .then([] { return 42; })
-      .onError([&] (eggs_t& e) { flag(); return -1; });
+                 .then([] { return 42; })
+                 .onError([&](eggs_t& /* e */) {
+                   flag();
+                   return -1;
+                 });
     EXPECT_NO_FLAG();
     EXPECT_EQ(42, f.value());
   }
 
   {
     auto f = makeFuture()
-      .then([] { return 42; })
-      .onError([&] (eggs_t& e) { flag(); return makeFuture<int>(-1); });
+                 .then([] { return 42; })
+                 .onError([&](eggs_t& /* e */) {
+                   flag();
+                   return makeFuture<int>(-1);
+                 });
     EXPECT_NO_FLAG();
     EXPECT_EQ(42, f.value());
   }
 
   // Catch different exception
   {
-    auto f = makeFuture()
-      .then([] { throw eggs; })
-      .onError([&] (std::runtime_error& e) { flag(); });
+    auto f = makeFuture().then([] {
+      throw eggs;
+    }).onError([&](std::runtime_error& /* e */) { flag(); });
     EXPECT_NO_FLAG();
     EXPECT_THROW(f.value(), eggs_t);
   }
 
   {
     auto f = makeFuture()
-      .then([] { throw eggs; })
-      .onError([&] (std::runtime_error& e) { flag(); return makeFuture(); });
+                 .then([] { throw eggs; })
+                 .onError([&](std::runtime_error& /* e */) {
+                   flag();
+                   return makeFuture();
+                 });
     EXPECT_NO_FLAG();
     EXPECT_THROW(f.value(), eggs_t);
   }
 
   // Returned value propagates
   {
-    auto f = makeFuture()
-      .then([] { throw eggs; return 0; })
-      .onError([&] (eggs_t& e) { return 42; });
+    auto f = makeFuture().then([] {
+      throw eggs;
+      return 0;
+    }).onError([&](eggs_t& /* e */) { return 42; });
     EXPECT_EQ(42, f.value());
   }
 
   // Returned future propagates
   {
-    auto f = makeFuture()
-      .then([] { throw eggs; return 0; })
-      .onError([&] (eggs_t& e) { return makeFuture<int>(42); });
+    auto f = makeFuture().then([] {
+      throw eggs;
+      return 0;
+    }).onError([&](eggs_t& /* e */) { return makeFuture<int>(42); });
     EXPECT_EQ(42, f.value());
   }
 
@@ -209,8 +235,11 @@ TEST(Future, onError) {
   // exception_wrapper, return Future<T>
   {
     auto f = makeFuture()
-      .then([] { throw eggs; })
-      .onError([&] (exception_wrapper e) { flag(); return makeFuture(); });
+                 .then([] { throw eggs; })
+                 .onError([&](exception_wrapper /* e */) {
+                   flag();
+                   return makeFuture();
+                 });
     EXPECT_FLAG();
     EXPECT_NO_THROW(f.value());
   }
@@ -218,12 +247,15 @@ TEST(Future, onError) {
   // exception_wrapper, return Future<T> but throw
   {
     auto f = makeFuture()
-      .then([]{ throw eggs; return 0; })
-      .onError([&] (exception_wrapper e) {
-        flag();
-        throw eggs;
-        return makeFuture<int>(-1);
-      });
+                 .then([] {
+                   throw eggs;
+                   return 0;
+                 })
+                 .onError([&](exception_wrapper /* e */) {
+                   flag();
+                   throw eggs;
+                   return makeFuture<int>(-1);
+                 });
     EXPECT_FLAG();
     EXPECT_THROW(f.value(), eggs_t);
   }
@@ -231,11 +263,14 @@ TEST(Future, onError) {
   // exception_wrapper, return T
   {
     auto f = makeFuture()
-      .then([]{ throw eggs; return 0; })
-      .onError([&] (exception_wrapper e) {
-        flag();
-        return -1;
-      });
+                 .then([] {
+                   throw eggs;
+                   return 0;
+                 })
+                 .onError([&](exception_wrapper /* e */) {
+                   flag();
+                   return -1;
+                 });
     EXPECT_FLAG();
     EXPECT_EQ(-1, f.value());
   }
@@ -243,12 +278,15 @@ TEST(Future, onError) {
   // exception_wrapper, return T but throw
   {
     auto f = makeFuture()
-      .then([]{ throw eggs; return 0; })
-      .onError([&] (exception_wrapper e) {
-        flag();
-        throw eggs;
-        return -1;
-      });
+                 .then([] {
+                   throw eggs;
+                   return 0;
+                 })
+                 .onError([&](exception_wrapper /* e */) {
+                   flag();
+                   throw eggs;
+                   return -1;
+                 });
     EXPECT_FLAG();
     EXPECT_THROW(f.value(), eggs_t);
   }
@@ -256,11 +294,11 @@ TEST(Future, onError) {
   // const exception_wrapper&
   {
     auto f = makeFuture()
-      .then([] { throw eggs; })
-      .onError([&] (const exception_wrapper& e) {
-        flag();
-        return makeFuture();
-      });
+                 .then([] { throw eggs; })
+                 .onError([&](const exception_wrapper& /* e */) {
+                   flag();
+                   return makeFuture();
+                 });
     EXPECT_FLAG();
     EXPECT_NO_THROW(f.value());
   }
@@ -324,7 +362,7 @@ TEST(Future, thenTry) {
   EXPECT_TRUE(flag); flag = false;
 
   Promise<Unit> p;
-  auto f = p.getFuture().then([&](Try<Unit>&& t) { flag = true; });
+  auto f = p.getFuture().then([&](Try<Unit>&& /* t */) { flag = true; });
   EXPECT_FALSE(flag);
   EXPECT_FALSE(f.isReady());
   p.setValue();
@@ -350,7 +388,7 @@ TEST(Future, thenValue) {
   });
   EXPECT_TRUE(flag); flag = false;
 
-  auto f = makeFuture<int>(eggs).then([&](int i){});
+  auto f = makeFuture<int>(eggs).then([&](int /* i */) {});
   EXPECT_THROW(f.value(), eggs_t);
 
   f = makeFuture<Unit>(eggs).then([&]{});
@@ -364,9 +402,9 @@ TEST(Future, thenValueFuture) {
     .then([&](Try<int>&& t) { flag = true; EXPECT_EQ(42, t.value()); });
   EXPECT_TRUE(flag); flag = false;
 
-  makeFuture()
-    .then([]{ return makeFuture(); })
-    .then([&](Try<Unit>&& t) { flag = true; });
+  makeFuture().then([] {
+    return makeFuture();
+  }).then([&](Try<Unit>&& /* t */) { flag = true; });
   EXPECT_TRUE(flag); flag = false;
 }
 
@@ -645,15 +683,13 @@ TEST(Future, CircularDependencySharedPtrSelfReset) {
   Promise<int64_t> promise;
   auto ptr = std::make_shared<Future<int64_t>>(promise.getFuture());
 
-  ptr->then(
-    [ptr] (folly::Try<int64_t>&& uid) mutable {
-      EXPECT_EQ(1, ptr.use_count());
+  ptr->then([ptr](folly::Try<int64_t>&& /* uid */) mutable {
+    EXPECT_EQ(1, ptr.use_count());
 
-      // Leaving no references to ourselves.
-      ptr.reset();
-      EXPECT_EQ(0, ptr.use_count());
-    }
-  );
+    // Leaving no references to ourselves.
+    ptr.reset();
+    EXPECT_EQ(0, ptr.use_count());
+  });
 
   EXPECT_EQ(2, ptr.use_count());
 
@@ -701,7 +737,9 @@ TEST(Future, RequestContext) {
       if (throwsOnAdd_) { throw std::exception(); }
       v_.emplace_back(std::move(f));
     }
-    void addWithPriority(Func f, int8_t prio) override { add(std::move(f)); }
+    void addWithPriority(Func f, int8_t /* prio */) override {
+      add(std::move(f));
+    }
     uint8_t getNumPriorities() const override { return numPriorities_; }
 
     void setHandlesPriorities() { numPriorities_ = 2; }
@@ -722,7 +760,7 @@ TEST(Future, RequestContext) {
   RequestContext::get()->setContextData("key",
       folly::make_unique<MyRequestData>(true));
   auto checker = [](int lineno) {
-    return [lineno](Try<int>&& t) {
+    return [lineno](Try<int>&& /* t */) {
       auto d = static_cast<MyRequestData*>(
         RequestContext::get()->getContextData("key"));
       EXPECT_TRUE(d && d->value) << "on line " << lineno;
index 65f169edac434f8f8903492c4bfe18c9a2d19960..3ba584c1bbd1ef9397b5cbc88fb8a786a39ffe2e 100644 (file)
@@ -42,7 +42,7 @@ TEST(Interrupt, cancel) {
 TEST(Interrupt, handleThenInterrupt) {
   Promise<int> p;
   bool flag = false;
-  p.setInterruptHandler([&](const exception_wrapper& e) { flag = true; });
+  p.setInterruptHandler([&](const exception_wrapper& /* e */) { flag = true; });
   p.getFuture().cancel();
   EXPECT_TRUE(flag);
 }
@@ -51,14 +51,14 @@ TEST(Interrupt, interruptThenHandle) {
   Promise<int> p;
   bool flag = false;
   p.getFuture().cancel();
-  p.setInterruptHandler([&](const exception_wrapper& e) { flag = true; });
+  p.setInterruptHandler([&](const exception_wrapper& /* e */) { flag = true; });
   EXPECT_TRUE(flag);
 }
 
 TEST(Interrupt, interruptAfterFulfilNoop) {
   Promise<Unit> p;
   bool flag = false;
-  p.setInterruptHandler([&](const exception_wrapper& e) { flag = true; });
+  p.setInterruptHandler([&](const exception_wrapper& /* e */) { flag = true; });
   p.setValue();
   p.getFuture().cancel();
   EXPECT_FALSE(flag);
@@ -67,7 +67,7 @@ TEST(Interrupt, interruptAfterFulfilNoop) {
 TEST(Interrupt, secondInterruptNoop) {
   Promise<Unit> p;
   int count = 0;
-  p.setInterruptHandler([&](const exception_wrapper& e) { count++; });
+  p.setInterruptHandler([&](const exception_wrapper& /* e */) { count++; });
   auto f = p.getFuture();
   f.cancel();
   f.cancel();
@@ -77,7 +77,7 @@ TEST(Interrupt, secondInterruptNoop) {
 TEST(Interrupt, withinTimedOut) {
   Promise<int> p;
   Baton<> done;
-  p.setInterruptHandler([&](const exception_wrapper& e) { done.post(); });
+  p.setInterruptHandler([&](const exception_wrapper& /* e */) { done.post(); });
   p.getFuture().within(std::chrono::milliseconds(1));
   // Give it 100ms to time out and call the interrupt handler
   auto t = std::chrono::steady_clock::now() + std::chrono::milliseconds(100);
index 20e2924f305be95ae01f83330f0691a4b3e56849..1ad8850aebe1ff42b5311663502f82acc68600db 100644 (file)
@@ -126,10 +126,11 @@ TEST(Reduce, unorderedReduce) {
     fs.push_back(makeFuture(2));
     fs.push_back(makeFuture(3));
 
-    Future<double> f = unorderedReduce(fs.begin(), fs.end(), 0.0,
-      [](double a, int&& b){
-        return double(b);
-      });
+    Future<double> f =
+        unorderedReduce(fs.begin(),
+                        fs.end(),
+                        0.0,
+                        [](double /* a */, int&& b) { return double(b); });
     EXPECT_EQ(3.0, f.get());
   }
   {
@@ -142,10 +143,11 @@ TEST(Reduce, unorderedReduce) {
     fs.push_back(p2.getFuture());
     fs.push_back(p3.getFuture());
 
-    Future<double> f = unorderedReduce(fs.begin(), fs.end(), 0.0,
-      [](double a, int&& b){
-        return double(b);
-      });
+    Future<double> f =
+        unorderedReduce(fs.begin(),
+                        fs.end(),
+                        0.0,
+                        [](double /* a */, int&& b) { return double(b); });
     p3.setValue(3);
     p2.setValue(2);
     p1.setValue(1);
@@ -163,10 +165,11 @@ TEST(Reduce, unorderedReduceException) {
   fs.push_back(p2.getFuture());
   fs.push_back(p3.getFuture());
 
-  Future<double> f = unorderedReduce(fs.begin(), fs.end(), 0.0,
-    [](double a, int&& b){
-      return b + 0.0;
-    });
+  Future<double> f =
+      unorderedReduce(fs.begin(),
+                      fs.end(),
+                      0.0,
+                      [](double /* a */, int&& b) { return b + 0.0; });
   p3.setValue(3);
   p2.setException(exception_wrapper(std::runtime_error("blah")));
   p1.setValue(1);
index d92dd006d349a926103b207a2fa550233e984c70..696ace912ae61901c38d6fe624fffed3a158bfc9 100644 (file)
@@ -29,10 +29,12 @@ struct Widget {
     : v_(other.v_), copied_(other.copied_ + 1), moved_(other.moved_) {}
   Widget(Widget&& other) noexcept
     : v_(other.v_), copied_(other.copied_), moved_(other.moved_ + 1) {}
-  Widget& operator=(const Widget& other)
-    { throw std::logic_error("unexpected copy assignment"); }
-  Widget& operator=(Widget&& other)
-    { throw std::logic_error("unexpected move assignment"); }
+  Widget& operator=(const Widget& /* other */) {
+    throw std::logic_error("unexpected copy assignment");
+  }
+  Widget& operator=(Widget&& /* other */) {
+    throw std::logic_error("unexpected move assignment");
+  }
 };
 
 TEST(Then, tryConstructor) {
index 6f3e9da9cbf1d3461616de41a0f44d4c8cabbe2b..62522c6d6c427feb25149d0aa7de700140777886 100644 (file)
@@ -42,9 +42,8 @@ inline std::function<Future<Unit>(void)> makeThunk(
     std::mutex& ps_mutex) {
   return [&]() mutable {
     auto p = std::make_shared<Promise<Unit>>();
-    p->setInterruptHandler([&](exception_wrapper const& e) {
-      ++interrupt;
-    });
+    p->setInterruptHandler(
+        [&](exception_wrapper const& /* e */) { ++interrupt; });
     ps_mutex.lock();
     ps.push(p);
     ps_mutex.unlock();
@@ -69,9 +68,9 @@ TEST(Times, success) {
   bool failure = false;
 
   auto thunk = makeThunk(ps, interrupt, ps_mutex);
-  auto f = folly::times(3, thunk)
-    .then([&]() mutable { complete = true; })
-    .onError([&] (FutureException& e) { failure = true; });
+  auto f = folly::times(3, thunk).then([&]() mutable {
+    complete = true;
+  }).onError([&](FutureException& /* e */) { failure = true; });
 
   popAndFulfillPromise(ps, ps_mutex);
   EXPECT_FALSE(complete);
@@ -95,9 +94,9 @@ TEST(Times, failure) {
   bool failure = false;
 
   auto thunk = makeThunk(ps, interrupt, ps_mutex);
-  auto f = folly::times(3, thunk)
-    .then([&]() mutable { complete = true; })
-    .onError([&] (FutureException& e) { failure = true; });
+  auto f = folly::times(3, thunk).then([&]() mutable {
+    complete = true;
+  }).onError([&](FutureException& /* e */) { failure = true; });
 
   popAndFulfillPromise(ps, ps_mutex);
   EXPECT_FALSE(complete);
@@ -123,9 +122,9 @@ TEST(Times, interrupt) {
   bool failure = false;
 
   auto thunk = makeThunk(ps, interrupt, ps_mutex);
-  auto f = folly::times(3, thunk)
-    .then([&]() mutable { complete = true; })
-    .onError([&] (FutureException& e) { failure = true; });
+  auto f = folly::times(3, thunk).then([&]() mutable {
+    complete = true;
+  }).onError([&](FutureException& /* e */) { failure = true; });
 
   EXPECT_EQ(0, interrupt);
 
index 6408ee3fe321a7d43de7084daec06ff5d3ace975..39967bc80dd8aabdd5f740e2ef5916e3200d61a6 100644 (file)
@@ -124,14 +124,16 @@ TEST(Via, thenFunction) {
 
 TEST_F(ViaFixture, threadHops) {
   auto westThreadId = std::this_thread::get_id();
-  auto f = via(eastExecutor.get()).then([=](Try<Unit>&& t) {
-    EXPECT_NE(std::this_thread::get_id(), westThreadId);
-    return makeFuture<int>(1);
-  }).via(westExecutor.get()
-  ).then([=](Try<int>&& t) {
-    EXPECT_EQ(std::this_thread::get_id(), westThreadId);
-    return t.value();
-  });
+  auto f = via(eastExecutor.get())
+               .then([=](Try<Unit>&& /* t */) {
+                 EXPECT_NE(std::this_thread::get_id(), westThreadId);
+                 return makeFuture<int>(1);
+               })
+               .via(westExecutor.get())
+               .then([=](Try<int>&& t) {
+                 EXPECT_EQ(std::this_thread::get_id(), westThreadId);
+                 return t.value();
+               });
   EXPECT_EQ(f.getVia(waiter.get()), 1);
 }
 
@@ -189,7 +191,7 @@ TEST(Via, chain3) {
 }
 
 struct PriorityExecutor : public Executor {
-  void add(Func f) override {}
+  void add(Func /* f */) override {}
 
   void addWithPriority(Func f, int8_t priority) override {
     int mid = getNumPriorities() / 2;
@@ -371,7 +373,7 @@ TEST(Via, callbackRace) {
 
 class DummyDrivableExecutor : public DrivableExecutor {
  public:
-  void add(Func f) override {}
+  void add(Func /* f */) override {}
   void drive() override { ran = true; }
   bool ran{false};
 };
index a34f982f19bbcb8fad4d562281c87343535c1338..255878204cb522ca89a000fe03b6d67b2ad67a1f 100644 (file)
@@ -42,9 +42,8 @@ inline std::function<Future<Unit>(void)> makeThunk(
     std::mutex& ps_mutex) {
   return [&]() mutable {
     auto p = std::make_shared<Promise<Unit>>();
-    p->setInterruptHandler([&](exception_wrapper const& e) {
-      ++interrupt;
-    });
+    p->setInterruptHandler(
+        [&](exception_wrapper const& /* e */) { ++interrupt; });
     ps_mutex.lock();
     ps.push(p);
     ps_mutex.unlock();
@@ -72,8 +71,8 @@ TEST(WhileDo, success) {
   auto pred = makePred(i);
   auto thunk = makeThunk(ps, interrupt, ps_mutex);
   auto f = folly::whileDo(pred, thunk)
-    .then([&]() mutable { complete = true; })
-    .onError([&] (FutureException& e) { failure = true; });
+               .then([&]() mutable { complete = true; })
+               .onError([&](FutureException& /* e */) { failure = true; });
 
   popAndFulfillPromise(ps, ps_mutex);
   EXPECT_FALSE(complete);
@@ -100,8 +99,8 @@ TEST(WhileDo, failure) {
   auto pred = makePred(i);
   auto thunk = makeThunk(ps, interrupt, ps_mutex);
   auto f = folly::whileDo(pred, thunk)
-    .then([&]() mutable { complete = true; })
-    .onError([&] (FutureException& e) { failure = true; });
+               .then([&]() mutable { complete = true; })
+               .onError([&](FutureException& /* e */) { failure = true; });
 
   popAndFulfillPromise(ps, ps_mutex);
   EXPECT_FALSE(complete);
@@ -130,8 +129,8 @@ TEST(WhileDo, interrupt) {
   auto pred = makePred(i);
   auto thunk = makeThunk(ps, interrupt, ps_mutex);
   auto f = folly::whileDo(pred, thunk)
-    .then([&]() mutable { complete = true; })
-    .onError([&] (FutureException& e) { failure = true; });
+               .then([&]() mutable { complete = true; })
+               .onError([&](FutureException& /* e */) { failure = true; });
 
   EXPECT_EQ(0, interrupt);
 
index 86ea735502bdd38d08ea218862a8222a82cb9fa4..f0b829ab1caafa9b088f231103890878b6ba8204 100644 (file)
@@ -58,16 +58,14 @@ TEST(Window, basic) {
   }
   {
     // int -> Future<Unit>
-    auto res = reduce(
-      window(
-        std::vector<int>({1, 2, 3}),
-        [](int i) { return makeFuture(); },
-        2),
-      0,
-      [](int sum, const Try<Unit>& b) {
-        EXPECT_TRUE(b.hasValue());
-        return sum + 1;
-      }).get();
+    auto res = reduce(window(std::vector<int>({1, 2, 3}),
+                             [](int /* i */) { return makeFuture(); },
+                             2),
+                      0,
+                      [](int sum, const Try<Unit>& b) {
+                        EXPECT_TRUE(b.hasValue());
+                        return sum + 1;
+                      }).get();
     EXPECT_EQ(3, res);
   }
   {
index 7eded731b8e49d3e950ecf839c076ea72d3b4dbb..ba06f525d977e8726e63a6c71ec7fdf4b1c72cb7 100644 (file)
@@ -347,7 +347,7 @@ class SeqWithStepImpl {
 template <class Value>
 class InfiniteImpl {
  public:
-  bool test(const Value& current) const { return true; }
+  bool test(const Value& /* current */) const { return true; }
   void step(Value& current) const { ++current; }
   static constexpr bool infinite = true;
 };
@@ -1830,10 +1830,11 @@ class IsEmpty : public Operator<IsEmpty<emptyResult>> {
                   "false or hang. 'any' or 'notEmpty' will either return true "
                   "or hang.");
     bool ans = emptyResult;
-    source | [&](Value v) -> bool {
-      ans = !emptyResult;
-      return false;
-    };
+    source |
+        [&](Value /* v */) -> bool {
+          ans = !emptyResult;
+          return false;
+        };
     return ans;
   }
 };
@@ -1890,9 +1891,8 @@ class Count : public Operator<Count> {
   size_t compose(const GenImpl<Value, Source>& source) const {
     static_assert(!Source::infinite, "Cannot count infinite source");
     return foldl(size_t(0),
-                 [](size_t accum, Value v) {
-                   return accum + 1;
-                 }).compose(source);
+                 [](size_t accum, Value /* v */) { return accum + 1; })
+        .compose(source);
   }
 };
 
index 09ec25b627775090e0ecc7ee0df58fbb53ac67e4..3a73baeb30d89ac17a96f57637cb033eacc7c7c7 100644 (file)
@@ -145,9 +145,7 @@ void* IOBuf::operator new(size_t size) {
   return &(storage->buf);
 }
 
-void* IOBuf::operator new(size_t size, void* ptr) {
-  return ptr;
-}
+void* IOBuf::operator new(size_t /* size */, void* ptr) { return ptr; }
 
 void IOBuf::operator delete(void* ptr) {
   auto* storageAddr = static_cast<uint8_t*>(ptr) - offsetof(HeapStorage, buf);
@@ -188,7 +186,7 @@ void IOBuf::releaseStorage(HeapStorage* storage, uint16_t freeFlags) {
   }
 }
 
-void IOBuf::freeInternalBuf(void* buf, void* userData) {
+void IOBuf::freeInternalBuf(void* /* buf */, void* userData) {
   auto* storage = static_cast<HeapStorage*>(userData);
   releaseStorage(storage, kDataInUse);
 }
@@ -205,9 +203,12 @@ IOBuf::IOBuf(CreateOp, uint64_t capacity)
   data_ = buf_;
 }
 
-IOBuf::IOBuf(CopyBufferOp op, const void* buf, uint64_t size,
-             uint64_t headroom, uint64_t minTailroom)
-  : IOBuf(CREATE, headroom + size + minTailroom) {
+IOBuf::IOBuf(CopyBufferOp /* op */,
+             const void* buf,
+             uint64_t size,
+             uint64_t headroom,
+             uint64_t minTailroom)
+    : IOBuf(CREATE, headroom + size + minTailroom) {
   advance(headroom);
   memcpy(writableData(), buf, size);
   append(size);
index 432f9889e1345bb7743eb734cb609729010e3b9a..564438c60cfb551953d4064af4c7a24ff9cd5f27 100644 (file)
@@ -124,7 +124,7 @@ class AsyncSSLSocketConnector: public AsyncSocket::ConnectCallback,
     delete this;
   }
 
-  void handshakeSuc(AsyncSSLSocket* sock) noexcept override {
+  void handshakeSuc(AsyncSSLSocket* /* sock */) noexcept override {
     VLOG(7) << "client handshake success";
     if (callback_) {
       callback_->connectSuccess();
@@ -132,7 +132,7 @@ class AsyncSSLSocketConnector: public AsyncSocket::ConnectCallback,
     delete this;
   }
 
-  void handshakeErr(AsyncSSLSocket* socket,
+  void handshakeErr(AsyncSSLSocket* /* socket */,
                     const AsyncSocketException& ex) noexcept override {
     LOG(ERROR) << "client handshakeErr: " << ex.what();
     fail(ex);
@@ -641,8 +641,8 @@ AsyncSSLSocket* AsyncSSLSocket::getFromSSL(const SSL *ssl) {
       getSSLExDataIndex()));
 }
 
-void AsyncSSLSocket::failHandshake(const char* fn,
-                                    const AsyncSocketException& ex) {
+void AsyncSSLSocket::failHandshake(const char* /* fn */,
+                                   const AsyncSocketException& ex) {
   startFail();
   if (handshakeTimeout_.isScheduled()) {
     handshakeTimeout_.cancelTimeout();
@@ -1548,8 +1548,7 @@ int AsyncSSLSocket::eorAwareSSLWrite(SSL *ssl, const void *buf, int n,
   return n;
 }
 
-void
-AsyncSSLSocket::sslInfoCallback(const SSL *ssl, int where, int ret) {
+void AsyncSSLSocket::sslInfoCallback(const SSL* ssl, int where, int /* ret */) {
   AsyncSSLSocket *sslSocket = AsyncSSLSocket::getFromSSL(ssl);
   if (sslSocket->handshakeComplete_ && (where & SSL_CB_HANDSHAKE_START)) {
     sslSocket->renegotiateAttempted_ = true;
@@ -1611,10 +1610,13 @@ void AsyncSSLSocket::resetClientHelloParsing(SSL *ssl)  {
   clientHelloInfo_->clientHelloBuf_.clear();
 }
 
-void
-AsyncSSLSocket::clientHelloParsingCallback(int written, int version,
-    int contentType, const void *buf, size_t len, SSL *ssl, void *arg)
-{
+void AsyncSSLSocket::clientHelloParsingCallback(int written,
+                                                int /* version */,
+                                                int contentType,
+                                                const void* buf,
+                                                size_t len,
+                                                SSL* ssl,
+                                                void* arg) {
   AsyncSSLSocket *sock = static_cast<AsyncSSLSocket*>(arg);
   if (written != 0) {
     sock->resetClientHelloParsing(ssl);
index ba8a5d0a7b2ff2677e86925e8d737258de6ea4ca..e8f01393cb4f153a8f70683f78686724142f0165 100644 (file)
@@ -702,8 +702,9 @@ void AsyncServerSocket::setupSocket(int fd) {
   }
 }
 
-void AsyncServerSocket::handlerReady(
-  uint16_t events, int fd, sa_family_t addressFamily) noexcept {
+void AsyncServerSocket::handlerReady(uint16_t /* events */,
+                                     int fd,
+                                     sa_family_t addressFamily) noexcept {
   assert(!callbacks_.empty());
   DestructorGuard dg(this);
 
index b2c918489ce495f71fa688709b3767d6d41c12cf..08ed500f3bf2688fb24cebe9903894139f32a811 100644 (file)
@@ -80,8 +80,9 @@ void AsyncSignalHandler::unregisterSignalHandler(int signum) {
   signalEvents_.erase(it);
 }
 
-void AsyncSignalHandler::libeventCallback(int signum, short events,
-                                           void* arg) {
+void AsyncSignalHandler::libeventCallback(int signum,
+                                          short /* events */,
+                                          void* arg) {
   AsyncSignalHandler* handler = static_cast<AsyncSignalHandler*>(arg);
   handler->signalReceived(signum);
 }
index 2db3b2962b0bf7a39d82a80f2ea07c961d0c1126..a8fb13e0425f25fce7b658fa8321e37a464b8617 100644 (file)
@@ -1268,7 +1268,9 @@ void AsyncSocket::ioReady(uint16_t events) noexcept {
   }
 }
 
-ssize_t AsyncSocket::performRead(void** buf, size_t* buflen, size_t* offset) {
+ssize_t AsyncSocket::performRead(void** buf,
+                                 size_t* buflen,
+                                 size_t* /* offset */) {
   VLOG(5) << "AsyncSocket::performRead() this=" << this
           << ", buf=" << *buf << ", buflen=" << *buflen;
 
index 24184f7a3648163b4b1a34730e9c582670f54c34..788491c0ec1369de2684c93f5b77d2b2ab36d01c 100644 (file)
@@ -365,7 +365,7 @@ void SSLContext::switchCiphersIfTLS11(
 #endif
 
 #if OPENSSL_VERSION_NUMBER >= 0x1000200fL && !defined(OPENSSL_NO_TLSEXT)
-int SSLContext::alpnSelectCallback(SSL* ssl,
+int SSLContext::alpnSelectCallback(SSL* /* ssl */,
                                    const unsigned char** out,
                                    unsigned char* outlen,
                                    const unsigned char* in,
@@ -570,9 +570,12 @@ bool SSLContext::canUseFalseStartWithCipher(const SSL_CIPHER *cipher) {
 }
 #endif
 
-int SSLContext::selectNextProtocolCallback(
-  SSL* ssl, unsigned char **out, unsigned char *outlen,
-  const unsigned char *server, unsigned int server_len, void *data) {
+int SSLContext::selectNextProtocolCallback(SSL* /* ssl */,
+                                           unsigned char** out,
+                                           unsigned char* outlen,
+                                           const unsigned char* server,
+                                           unsigned int server_len,
+                                           void* data) {
 
   SSLContext* ctx = (SSLContext*)data;
   if (ctx->advertisedNextProtocols_.size() > 1) {
@@ -883,7 +886,7 @@ bool OpenSSLUtils::getPeerAddressFromX509StoreCtx(X509_STORE_CTX* ctx,
 
 bool OpenSSLUtils::validatePeerCertNames(X509* cert,
                                          const sockaddr* addr,
-                                         socklen_t addrLen) {
+                                         socklen_t /* addrLen */) {
   // Try to extract the names within the SAN extension from the certificate
   auto altNames =
     reinterpret_cast<STACK_OF(GENERAL_NAME)*>(
index 7821d17baf34495fdc242f8fcf4111396341a81b..a0d9455242dc1b6058a3e9fa47c9b7c310cc317d 100644 (file)
@@ -51,10 +51,10 @@ ScopedEventBaseThread::~ScopedEventBaseThread() {
 }
 
 ScopedEventBaseThread::ScopedEventBaseThread(
-    ScopedEventBaseThread&& other) noexcept = default;
+    ScopedEventBaseThread&& /* other */) noexcept = default;
 
 ScopedEventBaseThread& ScopedEventBaseThread::operator=(
-    ScopedEventBaseThread&& other) noexcept = default;
+    ScopedEventBaseThread&& /* other */) noexcept = default;
 
 void ScopedEventBaseThread::start() {
   if (running()) {
index 683b2a6507acfa25a1a9c73cb8b5ad3cf013e490..68151baf19d729dd60354b77c54678acfdb7606a 100644 (file)
@@ -209,7 +209,7 @@ public:
     *lenReturn = 0;
   }
 
-  void readDataAvailable(size_t len) noexcept override {
+  void readDataAvailable(size_t /* len */) noexcept override {
     // This should never to called.
     FAIL();
   }
@@ -311,9 +311,8 @@ public:
     sock->setReadCB(rcb_);
     state = (expect_ == EXPECT_SUCCESS) ? STATE_SUCCEEDED : STATE_FAILED;
   }
-  void handshakeErr(
-    AsyncSSLSocket *sock,
-    const AsyncSocketException& ex) noexcept override {
+  void handshakeErr(AsyncSSLSocket* /* sock */,
+                    const AsyncSocketException& ex) noexcept override {
     std::cerr << "HandshakeCallback::handshakeError " << ex.what() << std::endl;
     state = (expect_ == EXPECT_ERROR) ? STATE_SUCCEEDED : STATE_FAILED;
     if (expect_ == EXPECT_ERROR) {
@@ -353,8 +352,8 @@ public:
     state = STATE_FAILED;
   }
 
-  void connectionAccepted(int fd, const folly::SocketAddress& clientAddr)
-    noexcept override{
+  void connectionAccepted(
+      int fd, const folly::SocketAddress& /* clientAddr */) noexcept override {
     printf("Connection accepted\n");
     std::shared_ptr<AsyncSSLSocket> sslSock;
     try {
@@ -612,10 +611,10 @@ class TestSSLAsyncCacheServer : public TestSSLServer {
   static uint32_t asyncLookups_;
   static uint32_t lookupDelay_;
 
-  static SSL_SESSION *getSessionCallback(SSL *ssl,
-                                         unsigned char *sess_id,
-                                         int id_len,
-                                         int *copyflag) {
+  static SSL_SESSION* getSessionCallback(SSL* ssl,
+                                         unsigned char* /* sess_id */,
+                                         int /* id_len */,
+                                         intcopyflag) {
     *copyflag = 0;
     asyncCallbacks_++;
 #ifdef SSL_ERROR_WANT_SESS_CACHE_LOOKUP
@@ -852,11 +851,10 @@ class NpnServer :
     const AsyncSocketException& ex) noexcept override {
     ADD_FAILURE() << "server handshake error: " << ex.what();
   }
-  void getReadBuffer(void** bufReturn, size_t* lenReturn) override {
+  void getReadBuffer(void** /* bufReturn */, size_t* lenReturn) override {
     *lenReturn = 0;
   }
-  void readDataAvailable(size_t len) noexcept override {
-  }
+  void readDataAvailable(size_t /* len */) noexcept override {}
   void readEOF() noexcept override {
     socket_->close();
   }
@@ -922,17 +920,16 @@ class SNIServer :
   bool serverNameMatch;
 
  private:
-  void handshakeSuc(AsyncSSLSocket* ssl) noexcept override {}
+  void handshakeSuc(AsyncSSLSocket* /* ssl */) noexcept override {}
   void handshakeErr(
     AsyncSSLSocket*,
     const AsyncSocketException& ex) noexcept override {
     ADD_FAILURE() << "server handshake error: " << ex.what();
   }
-  void getReadBuffer(void** bufReturn, size_t* lenReturn) override {
+  void getReadBuffer(void** /* bufReturn */, size_t* lenReturn) override {
     *lenReturn = 0;
   }
-  void readDataAvailable(size_t len) noexcept override {
-  }
+  void readDataAvailable(size_t /* len */) noexcept override {}
   void readEOF() noexcept override {
     socket_->close();
   }
@@ -1076,10 +1073,8 @@ class SSLClient : public AsyncSocket::ConnectCallback,
     std::cerr << "client write success" << std::endl;
   }
 
-  void writeErr(
-    size_t bytesWritten,
-    const AsyncSocketException& ex)
-    noexcept override {
+  void writeErr(size_t /* bytesWritten */,
+                const AsyncSocketException& ex) noexcept override {
     std::cerr << "client writeError: " << ex.what() << std::endl;
     if (!sslSocket_) {
       writeAfterConnectErrors_++;
@@ -1142,10 +1137,9 @@ class SSLHandshakeBase :
   bool verifyResult_;
 
   // HandshakeCallback
-  bool handshakeVer(
-   AsyncSSLSocket* sock,
-   bool preverifyOk,
-   X509_STORE_CTX* ctx) noexcept override {
+  bool handshakeVer(AsyncSSLSocket* /* sock */,
+                    bool preverifyOk,
+                    X509_STORE_CTX* /* ctx */) noexcept override {
     handshakeVerify_ = true;
 
     EXPECT_EQ(preverifyResult_, preverifyOk);
@@ -1157,9 +1151,8 @@ class SSLHandshakeBase :
     handshakeTime = socket_->getHandshakeTime();
   }
 
-  void handshakeErr(
-   AsyncSSLSocket*,
-   const AsyncSocketException& ex) noexcept override {
+  void handshakeErr(AsyncSSLSocket*,
+                    const AsyncSocketException& /* ex */) noexcept override {
     handshakeError_ = true;
     handshakeTime = socket_->getHandshakeTime();
   }
index b7026d9e9f4c550539ccb764bb2290cda2140921..c6967362ab2bba5db0a35c372f50dfe740c9d616 100644 (file)
@@ -81,8 +81,8 @@ class AttachDetachClient : public AsyncSocket::ConnectCallback,
     cerr << "client write success" << endl;
   }
 
-  void writeErr(size_t bytesWritten, const AsyncSocketException& ex)
-    noexcept override {
+  void writeErr(size_t /* bytesWritten */,
+                const AsyncSocketException& ex) noexcept override {
     cerr << "client writeError: " << ex.what() << endl;
   }
 
index 7ee36a8cb97525a707b709f63c60715a4c4e0487..7d71647bd0d9c6273133a04c26992d7e83009a75 100644 (file)
@@ -1462,34 +1462,34 @@ class TestConnectionEventCallback :
   public AsyncServerSocket::ConnectionEventCallback {
  public:
   virtual void onConnectionAccepted(
-      const int socket,
-      const SocketAddress& addr) noexcept override {
+      const int /* socket */,
+      const SocketAddress& /* addr */) noexcept override {
     folly::RWSpinLock::WriteHolder holder(spinLock_);
     connectionAccepted_++;
   }
 
-  virtual void onConnectionAcceptError(const int err) noexcept override {
+  virtual void onConnectionAcceptError(const int /* err */) noexcept override {
     folly::RWSpinLock::WriteHolder holder(spinLock_);
     connectionAcceptedError_++;
   }
 
   virtual void onConnectionDropped(
-      const int socket,
-      const SocketAddress& addr) noexcept override {
+      const int /* socket */,
+      const SocketAddress& /* addr */) noexcept override {
     folly::RWSpinLock::WriteHolder holder(spinLock_);
     connectionDropped_++;
   }
 
   virtual void onConnectionEnqueuedForAcceptorCallback(
-      const int socket,
-      const SocketAddress& addr) noexcept override {
+      const int /* socket */,
+      const SocketAddress& /* addr */) noexcept override {
     folly::RWSpinLock::WriteHolder holder(spinLock_);
     connectionEnqueuedForAcceptCallback_++;
   }
 
   virtual void onConnectionDequeuedByAcceptorCallback(
-      const int socket,
-      const SocketAddress& addr) noexcept override {
+      const int /* socket */,
+      const SocketAddress& /* addr */) noexcept override {
     folly::RWSpinLock::WriteHolder holder(spinLock_);
     connectionDequeuedByAcceptCallback_++;
   }
@@ -1679,10 +1679,10 @@ TEST(AsyncSocketTest, ServerAcceptOptions) {
   // Add a callback to accept one connection then stop the loop
   TestAcceptCallback acceptCallback;
   acceptCallback.setConnectionAcceptedFn(
-    [&](int fd, const folly::SocketAddress& addr) {
-      serverSocket->removeAcceptCallback(&acceptCallback, nullptr);
-    });
-  acceptCallback.setAcceptErrorFn([&](const std::exception& ex) {
+      [&](int /* fd */, const folly::SocketAddress& /* addr */) {
+        serverSocket->removeAcceptCallback(&acceptCallback, nullptr);
+      });
+  acceptCallback.setAcceptErrorFn([&](const std::exception& /* ex */) {
     serverSocket->removeAcceptCallback(&acceptCallback, nullptr);
   });
   serverSocket->addAcceptCallback(&acceptCallback, nullptr);
@@ -1746,53 +1746,56 @@ TEST(AsyncSocketTest, RemoveAcceptCallback) {
   // Have callback 2 remove callback 3 and callback 5 the first time it is
   // called.
   int cb2Count = 0;
-  cb1.setConnectionAcceptedFn([&](int fd, const folly::SocketAddress& addr){
-      std::shared_ptr<AsyncSocket> sock2(
+  cb1.setConnectionAcceptedFn([&](int /* fd */,
+                                  const folly::SocketAddress& /* addr */) {
+    std::shared_ptr<AsyncSocket> sock2(
         AsyncSocket::newSocket(&eventBase, serverAddress)); // cb2: -cb3 -cb5
+  });
+  cb3.setConnectionAcceptedFn(
+      [&](int /* fd */, const folly::SocketAddress& /* addr */) {});
+  cb4.setConnectionAcceptedFn(
+      [&](int /* fd */, const folly::SocketAddress& /* addr */) {
+        std::shared_ptr<AsyncSocket> sock3(
+            AsyncSocket::newSocket(&eventBase, serverAddress)); // cb4
+      });
+  cb5.setConnectionAcceptedFn(
+      [&](int /* fd */, const folly::SocketAddress& /* addr */) {
+        std::shared_ptr<AsyncSocket> sock5(
+            AsyncSocket::newSocket(&eventBase, serverAddress)); // cb7: -cb7
+
       });
-  cb3.setConnectionAcceptedFn([&](int fd, const folly::SocketAddress& addr){
-    });
-  cb4.setConnectionAcceptedFn([&](int fd, const folly::SocketAddress& addr){
-      std::shared_ptr<AsyncSocket> sock3(
-        AsyncSocket::newSocket(&eventBase, serverAddress)); // cb4
-    });
-  cb5.setConnectionAcceptedFn([&](int fd, const folly::SocketAddress& addr){
-  std::shared_ptr<AsyncSocket> sock5(
-      AsyncSocket::newSocket(&eventBase, serverAddress)); // cb7: -cb7
-
-    });
   cb2.setConnectionAcceptedFn(
-    [&](int fd, const folly::SocketAddress& addr) {
-      if (cb2Count == 0) {
-        serverSocket->removeAcceptCallback(&cb3, nullptr);
-        serverSocket->removeAcceptCallback(&cb5, nullptr);
-      }
-      ++cb2Count;
-    });
+      [&](int /* fd */, const folly::SocketAddress& /* addr */) {
+        if (cb2Count == 0) {
+          serverSocket->removeAcceptCallback(&cb3, nullptr);
+          serverSocket->removeAcceptCallback(&cb5, nullptr);
+        }
+        ++cb2Count;
+      });
   // Have callback 6 remove callback 4 the first time it is called,
   // and destroy the server socket the second time it is called
   int cb6Count = 0;
   cb6.setConnectionAcceptedFn(
-    [&](int fd, const folly::SocketAddress& addr) {
-      if (cb6Count == 0) {
-        serverSocket->removeAcceptCallback(&cb4, nullptr);
-        std::shared_ptr<AsyncSocket> sock6(
-          AsyncSocket::newSocket(&eventBase, serverAddress)); // cb1
-        std::shared_ptr<AsyncSocket> sock7(
-          AsyncSocket::newSocket(&eventBase, serverAddress)); // cb2
-        std::shared_ptr<AsyncSocket> sock8(
-          AsyncSocket::newSocket(&eventBase, serverAddress)); // cb6: stop
-
-      } else {
-        serverSocket.reset();
-      }
-      ++cb6Count;
-    });
+      [&](int /* fd */, const folly::SocketAddress& /* addr */) {
+        if (cb6Count == 0) {
+          serverSocket->removeAcceptCallback(&cb4, nullptr);
+          std::shared_ptr<AsyncSocket> sock6(
+              AsyncSocket::newSocket(&eventBase, serverAddress)); // cb1
+          std::shared_ptr<AsyncSocket> sock7(
+              AsyncSocket::newSocket(&eventBase, serverAddress)); // cb2
+          std::shared_ptr<AsyncSocket> sock8(
+              AsyncSocket::newSocket(&eventBase, serverAddress)); // cb6: stop
+
+        } else {
+          serverSocket.reset();
+        }
+        ++cb6Count;
+      });
   // Have callback 7 remove itself
   cb7.setConnectionAcceptedFn(
-    [&](int fd, const folly::SocketAddress& addr) {
-      serverSocket->removeAcceptCallback(&cb7, nullptr);
-    });
+      [&](int /* fd */, const folly::SocketAddress& /* addr */) {
+        serverSocket->removeAcceptCallback(&cb7, nullptr);
+      });
 
   serverSocket->addAcceptCallback(&cb1, nullptr);
   serverSocket->addAcceptCallback(&cb2, nullptr);
@@ -1900,10 +1903,11 @@ TEST(AsyncSocketTest, OtherThreadAcceptCallback) {
     CHECK_NE(thread_id, pthread_self());
     thread_id = pthread_self();
   });
-  cb1.setConnectionAcceptedFn([&](int fd, const folly::SocketAddress& addr){
-    CHECK_EQ(thread_id, pthread_self());
-    serverSocket->removeAcceptCallback(&cb1, nullptr);
-  });
+  cb1.setConnectionAcceptedFn(
+      [&](int /* fd */, const folly::SocketAddress& /* addr */) {
+        CHECK_EQ(thread_id, pthread_self());
+        serverSocket->removeAcceptCallback(&cb1, nullptr);
+      });
   cb1.setAcceptStoppedFn([&](){
     CHECK_EQ(thread_id, pthread_self());
   });
@@ -1945,10 +1949,10 @@ void serverSocketSanityTest(AsyncServerSocket* serverSocket) {
   // Add a callback to accept one connection then stop accepting
   TestAcceptCallback acceptCallback;
   acceptCallback.setConnectionAcceptedFn(
-    [&](int fd, const folly::SocketAddress& addr) {
-      serverSocket->removeAcceptCallback(&acceptCallback, nullptr);
-    });
-  acceptCallback.setAcceptErrorFn([&](const std::exception& ex) {
+      [&](int /* fd */, const folly::SocketAddress& /* addr */) {
+        serverSocket->removeAcceptCallback(&acceptCallback, nullptr);
+      });
+  acceptCallback.setAcceptErrorFn([&](const std::exception& /* ex */) {
     serverSocket->removeAcceptCallback(&acceptCallback, nullptr);
   });
   serverSocket->addAcceptCallback(&acceptCallback, nullptr);
@@ -2123,10 +2127,10 @@ TEST(AsyncSocketTest, UnixDomainSocketTest) {
   // Add a callback to accept one connection then stop the loop
   TestAcceptCallback acceptCallback;
   acceptCallback.setConnectionAcceptedFn(
-    [&](int fd, const folly::SocketAddress& addr) {
-      serverSocket->removeAcceptCallback(&acceptCallback, nullptr);
-    });
-  acceptCallback.setAcceptErrorFn([&](const std::exception& ex) {
+      [&](int /* fd */, const folly::SocketAddress& /* addr */) {
+        serverSocket->removeAcceptCallback(&acceptCallback, nullptr);
+      });
+  acceptCallback.setAcceptErrorFn([&](const std::exception& /* ex */) {
     serverSocket->removeAcceptCallback(&acceptCallback, nullptr);
   });
   serverSocket->addAcceptCallback(&acceptCallback, nullptr);
@@ -2169,10 +2173,10 @@ TEST(AsyncSocketTest, ConnectionEventCallbackDefault) {
   // Add a callback to accept one connection then stop the loop
   TestAcceptCallback acceptCallback;
   acceptCallback.setConnectionAcceptedFn(
-    [&](int fd, const folly::SocketAddress& addr) {
-      serverSocket->removeAcceptCallback(&acceptCallback, nullptr);
-    });
-  acceptCallback.setAcceptErrorFn([&](const std::exception& ex) {
+      [&](int /* fd */, const folly::SocketAddress& /* addr */) {
+        serverSocket->removeAcceptCallback(&acceptCallback, nullptr);
+      });
+  acceptCallback.setAcceptErrorFn([&](const std::exception& /* ex */) {
     serverSocket->removeAcceptCallback(&acceptCallback, nullptr);
   });
   serverSocket->addAcceptCallback(&acceptCallback, nullptr);
@@ -2215,7 +2219,7 @@ TEST(AsyncSocketTest, NumPendingMessagesInQueue) {
   // Add a callback to accept connections
   TestAcceptCallback acceptCallback;
   acceptCallback.setConnectionAcceptedFn(
-      [&](int fd, const folly::SocketAddress& addr) {
+      [&](int /* fd */, const folly::SocketAddress& /* addr */) {
         count++;
         CHECK_EQ(4 - count, serverSocket->getNumPendingMessagesInQueue());
 
@@ -2224,7 +2228,7 @@ TEST(AsyncSocketTest, NumPendingMessagesInQueue) {
           serverSocket->removeAcceptCallback(&acceptCallback, &eventBase);
         }
       });
-  acceptCallback.setAcceptErrorFn([&](const std::exception& ex) {
+  acceptCallback.setAcceptErrorFn([&](const std::exception& /* ex */) {
     serverSocket->removeAcceptCallback(&acceptCallback, &eventBase);
   });
   serverSocket->addAcceptCallback(&acceptCallback, &eventBase);
index 2af6ffb6267c4172a389128aeb7f32b7ba7fca82..3b4b7bc19d9c939f8a603b04ac102817c1f4aeba 100644 (file)
@@ -45,7 +45,7 @@ class UDPAcceptor
 
   void onListenStopped() noexcept override {}
 
-  void onDataAvailable(std::shared_ptr<folly::AsyncUDPSocket> socket,
+  void onDataAvailable(std::shared_ptr<folly::AsyncUDPSocket> /* socket */,
                        const folly::SocketAddress& client,
                        std::unique_ptr<folly::IOBuf> data,
                        bool truncated) noexcept override {
index 7d2ee4546898b7ed536142659c8e0af56ec8843f..ca5830ab67152b125ff15d8aba587c9d9f35b923 100644 (file)
@@ -98,7 +98,7 @@ class BlockingSocket : public folly::AsyncSocket::ConnectCallback,
     err_ = ex;
   }
   void writeSuccess() noexcept override {}
-  void writeErr(size_t bytesWritten,
+  void writeErr(size_t /* bytesWritten */,
                 const folly::AsyncSocketException& ex) noexcept override {
     err_ = ex;
   }
index 40e29d52d92fb94cf1bf6aa1196c97029a6f66d6..ec448f1863e65c1dfbdfbe12440eb0fa53e423d1 100644 (file)
@@ -1431,7 +1431,7 @@ class TerminateTestCallback : public EventBase::LoopCallback,
     unregisterHandler();
   }
 
-  void handlerReady(uint16_t events) noexcept override {
+  void handlerReady(uint16_t /* events */) noexcept override {
     // We didn't register with PERSIST, so we will have been automatically
     // unregistered already.
     ASSERT_FALSE(isHandlerRegistered());
@@ -1690,7 +1690,7 @@ public:
   PipeHandler(EventBase* eventBase, int fd)
     : EventHandler(eventBase, fd) {}
 
-  void handlerReady(uint16_t events) noexcept override { abort(); }
+  void handlerReady(uint16_t /* events */) noexcept override { abort(); }
 };
 
 TEST(EventBaseTest, StopBeforeLoop) {
index 9a4372345e94b7014661896bfc931ee931eb9149..9653cd08019c2e5c453d96ea5f1026eac67d20ac 100644 (file)
@@ -89,13 +89,13 @@ TEST_F(EventHandlerTest, simple) {
   EventHandlerMock eh(&eb, efd);
   eh.registerHandler(EventHandler::READ | EventHandler::PERSIST);
   EXPECT_CALL(eh, _handlerReady(_))
-    .Times(writes)
-    .WillRepeatedly(Invoke([&](uint16_t events) {
-      efd_read();
-      if (--readsRemaining == 0) {
-        eh.unregisterHandler();
-      }
-    }));
+      .Times(writes)
+      .WillRepeatedly(Invoke([&](uint16_t /* events */) {
+        efd_read();
+        if (--readsRemaining == 0) {
+          eh.unregisterHandler();
+        }
+      }));
   efd_write(writes);
   eb.loop();
 
@@ -108,28 +108,29 @@ TEST_F(EventHandlerTest, many_concurrent_producers) {
   size_t readsRemaining = writes;
 
   runInThreadsAndWait({
-    [&] {
-      EventBase eb;
-      EventHandlerMock eh(&eb, efd);
-      eh.registerHandler(EventHandler::READ | EventHandler::PERSIST);
-      EXPECT_CALL(eh, _handlerReady(_))
-        .Times(writes)
-        .WillRepeatedly(Invoke([&](uint16_t events) {
-          efd_read();
-          if (--readsRemaining == 0) {
-            eh.unregisterHandler();
-          }
-        }));
-      eb.loop();
-    },
-    [&] {
-      runInThreadsAndWait(nproducers, [&](size_t k) {
-        for (size_t i = 0; i < writes / nproducers; ++i) {
-          this_thread::sleep_for(chrono::milliseconds(1));
-          efd_write(1);
-        }
-      });
-    },
+      [&] {
+        EventBase eb;
+        EventHandlerMock eh(&eb, efd);
+        eh.registerHandler(EventHandler::READ | EventHandler::PERSIST);
+        EXPECT_CALL(eh, _handlerReady(_))
+            .Times(writes)
+            .WillRepeatedly(Invoke([&](uint16_t /* events */) {
+              efd_read();
+              if (--readsRemaining == 0) {
+                eh.unregisterHandler();
+              }
+            }));
+        eb.loop();
+      },
+      [&] {
+        runInThreadsAndWait(nproducers,
+                            [&](size_t /* k */) {
+                              for (size_t i = 0; i < writes / nproducers; ++i) {
+                                this_thread::sleep_for(chrono::milliseconds(1));
+                                efd_write(1);
+                              }
+                            });
+      },
   });
 
   EXPECT_EQ(0, readsRemaining);
@@ -145,37 +146,40 @@ TEST_F(EventHandlerTest, many_concurrent_consumers) {
   MPMCQueue<nullptr_t> queue(writes / 10);
 
   runInThreadsAndWait({
-    [&] {
-      runInThreadsAndWait(nconsumers, [&](size_t k) {
-        size_t thReadsRemaining = writes / nconsumers;
-        EventBase eb;
-        EventHandlerMock eh(&eb, efd);
-        eh.registerHandler(EventHandler::READ | EventHandler::PERSIST);
-        EXPECT_CALL(eh, _handlerReady(_))
-          .WillRepeatedly(Invoke([&](uint16_t events) {
-            nullptr_t val;
-            if (!queue.readIfNotEmpty(val)) {
-              return;
-            }
-            efd_read();
-            --readsRemaining;
-            if (--thReadsRemaining == 0) {
-              eh.unregisterHandler();
-            }
-          }));
-        eb.loop();
-      });
-    },
-    [&] {
-      runInThreadsAndWait(nproducers, [&](size_t k) {
-        for (size_t i = 0; i < writes / nproducers; ++i) {
-          this_thread::sleep_for(chrono::milliseconds(1));
-          queue.blockingWrite(nullptr);
-          efd_write(1);
-          --writesRemaining;
-        }
-      });
-    },
+      [&] {
+        runInThreadsAndWait(
+            nconsumers,
+            [&](size_t /* k */) {
+              size_t thReadsRemaining = writes / nconsumers;
+              EventBase eb;
+              EventHandlerMock eh(&eb, efd);
+              eh.registerHandler(EventHandler::READ | EventHandler::PERSIST);
+              EXPECT_CALL(eh, _handlerReady(_))
+                  .WillRepeatedly(Invoke([&](uint16_t /* events */) {
+                    nullptr_t val;
+                    if (!queue.readIfNotEmpty(val)) {
+                      return;
+                    }
+                    efd_read();
+                    --readsRemaining;
+                    if (--thReadsRemaining == 0) {
+                      eh.unregisterHandler();
+                    }
+                  }));
+              eb.loop();
+            });
+      },
+      [&] {
+        runInThreadsAndWait(nproducers,
+                            [&](size_t /* k */) {
+                              for (size_t i = 0; i < writes / nproducers; ++i) {
+                                this_thread::sleep_for(chrono::milliseconds(1));
+                                queue.blockingWrite(nullptr);
+                                efd_write(1);
+                                --writesRemaining;
+                              }
+                            });
+      },
   });
 
   EXPECT_EQ(0, writesRemaining);
index 5de62856b6b19668b8db89da1330ce49e3f399bc..8eb12a2fa0457ea08cdacc9a7dd958b20ebf00ee 100644 (file)
@@ -436,9 +436,7 @@ TEST(NotificationQueueTest, ConsumeUntilDrained) {
 
   // Make sure there can only be one drainer at once
   folly::Baton<> callbackBaton, threadStartBaton;
-  consumer.fn = [&](int i) {
-    callbackBaton.wait();
-  };
+  consumer.fn = [&](int /* i */) { callbackBaton.wait(); };
   QueueConsumer competingConsumer;
   competingConsumer.startConsuming(&eventBase, &queue);
   queue.putMessage(1);
@@ -487,9 +485,7 @@ TEST(NotificationQueueTest, ConsumeUntilDrainedStress) {
 
     // Make sure there can only be one drainer at once
     folly::Baton<> callbackBaton, threadStartBaton;
-    consumer.fn = [&](int i) {
-      callbackBaton.wait();
-    };
+    consumer.fn = [&](int /* i */) { callbackBaton.wait(); };
     QueueConsumer competingConsumer;
     competingConsumer.startConsuming(&eventBase, &queue);
     queue.putMessage(1);
index cbf688108976aab5c13a705c597fe6b2117ebdc7..b2a367cae969c3348fbfbc643ca0afeb3684a85d 100644 (file)
@@ -65,9 +65,7 @@ class MmapAllocator {
     return !(*this == other);
   }
 
-  bool operator==(const MmapAllocator<T>& other) const {
-    return true;
-  }
+  bool operator==(const MmapAllocator<T>& /* other */) const { return true; }
 
   template <class... Args>
   void construct(T* p, Args&&... args) {
index 51f0b102fda2eb40d71e6e0a9bfa229adec4e175..458c170a0ebf6fc794c5c1f6ec49cf50eed9cfdf 100644 (file)
@@ -668,7 +668,7 @@ TEST(Ahm, thread_erase_insert_race) {
 typedef AtomicHashArray<int32_t, int32_t> AHA;
 AHA::Config configRace;
 auto atomicHashArrayInsertRaceArray = AHA::create(2, configRace);
-void* atomicHashArrayInsertRaceThread(void* j) {
+void* atomicHashArrayInsertRaceThread(void* /* j */) {
   AHA* arr = atomicHashArrayInsertRaceArray.get();
   uintptr_t numInserted = 0;
   while (!runThreadsCreatedAllThreads.load());
index b830a3886235abf0c8522f4dce4e7522eb76b813..94792428afc061d0d6d9ef0c7e1c4128c0819e61 100644 (file)
@@ -35,27 +35,30 @@ struct non_atomic {
 
   T operator+=(T arg) { value += arg; return load();}
 
-  T load(std::memory_order order= std::memory_order_seq_cst) const {
+  T load(std::memory_order /* order */ = std::memory_order_seq_cst) const {
     return value;
   }
 
   /* implicit */
   operator T() const {return load();}
 
-  void store(T desired, std::memory_order order = std::memory_order_seq_cst) {
+  void store(T desired,
+             std::memory_order /* order */ = std::memory_order_seq_cst) {
     value = desired;
   }
 
-  T exchange(T desired, std::memory_order order = std::memory_order_seq_cst) {
+  T exchange(T desired,
+             std::memory_order /* order */ = std::memory_order_seq_cst) {
     T old = load();
     store(desired);
     return old;
   }
 
   bool compare_exchange_weak(
-      T& expected, T desired,
-      std::memory_order success = std::memory_order_seq_cst,
-      std::memory_order failure = std::memory_order_seq_cst) {
+      T& expected,
+      T desired,
+      std::memory_order /* success */ = std::memory_order_seq_cst,
+      std::memory_order /* failure */ = std::memory_order_seq_cst) {
     if (value == expected) {
       value = desired;
       return true;
@@ -66,9 +69,10 @@ struct non_atomic {
   }
 
   bool compare_exchange_strong(
-      T& expected, T desired,
-      std::memory_order success = std::memory_order_seq_cst,
-      std::memory_order failure = std::memory_order_seq_cst) {
+      T& expected,
+      T desired,
+      std::memory_order /* success */ = std::memory_order_seq_cst,
+      std::memory_order /* failure */ = std::memory_order_seq_cst) {
     if (value == expected) {
       value = desired;
       return true;
index 2899b48a4619f7546685d0009d60e3731c456449..bafb9f607486b9a0428957db3bfe7c4f6777ee3f 100644 (file)
@@ -346,7 +346,7 @@ TEST(ThreadId, SimplePthread) {
 
 static FOLLY_TLS unsigned testingCpu = 0;
 
-static int testingGetcpu(unsigned* cpu, unsigned* node, void* unused) {
+static int testingGetcpu(unsigned* cpu, unsigned* node, void* /* unused */) {
   if (cpu != nullptr) {
     *cpu = testingCpu;
   }
index fa5437c0e99e5e89e2e5b1b3e33bced1f3d24e5f..bd3028575d1c112bc777440ebb8106c5bb2dedf3 100644 (file)
@@ -384,13 +384,13 @@ class ConcurrentAccessData {
     FOR_EACH(lock, locks_) delete *lock;
   }
 
-  inline bool skipListFind(int idx, ValueType val) {
+  inline bool skipListFind(int /* idx */, ValueType val) {
     return skipList_.contains(val);
   }
-  inline void skipListInsert(int idx, ValueType val) {
+  inline void skipListInsert(int /* idx */, ValueType val) {
     skipList_.add(val);
   }
-  inline void skipListErase(int idx, ValueType val) {
+  inline void skipListErase(int /* idx */, ValueType val) {
     skipList_.remove(val);
   }
 
index 62a2fbf5eb91badb45b7f184d213a078709f37d3..a08be86baf393945eebb32e605131060031446c6 100644 (file)
@@ -139,7 +139,9 @@ int DeterministicSchedule::getRandNumber(int n) {
   return std::rand() % n;
 }
 
-int DeterministicSchedule::getcpu(unsigned* cpu, unsigned* node, void* unused) {
+int DeterministicSchedule::getcpu(unsigned* cpu,
+                                  unsigned* node,
+                                  void* /* unused */) {
   if (!tls_threadId && tls_sched) {
     beforeSharedAccess();
     tls_threadId = tls_sched->nextThreadId_++;
@@ -364,7 +366,7 @@ AccessSpreaderArray<test::DeterministicAtomic, 128>
 
 template <>
 Getcpu::Func AccessSpreader<test::DeterministicAtomic>::pickGetcpuFunc(
-    size_t numStripes) {
+    size_t /* numStripes */) {
   return &DeterministicSchedule::getcpu;
 }
 }
index 25cd80e6b46d8ec32a28e8ff8806031800d900b6..cc085570c51b65f16a47d9b9a9966e5721d63b97 100644 (file)
@@ -257,7 +257,7 @@ struct DeterministicAtomic {
     return rv;
   }
 
-  T operator++(int postDummy) noexcept {
+  T operator++(int /* postDummy */) noexcept {
     DeterministicSchedule::beforeSharedAccess();
     T rv = data++;
     FOLLY_TEST_DSCHED_VLOG(this << " post++ -> " << std::hex << rv);
@@ -273,7 +273,7 @@ struct DeterministicAtomic {
     return rv;
   }
 
-  T operator--(int postDummy) noexcept {
+  T operator--(int /* postDummy */) noexcept {
     DeterministicSchedule::beforeSharedAccess();
     T rv = data--;
     FOLLY_TEST_DSCHED_VLOG(this << " post-- -> " << std::hex << rv);
@@ -290,7 +290,8 @@ struct DeterministicAtomic {
     return rv;
   }
 
-  T fetch_add(T v, std::memory_order mo = std::memory_order_seq_cst) noexcept {
+  T fetch_add(T v,
+              std::memory_order /* mo */ = std::memory_order_seq_cst) noexcept {
     DeterministicSchedule::beforeSharedAccess();
     T rv = data;
     data += v;
@@ -309,7 +310,8 @@ struct DeterministicAtomic {
     return rv;
   }
 
-  T fetch_sub(T v, std::memory_order mo = std::memory_order_seq_cst) noexcept {
+  T fetch_sub(T v,
+              std::memory_order /* mo */ = std::memory_order_seq_cst) noexcept {
     DeterministicSchedule::beforeSharedAccess();
     T rv = data;
     data -= v;
@@ -328,7 +330,8 @@ struct DeterministicAtomic {
     return rv;
   }
 
-  T fetch_and(T v, std::memory_order mo = std::memory_order_seq_cst) noexcept {
+  T fetch_and(T v,
+              std::memory_order /* mo */ = std::memory_order_seq_cst) noexcept {
     DeterministicSchedule::beforeSharedAccess();
     T rv = data;
     data &= v;
@@ -347,7 +350,8 @@ struct DeterministicAtomic {
     return rv;
   }
 
-  T fetch_or(T v, std::memory_order mo = std::memory_order_seq_cst) noexcept {
+  T fetch_or(T v,
+             std::memory_order /* mo */ = std::memory_order_seq_cst) noexcept {
     DeterministicSchedule::beforeSharedAccess();
     T rv = data;
     data |= v;
@@ -366,7 +370,8 @@ struct DeterministicAtomic {
     return rv;
   }
 
-  T fetch_xor(T v, std::memory_order mo = std::memory_order_seq_cst) noexcept {
+  T fetch_xor(T v,
+              std::memory_order /* mo */ = std::memory_order_seq_cst) noexcept {
     DeterministicSchedule::beforeSharedAccess();
     T rv = data;
     data ^= v;
index e9074eb0e2da090072e2cbfb54221e4bcf35e11e..7002ab34134d43a04141bd602ea9a97ba3c3ea47 100644 (file)
@@ -68,10 +68,10 @@ TEST(DiscriminatedPtr, Basic) {
 TEST(DiscriminatedPtr, Apply) {
   struct Foo { };
   struct Visitor {
-    std::string operator()(int* ptr) { return "int"; }
-    std::string operator()(const int* ptr) { return "const int"; }
-    std::string operator()(Foo* ptr) { return "Foo"; }
-    std::string operator()(const Foo* ptr) { return "const Foo"; }
+    std::string operator()(int* /* ptr */) { return "int"; }
+    std::string operator()(const int* /* ptr */) { return "const int"; }
+    std::string operator()(Foo* /* ptr */) { return "Foo"; }
+    std::string operator()(const Foo* /* ptr */) { return "const Foo"; }
   };
 
   typedef DiscriminatedPtr<int, Foo> Ptr;
@@ -94,10 +94,10 @@ TEST(DiscriminatedPtr, Apply) {
 TEST(DiscriminatedPtr, ApplyVoid) {
   struct Foo { };
   struct Visitor {
-    void operator()(int* ptr) { result = "int"; }
-    void operator()(const int* ptr) { result = "const int"; }
-    void operator()(Foo* ptr) { result = "Foo"; }
-    void operator()(const Foo* ptr) { result = "const Foo"; }
+    void operator()(int* /* ptr */) { result = "int"; }
+    void operator()(const int* /* ptr */) { result = "const int"; }
+    void operator()(Foo* /* ptr */) { result = "Foo"; }
+    void operator()(const Foo* /* ptr */) { result = "const Foo"; }
 
     std::string result;
   };
index 71a91599e4c5e0ba5f6eec1f62beed448222e5e1..9c1497fb3649e80d6c90ce29544c830509e276d5 100644 (file)
@@ -183,9 +183,7 @@ TEST(ExceptionWrapper, with_exception_test) {
   // Test with const this.  If this compiles and does not crash due to
   // infinite loop when it runs, it succeeds.
   const exception_wrapper& cew = ew;
-  cew.with_exception([&](const IntException& ie) {
-      SUCCEED();
-    });
+  cew.with_exception([&](const IntException& /* ie */) { SUCCEED(); });
 
   // This won't even compile.  You can't use a function which takes a
   // non-const reference with a const exception_wrapper.
index e44fd001426b2fe458357bdf8d3041fd5bd42a08..356c46d7c7c2a35bc7b32a88eb8fbf7847dabccf 100644 (file)
@@ -21,9 +21,7 @@
  * override-include-guard
  */
 
-void BENCHFUN(initRNG)(size_t iters, size_t) {
-  srand(seed);
-}
+void BENCHFUN(initRNG)(size_t /* iters */, size_t) { srand(seed); }
 BENCHMARK_PARAM(BENCHFUN(initRNG), 0);
 
 void BENCHFUN(defaultCtor)(size_t iters, size_t) {
@@ -119,7 +117,7 @@ void BENCHFUN(resize)(size_t iters, size_t arg) {
 }
 BENCHMARK_PARAM(BENCHFUN(resize), 524288);
 
-void BENCHFUN(findSuccessful)(size_t iters, size_t arg) {
+void BENCHFUN(findSuccessful)(size_t iters, size_t /* arg */) {
   size_t pos, len;
   STRING s;
 
@@ -158,7 +156,7 @@ expect to get a call for an interview.";
 }
 BENCHMARK_PARAM(BENCHFUN(findSuccessful), 524288);
 
-void BENCHFUN(findUnsuccessful)(size_t iters, size_t arg) {
+void BENCHFUN(findUnsuccessful)(size_t iters, size_t /* arg */) {
   STRING s, s1;
 
   BENCHMARK_SUSPEND {
index 1803df61486adb328b468dfbe2bd79dfd0a6c29c..ee3c2bcd193fbb91b7ce1d428e2eea791be2e2f0 100644 (file)
@@ -56,7 +56,7 @@ void randomString(String* toFill, unsigned int maxSize = 1000) {
 }
 
 template <class String, class Integral>
-void Num2String(String& str, Integral n) {
+void Num2String(String& str, Integral /* n */) {
   str.resize(10, '\0');
   sprintf(&str[0], "%ul", 10);
   str.resize(strlen(str.c_str()));
index ef3c69183b6d3f67bf5712feb0ccc9240a94035a..b2cfa6431b2e9da5c888936351ba4b0cc1e63807 100644 (file)
@@ -56,7 +56,7 @@ void randomString(String* toFill, unsigned int maxSize = 1000) {
 }
 
 template <class String, class Integral>
-void Num2String(String& str, Integral n) {
+void Num2String(String& str, Integral /* n */) {
   str.resize(10, '\0');
   sprintf(&str[0], "%ul", 10);
   str.resize(strlen(str.c_str()));
index d9e80a4aa21f69e8df3035633f1e98d6fafa3354..4cd6ec52020d986088d8b21fb254e83c0003f0ca 100644 (file)
@@ -349,7 +349,7 @@ BENCHMARK_PARAM(BENCHFUN(pushBack), 10240);
 BENCHMARK_PARAM(BENCHFUN(pushBack), 102400);
 BENCHMARK_PARAM(BENCHFUN(pushBack), 512000);
 
-void BENCHFUN(reserve)(int iters, int size) {
+void BENCHFUN(reserve)(int iters, int /* size */) {
   auto const obj = randomObject<VECTOR::value_type>();
   VECTOR v(random(0U, 10000U), obj);
   FOR_EACH_RANGE (i, 0, iters) {
@@ -360,7 +360,7 @@ BENCHMARK_PARAM(BENCHFUN(reserve), 128);
 BENCHMARK_PARAM(BENCHFUN(reserve), 1024);
 BENCHMARK_PARAM(BENCHFUN(reserve), 10240);
 
-void BENCHFUN(insert)(int iters, int size) {
+void BENCHFUN(insert)(int iters, int /* size */) {
   auto const obj1 = randomObject<VECTOR::value_type>();
   auto const obj2 = randomObject<VECTOR::value_type>();
   VECTOR v(random(0U, 1U), obj1);
@@ -370,7 +370,7 @@ void BENCHFUN(insert)(int iters, int size) {
 }
 BENCHMARK_PARAM(BENCHFUN(insert), 100);
 
-void BENCHFUN(erase)(int iters, int size) {
+void BENCHFUN(erase)(int iters, int /* size */) {
   auto const obj1 = randomObject<VECTOR::value_type>();
   VECTOR v(random(0U, 100U), obj1);
   FOR_EACH_RANGE (i, 0, iters) {
index 8fe88f0e2a324065bf0b6b9a351acb48face8b5c..5cf0d25d31992fef21b75eaec7eb28ec10625376 100644 (file)
@@ -83,7 +83,7 @@ ssize_t Reader::nextSize() {
   return n;
 }
 
-ssize_t Reader::operator()(int fd, void* buf, size_t count) {
+ssize_t Reader::operator()(int /* fd */, void* buf, size_t count) {
   ssize_t n = nextSize();
   if (n <= 0) {
     return n;
@@ -101,7 +101,7 @@ ssize_t Reader::operator()(int fd, void* buf, size_t count, off_t offset) {
   return operator()(fd, buf, count);
 }
 
-ssize_t Reader::operator()(int fd, const iovec* iov, int count) {
+ssize_t Reader::operator()(int /* fd */, const iovec* iov, int count) {
   ssize_t n = nextSize();
   if (n <= 0) {
     return n;
index e606a24e9872b16883ecbe500d11052182c96108..18854a2abd97e6a62a180ae0ae0e98870fb2ec38 100644 (file)
@@ -536,24 +536,25 @@ struct Lifecycle {
     ++lc_counts[DEFAULT_CONSTRUCTOR];
   }
 
-  explicit Lifecycle(int n, char const* s) noexcept : constructed(true) {
+  explicit Lifecycle(int /* n */, char const* /* s */) noexcept
+      : constructed(true) {
     ++lc_counts[TWO_ARG_CONSTRUCTOR];
   }
 
-  Lifecycle(const Lifecycle& rhs) noexcept : constructed(true) {
+  Lifecycle(const Lifecycle& /* rhs */) noexcept : constructed(true) {
     ++lc_counts[COPY_CONSTRUCTOR];
   }
 
-  Lifecycle(Lifecycle&& rhs) noexcept : constructed(true) {
+  Lifecycle(Lifecycle&& /* rhs */) noexcept : constructed(true) {
     ++lc_counts[MOVE_CONSTRUCTOR];
   }
 
-  Lifecycle& operator= (const Lifecycle& rhs) noexcept {
+  Lifecycle& operator=(const Lifecycle& /* rhs */) noexcept {
     ++lc_counts[COPY_OPERATOR];
     return *this;
   }
 
-  Lifecycle& operator= (Lifecycle&& rhs) noexcept {
+  Lifecycle& operator=(Lifecycle&& /* rhs */) noexcept {
     ++lc_counts[MOVE_OPERATOR];
     return *this;
   }
index 19611069613e166ef702ed460115330285feab30..db660528a718e0ed49166083d0611c023f1b2a62 100644 (file)
@@ -204,7 +204,7 @@ void BM_ProducerConsumerAffinity(int iters, int size) {
   delete test;
 }
 
-void BM_ProducerConsumerLatency(int iters, int size) {
+void BM_ProducerConsumerLatency(int /* iters */, int size) {
   BenchmarkSuspender susp;
   CHECK_GT(size, 0);
   LatencyTest<LatencyQueueType> *test =
index 6ade4a1abe5670d1c55163759938c05a985dcff3..0011fb719483e09e3646f7ea2b6b3412ecf533dd 100644 (file)
@@ -205,7 +205,7 @@ void correctnessTestType(const std::string& type) {
 struct DtorChecker {
   static unsigned int numInstances;
   DtorChecker() { ++numInstances; }
-  DtorChecker(const DtorChecker& o) { ++numInstances; }
+  DtorChecker(const DtorChecker& /* o */) { ++numInstances; }
   ~DtorChecker() { --numInstances; }
 };
 
index 0d4909791dd6ef7ad5fd6361dda71f9705c4196a..106f6b19c8dc20ecab39d88f16e72c878a7b6476 100644 (file)
@@ -111,14 +111,15 @@ TEST(ThreadLocalPtr, CreateOnThreadExit) {
   ThreadLocalPtr<int> tl;
 
   std::thread([&] {
-      tl.reset(new int(1), [&] (int* ptr, TLPDestructionMode mode) {
-        delete ptr;
-        // This test ensures Widgets allocated here are not leaked.
-        ++w.get()->val_;
-        ThreadLocal<Widget> wl;
-        ++wl.get()->val_;
-      });
-    }).join();
+    tl.reset(new int(1),
+             [&](int* ptr, TLPDestructionMode /* mode */) {
+               delete ptr;
+               // This test ensures Widgets allocated here are not leaked.
+               ++w.get()->val_;
+               ThreadLocal<Widget> wl;
+               ++wl.get()->val_;
+             });
+  }).join();
   EXPECT_EQ(2, Widget::totalVal_);
 }
 
index 07c08105e0438fe4ace9a65b3d8675d67f2508d4..c7ab9273bfcb7ce5f7f98eff1c935d24364abae0 100644 (file)
@@ -24,10 +24,8 @@ TEST(TimeoutQueue, Simple) {
   EventVec events;
 
   TimeoutQueue q;
-  TimeoutQueue::Callback cb =
-    [&events](TimeoutQueue::Id id, int64_t now) {
-      events.push_back(id);
-    };
+  TimeoutQueue::Callback cb = [&events](
+      TimeoutQueue::Id id, int64_t /* now */) { events.push_back(id); };
 
   EXPECT_EQ(1, q.add(0, 10, cb));
   EXPECT_EQ(2, q.add(0, 11, cb));
@@ -51,12 +49,12 @@ TEST(TimeoutQueue, Erase) {
 
   TimeoutQueue q;
   TimeoutQueue::Callback cb =
-    [&events, &q](TimeoutQueue::Id id, int64_t now) {
-      events.push_back(id);
-      if (id == 2) {
-        q.erase(1);
-      }
-    };
+      [&events, &q](TimeoutQueue::Id id, int64_t /* now */) {
+        events.push_back(id);
+        if (id == 2) {
+          q.erase(1);
+        }
+      };
 
   EXPECT_EQ(1, q.addRepeating(0, 10, cb));
   EXPECT_EQ(2, q.add(0, 35, cb));
@@ -74,11 +72,11 @@ TEST(TimeoutQueue, RunOnceRepeating) {
   int count = 0;
   TimeoutQueue q;
   TimeoutQueue::Callback cb =
-    [&count, &q](TimeoutQueue::Id id, int64_t now) {
-      if (++count == 100) {
-        EXPECT_TRUE(q.erase(id));
-      }
-    };
+      [&count, &q](TimeoutQueue::Id id, int64_t /* now */) {
+        if (++count == 100) {
+          EXPECT_TRUE(q.erase(id));
+        }
+      };
 
   EXPECT_EQ(1, q.addRepeating(0, 0, cb));
 
index 76b20ef50e4dd642bbdd6088dc506147369ccc0d..633ee63dd14eb6cdc2ae2708bdbff7f3541cbbc2 100644 (file)
@@ -71,9 +71,7 @@ struct NontrivialType {
     ++ctored;
   }
 
-  NontrivialType(NontrivialType const& s) {
-    ++ctored;
-  }
+  NontrivialType(NontrivialType const& /* s */) { ++ctored; }
 
   NontrivialType& operator=(NontrivialType const& o) {
     a = o.a;
@@ -116,7 +114,7 @@ struct Thrower {
     --alive;
   }
 
-  Thrower& operator=(Thrower const& other) {
+  Thrower& operator=(Thrower const& /* other */) {
     EXPECT_EQ(magic, kMagic);
     MaybeThrow();
     return *this;