CMake: make unsequenced modifications an error

They not only result in discrepancies between different compiler,
but trigger undefined behavior. Avoid them by having them break
the CMake build and CI.
This commit is contained in:
Ahmad Fatoum 2019-05-04 23:10:17 +02:00
parent 43bfb979e5
commit 23c1c0bdb2
No known key found for this signature in database
GPG Key ID: C3EAC3DE9321D59B
1 changed files with 1 additions and 0 deletions

View File

@ -19,6 +19,7 @@ endif()
include(AddIfFlagCompiles) include(AddIfFlagCompiles)
add_if_flag_compiles(-Werror=pointer-arith CMAKE_C_FLAGS) add_if_flag_compiles(-Werror=pointer-arith CMAKE_C_FLAGS)
add_if_flag_compiles(-Werror=implicit-function-declaration CMAKE_C_FLAGS) add_if_flag_compiles(-Werror=implicit-function-declaration CMAKE_C_FLAGS)
add_if_flag_compiles(-Werror=unsequenced CMAKE_C_FLAGS)
# src/external/jar_xm.h does shady stuff # src/external/jar_xm.h does shady stuff
add_if_flag_compiles(-fno-strict-aliasing CMAKE_C_FLAGS) add_if_flag_compiles(-fno-strict-aliasing CMAKE_C_FLAGS)