From 8aa1b702cd6d1ed288f32f9fe9393b66d152116f Mon Sep 17 00:00:00 2001 From: Jason Rhinelander Date: Mon, 1 Mar 2021 20:04:05 -0400 Subject: [PATCH] Disallow evil compilation -fpermissive allows nasty things that are (apparently) needed on Windows, so only enable it there. vla are evil, so don't just warn but error on it. remove duplicate -Wno-unknown-pragmas --- CMakeLists.txt | 9 ++++----- cmake/win32.cmake | 1 + 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 591a78ba2..4cd1f6877 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -212,11 +212,10 @@ if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") endif() if (NOT MSVC_VERSION) - add_compile_options(-Wall -Wextra -Wno-unknown-pragmas) - # vla are evil - add_compile_options(-Wvla) - add_compile_options($<$:-fpermissive>) - add_compile_options(-Wno-unused-function -Wno-deprecated-declarations -Wno-unknown-pragmas) + add_compile_options(-Wall -Wextra -Wno-unknown-pragmas) + # vla are evil + add_compile_options(-Werror=vla) + add_compile_options(-Wno-unused-function -Wno-deprecated-declarations) endif() include(cmake/coverage.cmake) diff --git a/cmake/win32.cmake b/cmake/win32.cmake index 7757a3e2f..cf9488531 100644 --- a/cmake/win32.cmake +++ b/cmake/win32.cmake @@ -9,6 +9,7 @@ set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) if(NOT MSVC_VERSION) add_compile_options($<$:-Wno-bad-function-cast>) add_compile_options($<$:-Wno-cast-function-type>) + add_compile_options($<$:-fpermissive>) # unlike unix where you get a *single* compiler ID string in .comment # GNU ld sees fit to merge *all* the .ident sections in object files # to .r[o]data section one after the other!