ref: a48801a675938f4312b5c1bf3b869ca7beaacac9
parent: 7dc81a64d3d41667252ffe00a84571cc1a9be2fd
author: ISSOtm <[email protected]>
date: Sat Feb 5 08:02:41 EST 2022
Trim down `develop` warning list and add comments Remove already-enabled warnings as pointed out by #969 Comments added to the CMakeLists because the Makefile format does not really allow them "Plain" list also sorted alphabetically, the rest (somewhat) thematically
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -45,15 +45,19 @@
endif()
if(MORE_WARNINGS)
- add_compile_options(-Werror -Wextra -Wno-type-limits
- -Wno-sign-compare -Wvla -Wformat -Wformat-security -Wformat-overflow=2
- -Wformat-truncation=1 -Wformat-y2k -Wswitch-enum -Wunused
- -Wuninitialized -Wunknown-pragmas -Wstrict-overflow=5
- -Wstringop-overflow=4 -Walloc-zero -Wduplicated-cond
- -Wfloat-equal -Wshadow -Wcast-qual -Wcast-align -Wlogical-op
- -Wnested-externs -Wno-aggressive-loop-optimizations -Winline
- -Wundef -Wstrict-prototypes -Wold-style-definition
- -Wno-unknown-warning-option -Wno-tautological-constant-out-of-range-compare)
+ add_compile_options(-Werror -Wextra
+ -Walloc-zero -Wcast-align -Wcast-qual -Wduplicated-cond
+ -Wfloat-equal -Winline -Wlogical-op -Wnested-externs -Wold-style-definition
+ -Wstrict-overflow=5 -Wstrict-prototypes -Wundef -Wuninitialized -Wunused
+ -Wshadow # TODO: -Wshadow=compatible-local ?
+ -Wstringop-overflow=4 # TODO: would work better with optimizations
+ -Wno-sign-compare # TODO: fix those warnings
+ -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1
+ -Wno-format-nonliteral # We have a couple of "dynamic" prints
+ # We do some range checks that are always false on some platforms (GCC, Clang)
+ -Wno-type-limits -Wno-tautological-constant-out-of-range-compare
+ -Wvla # MSVC does not support VLAs
+ -Wno-unknown-warning-option) # Clang shouldn't diagnose unknown warnings
endif()
endif()
--- a/Makefile
+++ b/Makefile
@@ -209,17 +209,21 @@
# This target is used during development in order to prevent adding new issues
# to the source code. All warnings are treated as errors in order to block the
# compilation and make the continous integration infrastructure return failure.
+# The rationale for some of the flags is documented in the CMakeLists.
develop:
- $Qenv ${MAKE} WARNFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-type-limits \
- -Wno-sign-compare -Wvla -Wformat -Wformat-security -Wformat-overflow=2 \
- -Wformat-truncation=1 -Wformat-y2k -Wswitch-enum -Wunused \
- -Wuninitialized -Wunknown-pragmas -Wstrict-overflow=4 \
- -Wstringop-overflow=4 -Walloc-zero -Wduplicated-cond \
- -Wfloat-equal -Wshadow -Wcast-qual -Wcast-align -Wlogical-op \
- -Wnested-externs -Wno-aggressive-loop-optimizations -Winline \
- -Wundef -Wstrict-prototypes -Wold-style-definition \
- -Wno-unknown-warning-option -Wno-tautological-constant-out-of-range-compare \
+ $Qenv ${MAKE} WARNFLAGS="-Werror -Wextra \
+ -Walloc-zero -Wcast-align -Wcast-qual -Wduplicated-cond \
+ -Wfloat-equal -Winline -Wlogical-op -Wnested-externs -Wold-style-definition \
+ -Wstrict-overflow=5 -Wstrict-prototypes -Wundef -Wuninitialized -Wunused \
+ -Wshadow \
+ -Wstringop-overflow=4 \
+ -Wno-sign-compare \
+ -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1 \
+ -Wno-format-nonliteral \
+ -Wno-type-limits -Wno-tautological-constant-out-of-range-compare \
+ -Wvla \
+ -Wno-unknown-warning-option \
-fsanitize=shift -fsanitize=integer-divide-by-zero \
-fsanitize=unreachable -fsanitize=vla-bound \
-fsanitize=signed-integer-overflow -fsanitize=bounds \