Fix compiler warnings
authorGustavo Serra Scalet <gustavo.scalet@eldorado.org.br>
Wed, 3 Aug 2016 00:04:52 +0000 (17:04 -0700)
committerFacebook Github Bot 6 <facebook-github-bot-6-bot@fb.com>
Wed, 3 Aug 2016 00:08:29 +0000 (17:08 -0700)
Summary:
- unused variables
- suppressing "warning: variable length array ‘vec’ is used [-Wvla]"
Closes https://github.com/facebook/folly/pull/443

Reviewed By: djwatson

Differential Revision: D3641928

Pulled By: Orvid

fbshipit-source-id: 0bd58a75f8948f28cc2d232c03bd443734d9657d

folly/fibers/FiberManager.cpp
folly/io/async/AsyncSocket.cpp

index 783f241a021ade45cd96fe7027c9759c2e9489fa..64b5b9d5c2880ed36d44e796c0329c2ee0577ce1 100644 (file)
@@ -120,8 +120,6 @@ Fiber* FiberManager::getFiber() {
     maxFibersActiveLastPeriod_ = fibersActive_;
   }
   ++fiberId_;
-  bool recordStack = (options_.recordStackEvery != 0) &&
-      (fiberId_ % options_.recordStackEvery == 0);
   return fiber;
 }
 
index be71ee73309f701dfe18b11e7125388f2688a98e..dd0caa37609a7f2c13567d6754e7152f7176c7ef 100644 (file)
@@ -19,6 +19,7 @@
 #include <folly/ExceptionWrapper.h>
 #include <folly/SocketAddress.h>
 #include <folly/io/IOBuf.h>
+#include <folly/Portability.h>
 #include <folly/portability/Fcntl.h>
 #include <folly/portability/Sockets.h>
 #include <folly/portability/SysUio.h>
@@ -662,7 +663,13 @@ void AsyncSocket::writeChain(WriteCallback* callback, unique_ptr<IOBuf>&& buf,
   constexpr size_t kSmallSizeMax = 64;
   size_t count = buf->countChainElements();
   if (count <= kSmallSizeMax) {
+
+    // suppress "warning: variable length array ‘vec’ is used [-Wvla]"
+    FOLLY_PUSH_WARNING;
+    FOLLY_GCC_DISABLE_WARNING(vla);
     iovec vec[BOOST_PP_IF(FOLLY_HAVE_VLA, count, kSmallSizeMax)];
+    FOLLY_POP_WARNING;
+
     writeChainImpl(callback, vec, count, std::move(buf), flags);
   } else {
     iovec* vec = new iovec[count];