Skip to content

Commit

Permalink
Enable warnings for violations of strict aliasing rules
Browse files Browse the repository at this point in the history
  • Loading branch information
generalmimon committed May 4, 2024
1 parent 25ea924 commit 1de8362
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion Common.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,14 @@ endif()
# This method was taken from https://www.pragmaticlinux.com/2022/07/enable-compiler-warnings-with-cmake/
target_compile_options(${PROJECT_NAME} PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic -Werror>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:
-Wall -Wextra -Wpedantic -Werror
# See <https://gcc.gnu.org/onlinedocs/gcc/Warning-Options.html#index-Wstrict-aliasing_003dn>:
#
# > Level 1: (...) it has very few false negatives. However, it has many false positives.
#
# If we encounter into false positives in the future, we can increase the level, but let's
# start with the most aggressive option to make sure we don't miss anything.
-fstrict-aliasing -Wstrict-aliasing=1
>
)

0 comments on commit 1de8362

Please sign in to comment.