Skip to content

Commit 522f3e4

Browse files
committed
CMakeLists: increase strict aliasing level to 3
The strict aliasing rules disallow dereferencing the pointer to a variable of a certain type as another type, which is frequently used e.g. when casting structs to their base type. We currently have the warning level for strict aliasing rules set to `2`, which is described by gcc(1) as being "Aggressive, quick, not too precise." And in fact, we experience quite a lot of warnings when doing a release build due to that. GCC provides multiple levels, where higher levels are more accurate, but also slower due to the additional analysis required. Still, we want to have warning level 3 instead of 2 to avoid the current warnings we have in the Travis CI release builds. As this is the default warning level when no level is passed to `-Wstrict-aliasing`, we can just remove the level and use that default.
1 parent 84f03b3 commit 522f3e4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ ELSE ()
218218

219219
ENABLE_WARNINGS(documentation)
220220
DISABLE_WARNINGS(missing-field-initializers)
221-
ENABLE_WARNINGS(strict-aliasing=2)
221+
ENABLE_WARNINGS(strict-aliasing)
222222
ENABLE_WARNINGS(strict-prototypes)
223223
ENABLE_WARNINGS(declaration-after-statement)
224224
DISABLE_WARNINGS(unused-const-variable)

0 commit comments

Comments
 (0)