From 40857a36f39d1277fa0c117a794d95908ad8e9b2 Mon Sep 17 00:00:00 2001 From: Gustavo Serra Scalet Date: Tue, 2 Aug 2016 17:04:52 -0700 Subject: [PATCH] Fix compiler warnings MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 | 2 -- folly/io/async/AsyncSocket.cpp | 7 +++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/folly/fibers/FiberManager.cpp b/folly/fibers/FiberManager.cpp index 783f241a..64b5b9d5 100644 --- a/folly/fibers/FiberManager.cpp +++ b/folly/fibers/FiberManager.cpp @@ -120,8 +120,6 @@ Fiber* FiberManager::getFiber() { maxFibersActiveLastPeriod_ = fibersActive_; } ++fiberId_; - bool recordStack = (options_.recordStackEvery != 0) && - (fiberId_ % options_.recordStackEvery == 0); return fiber; } diff --git a/folly/io/async/AsyncSocket.cpp b/folly/io/async/AsyncSocket.cpp index be71ee73..dd0caa37 100644 --- a/folly/io/async/AsyncSocket.cpp +++ b/folly/io/async/AsyncSocket.cpp @@ -19,6 +19,7 @@ #include #include #include +#include #include #include #include @@ -662,7 +663,13 @@ void AsyncSocket::writeChain(WriteCallback* callback, unique_ptr&& 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]; -- 2.34.1