Build: Add -fno-delete-null-pointer-checks

This prevents GCC and Clang from deleting null pointer checks for
optimization purposes. I think we're strictly better off crashing
in those cases instead of the compiler hiding errors from us.
This commit is contained in:
Andreas Kling 2021-09-09 15:01:27 +02:00
parent 16105091ba
commit 619ee99c34

View file

@ -113,6 +113,9 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(-fsized-deallocation)
add_compile_options(-fno-delete-null-pointer-checks)
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
add_compile_options(-Wno-literal-suffix)
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Clang$")