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
This commit is contained in:
ISSOtm
2022-02-05 13:02:41 +01:00
committed by Eldred Habert
parent 7dc81a64d3
commit a48801a675
2 changed files with 26 additions and 18 deletions

View File

@@ -45,15 +45,19 @@ else()
endif() endif()
if(MORE_WARNINGS) if(MORE_WARNINGS)
add_compile_options(-Werror -Wextra -Wno-type-limits add_compile_options(-Werror -Wextra
-Wno-sign-compare -Wvla -Wformat -Wformat-security -Wformat-overflow=2 -Walloc-zero -Wcast-align -Wcast-qual -Wduplicated-cond
-Wformat-truncation=1 -Wformat-y2k -Wswitch-enum -Wunused -Wfloat-equal -Winline -Wlogical-op -Wnested-externs -Wold-style-definition
-Wuninitialized -Wunknown-pragmas -Wstrict-overflow=5 -Wstrict-overflow=5 -Wstrict-prototypes -Wundef -Wuninitialized -Wunused
-Wstringop-overflow=4 -Walloc-zero -Wduplicated-cond -Wshadow # TODO: -Wshadow=compatible-local ?
-Wfloat-equal -Wshadow -Wcast-qual -Wcast-align -Wlogical-op -Wstringop-overflow=4 # TODO: would work better with optimizations
-Wnested-externs -Wno-aggressive-loop-optimizations -Winline -Wno-sign-compare # TODO: fix those warnings
-Wundef -Wstrict-prototypes -Wold-style-definition -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1
-Wno-unknown-warning-option -Wno-tautological-constant-out-of-range-compare) -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()
endif() endif()

View File

@@ -209,17 +209,21 @@ checkdiff:
# This target is used during development in order to prevent adding new issues # 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 # to the source code. All warnings are treated as errors in order to block the
# compilation and make the continous integration infrastructure return failure. # compilation and make the continous integration infrastructure return failure.
# The rationale for some of the flags is documented in the CMakeLists.
develop: develop:
$Qenv ${MAKE} WARNFLAGS="-Werror -Wall -Wextra -Wpedantic -Wno-type-limits \ $Qenv ${MAKE} WARNFLAGS="-Werror -Wextra \
-Wno-sign-compare -Wvla -Wformat -Wformat-security -Wformat-overflow=2 \ -Walloc-zero -Wcast-align -Wcast-qual -Wduplicated-cond \
-Wformat-truncation=1 -Wformat-y2k -Wswitch-enum -Wunused \ -Wfloat-equal -Winline -Wlogical-op -Wnested-externs -Wold-style-definition \
-Wuninitialized -Wunknown-pragmas -Wstrict-overflow=4 \ -Wstrict-overflow=5 -Wstrict-prototypes -Wundef -Wuninitialized -Wunused \
-Wstringop-overflow=4 -Walloc-zero -Wduplicated-cond \ -Wshadow \
-Wfloat-equal -Wshadow -Wcast-qual -Wcast-align -Wlogical-op \ -Wstringop-overflow=4 \
-Wnested-externs -Wno-aggressive-loop-optimizations -Winline \ -Wno-sign-compare \
-Wundef -Wstrict-prototypes -Wold-style-definition \ -Wformat=2 -Wformat-overflow=2 -Wformat-truncation=1 \
-Wno-unknown-warning-option -Wno-tautological-constant-out-of-range-compare \ -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=shift -fsanitize=integer-divide-by-zero \
-fsanitize=unreachable -fsanitize=vla-bound \ -fsanitize=unreachable -fsanitize=vla-bound \
-fsanitize=signed-integer-overflow -fsanitize=bounds \ -fsanitize=signed-integer-overflow -fsanitize=bounds \