[Piglit] [PATCH 7/7] cmake: Warn when variable length arrays are used.

jfonseca at vmware.com jfonseca at vmware.com
Fri Nov 7 06:21:30 PST 2014


From: José Fonseca <jfonseca at vmware.com>

As these are not supported on MSVC, not even MSVC 2013 since it only has
library support for C99, it doesn't actually support C99 syntax.

Suggested by Jan Vesely.
---
 CMakeLists.txt | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 50e8cc8..d1792d0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -222,7 +222,11 @@ if (NOT MSVC)
 	CHECK_C_COMPILER_FLAG("-Wdeclaration-after-statement" C_COMPILER_FLAG_WDECL_AFTER_STMT)
 	IF (C_COMPILER_FLAG_WDECL_AFTER_STMT)
 		SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wdeclaration-after-statement")
-	ENDIF (C_COMPILER_FLAG_WDECL_AFTER_STMT)
+	ENDIF ()
+	CHECK_C_COMPILER_FLAG("-Wvla" C_COMPILER_FLAG_WDECL_AFTER_STMT)
+	IF (C_COMPILER_FLAG_WDECL_AFTER_STMT)
+		SET (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wvla")
+	ENDIF ()
 
 	CHECK_CXX_COMPILER_FLAG("-Wno-narrowing" CXX_COMPILER_FLAG_WNO_NARROWING)
 	IF (CXX_COMPILER_FLAG_WNO_NARROWING)
-- 
1.9.1



More information about the Piglit mailing list