Commit 7f258ae5 authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Avoid assuming that FOLLY_HAVE_VLA is defined

Summary:
[Folly] Avoid assuming that `FOLLY_HAVE_VLA` is defined.

Treat undefined as meaning `0` rather than requiring it be defined to either `0` or `1`.

Closes #773.

Reviewed By: andrewjcg

Differential Revision: D7028174

fbshipit-source-id: 90c52a3c5b640776f728c70b69f0500749d7ab7f
parent 3af93759
...@@ -33,6 +33,12 @@ ...@@ -33,6 +33,12 @@
#include <sys/types.h> #include <sys/types.h>
#include <thread> #include <thread>
#if FOLLY_HAVE_VLA
#define FOLLY_HAVE_VLA_01 1
#else
#define FOLLY_HAVE_VLA_01 0
#endif
using std::string; using std::string;
using std::unique_ptr; using std::unique_ptr;
...@@ -983,7 +989,7 @@ void AsyncSocket::writeChain(WriteCallback* callback, unique_ptr<IOBuf>&& buf, ...@@ -983,7 +989,7 @@ void AsyncSocket::writeChain(WriteCallback* callback, unique_ptr<IOBuf>&& buf,
// suppress "warning: variable length array 'vec' is used [-Wvla]" // suppress "warning: variable length array 'vec' is used [-Wvla]"
FOLLY_PUSH_WARNING FOLLY_PUSH_WARNING
FOLLY_GCC_DISABLE_WARNING("-Wvla") FOLLY_GCC_DISABLE_WARNING("-Wvla")
iovec vec[BOOST_PP_IF(FOLLY_HAVE_VLA, count, kSmallSizeMax)]; iovec vec[BOOST_PP_IF(FOLLY_HAVE_VLA_01, count, kSmallSizeMax)];
FOLLY_POP_WARNING FOLLY_POP_WARNING
writeChainImpl(callback, vec, count, std::move(buf), flags); writeChainImpl(callback, vec, count, std::move(buf), flags);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment