From de4d1113058445f04652e24a734dae35e12552ca Mon Sep 17 00:00:00 2001 From: Jesse Williamson Date: Sun, 28 May 2017 05:24:26 -0700 Subject: [PATCH] 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 --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 4506d2fdfd89d..823627e966212 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) -- 2.39.5