From: Jesse Williamson Date: Sun, 28 May 2017 12:24:26 +0000 (-0700) Subject: Adds C++ warning flag for C Variable-Length Arrays. X-Git-Tag: ses5-milestone6~9^2~24^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=de4d1113058445f04652e24a734dae35e12552ca;p=ceph.git Adds C++ warning flag for C Variable-Length Arrays. C VLAs are not supported in C++. However, the GNU compiler allows them as an extension, which it does not warn about when not in pedantic mode. Unfortunately, it's easy to accidentally write a VLA, even unintentionally-- adding this warning will help us catch that. Signed-off-by: Jesse Williamson --- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4506d2fdfd8..823627e9662 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -34,6 +34,7 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Werror=format-security -fno set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftemplate-depth-1024 -Wno-invalid-offsetof") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wnon-virtual-dtor") +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wvla") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unknown-pragmas") if(CMAKE_CXX_COMPILER_ID STREQUAL GNU)