summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2018-02-16 10:50:54 +0000
committerPatrick Steinhardt <ps@pks.im>2018-02-16 11:08:10 +0000
commit522f3e4b4bedf9e4226f5e16498934b26d80dfbc (patch)
tree4ef5fada8057033fde06f52da9c139a711a40c2e
parent84f03b3af0b8a4e2aa38ab106a17dff183b2c977 (diff)
downloadlibgit2-522f3e4b4bedf9e4226f5e16498934b26d80dfbc.tar.gz
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.
-rw-r--r--CMakeLists.txt2
1 files changed, 1 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 53f10ba94..2e98bbc76 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -218,7 +218,7 @@ ELSE ()
ENABLE_WARNINGS(documentation)
DISABLE_WARNINGS(missing-field-initializers)
- ENABLE_WARNINGS(strict-aliasing=2)
+ ENABLE_WARNINGS(strict-aliasing)
ENABLE_WARNINGS(strict-prototypes)
ENABLE_WARNINGS(declaration-after-statement)
DISABLE_WARNINGS(unused-const-variable)