🔧 add more warning flags from GCC 10

pull/2153/head
Niels Lohmann 2020-05-28 12:53:22 +02:00
parent bb9619ef8b
commit fcda998ee2
No known key found for this signature in database
GPG Key ID: 7F3CEA63AE251B69
1 changed files with 250 additions and 223 deletions

View File

@ -116,7 +116,7 @@ pedantic_clang:
-Wno-padded \
-Wno-range-loop-analysis \
-Wno-switch-enum -Wno-covered-switch-default \
-Wno-weak-vtables" cmake -S . -B build_pedantic -GNinja -DCMAKE_BUILD_TYPE=Debug -DJSON_MultipleHeaders=ON
-Wno-weak-vtables" cmake -S . -B build_pedantic -GNinja -DCMAKE_BUILD_TYPE=Debug -DJSON_MultipleHeaders=ON -DJSON_BuildTests=On
cmake --build build_pedantic
# calling GCC with most warnings
@ -124,13 +124,33 @@ pedantic_gcc:
rm -fr build_pedantic
CXXFLAGS=" \
-std=c++11 \
-Werror \
-Wno-abi-tag \
-Waddress \
-Waddress-of-packed-member \
-Wno-aggregate-return \
-Waggressive-loop-optimizations \
-Waligned-new=all \
-Wall \
-Walloc-zero \
-Walloca \
-Wanalyzer-double-fclose \
-Wanalyzer-double-free \
-Wanalyzer-exposure-through-output-file \
-Wanalyzer-file-leak \
-Wanalyzer-free-of-non-heap \
-Wanalyzer-malloc-leak \
-Wanalyzer-null-argument \
-Wanalyzer-null-dereference \
-Wanalyzer-possible-null-argument \
-Wanalyzer-possible-null-dereference \
-Wanalyzer-stale-setjmp-buffer \
-Wanalyzer-tainted-array-index \
-Wanalyzer-too-complex \
-Wanalyzer-unsafe-call-within-signal-handler \
-Wanalyzer-use-after-free \
-Wanalyzer-use-of-pointer-in-stale-stack-frame \
-Warith-conversion \
-Warray-bounds \
-Warray-bounds=2 \
-Wattribute-alias=2 \
@ -140,8 +160,13 @@ pedantic_gcc:
-Wbool-operation \
-Wbuiltin-declaration-mismatch \
-Wbuiltin-macro-redefined \
-Wc++11-compat \
-Wc++14-compat \
-Wc++17-compat \
-Wc++20-compat \
-Wcannot-profile \
-Wcast-align \
-Wcast-align=strict \
-Wcast-function-type \
-Wcast-qual \
-Wcatch-value=3 \
@ -149,8 +174,8 @@ pedantic_gcc:
-Wclass-conversion \
-Wclass-memaccess \
-Wclobbered \
-Wcomma-subscript \
-Wcomment \
-Wcomments \
-Wconditionally-supported \
-Wconversion \
-Wconversion-null \
@ -175,20 +200,20 @@ pedantic_gcc:
-Wendif-labels \
-Wenum-compare \
-Wexpansion-to-defined \
-Werror \
-Wextra \
-Wextra-semi \
-Wfloat-conversion \
-Wformat \
-Wformat-contains-nul \
-Wformat-extra-args \
-Wformat-nonliteral \
-Wfloat-equal \
-Wformat -Wformat-contains-nul \
-Wformat -Wformat-extra-args \
-Wformat -Wformat-nonliteral \
-Wformat -Wformat-security \
-Wformat -Wformat-y2k \
-Wformat -Wformat-zero-length \
-Wformat-diag \
-Wformat-overflow=2 \
-Wformat-security \
-Wformat-signedness \
-Wformat-truncation=2 \
-Wformat-y2k \
-Wformat-zero-length \
-Wformat=2 \
-Wframe-address \
-Wfree-nonheap-object \
@ -197,6 +222,7 @@ pedantic_gcc:
-Wignored-attributes \
-Wignored-qualifiers \
-Wimplicit-fallthrough=5 \
-Winaccessible-base \
-Winherited-variadic-ctor \
-Winit-list-lifetime \
-Winit-self \
@ -209,33 +235,25 @@ pedantic_gcc:
-Wliteral-suffix \
-Wlogical-not-parentheses \
-Wlogical-op \
-Wno-long-long \
-Wlto-type-mismatch \
-Wmain \
-Wmaybe-uninitialized \
-Wmemset-elt-size \
-Wmemset-transposed-args \
-Wmisleading-indentation \
-Wmismatched-tags \
-Wmissing-attributes \
-Wmissing-braces \
-Wmissing-declarations \
-Wmissing-field-initializers \
-Wmissing-format-attribute \
-Wmissing-include-dirs \
-Wmissing-noreturn \
-Wmissing-profile \
-Wmultichar \
-Wmultiple-inheritance \
-Wmultistatement-macros \
-Wnarrowing \
-Wno-deprecated-declarations \
-Wno-float-equal \
-Wno-long-long \
-Wno-namespaces \
-Wno-padded \
-Wno-switch-enum \
-Wno-system-headers \
-Wno-templates \
-Wno-undef \
-Wnarrowing \
-Wno-noexcept \
-Wnoexcept-type \
-Wnon-template-friend \
@ -243,7 +261,7 @@ pedantic_gcc:
-Wnonnull \
-Wnonnull-compare \
-Wnonportable-cfstrings \
-Wnormalized \
-Wnormalized=nfkc \
-Wnull-dereference \
-Wodr \
-Wold-style-cast \
@ -254,6 +272,7 @@ pedantic_gcc:
-Wpacked \
-Wpacked-bitfield-compat \
-Wpacked-not-aligned \
-Wno-padded \
-Wparentheses \
-Wpedantic \
-Wpessimizing-move \
@ -266,6 +285,7 @@ pedantic_gcc:
-Wpsabi \
-Wredundant-decls \
-Wredundant-move \
-Wredundant-tags \
-Wregister \
-Wreorder \
-Wrestrict \
@ -273,11 +293,7 @@ pedantic_gcc:
-Wreturn-type \
-Wscalar-storage-order \
-Wsequence-point \
-Wshadow \
-Wshadow-compatible-local \
-Wshadow-local \
-Wshadow=compatible-local \
-Wshadow=global \
-Wshadow=local \
-Wshift-count-negative \
-Wshift-count-overflow \
@ -291,9 +307,13 @@ pedantic_gcc:
-Wsizeof-pointer-div \
-Wsizeof-pointer-memaccess \
-Wstack-protector \
-Wstrict-aliasing \
-Wstrict-aliasing=3 \
-Wstrict-null-sentinel \
-Wstrict-overflow \
-Wstrict-overflow=5 \
-Wstring-compare \
-Wstringop-overflow \
-Wstringop-overflow=4 \
-Wstringop-truncation \
-Wsubobject-linkage \
@ -309,14 +329,19 @@ pedantic_gcc:
-Wswitch \
-Wswitch-bool \
-Wswitch-default \
-Wno-switch-enum \
-Wswitch-outside-range \
-Wswitch-unreachable \
-Wsync-nand \
-Wsynth \
-Wno-system-headers \
-Wtautological-compare \
-Wno-templates \
-Wterminate \
-Wtrampolines \
-Wtrigraphs \
-Wtype-limits \
-Wundef \
-Wuninitialized \
-Wunknown-pragmas \
-Wunreachable-code \
@ -340,10 +365,12 @@ pedantic_gcc:
-Wvirtual-inheritance \
-Wvirtual-move-assign \
-Wvla \
-Wvolatile \
-Wvolatile-register-var \
-Wwrite-strings \
-Wzero-as-null-pointer-constant \
" cmake -S . -B build_pedantic -GNinja -DCMAKE_BUILD_TYPE=Debug -DJSON_MultipleHeaders=ON
-Wzero-length-bounds \
" cmake -S . -B build_pedantic -GNinja -DCMAKE_BUILD_TYPE=Debug -DJSON_MultipleHeaders=ON -DJSON_BuildTests=On
cmake --build build_pedantic
##########################################################################
@ -353,7 +380,7 @@ pedantic_gcc:
run_benchmarks:
rm -fr build_benchmarks
mkdir build_benchmarks
cd build_benchmarks ; cmake ../benchmarks -GNinja -DCMAKE_BUILD_TYPE=Release
cd build_benchmarks ; cmake ../benchmarks -GNinja -DCMAKE_BUILD_TYPE=Release -DJSON_BuildTests=On
cd build_benchmarks ; ninja
cd build_benchmarks ; ./json_benchmarks
@ -430,7 +457,7 @@ cppcheck:
clang_analyze:
rm -fr clang_analyze_build
mkdir clang_analyze_build
cd clang_analyze_build ; CCC_CXX=$(COMPILER_DIR)/clang++ CXX=$(COMPILER_DIR)/clang++ $(COMPILER_DIR)/scan-build cmake .. -GNinja
cd clang_analyze_build ; CCC_CXX=$(COMPILER_DIR)/clang++ CXX=$(COMPILER_DIR)/clang++ $(COMPILER_DIR)/scan-build cmake .. -GNinja -DJSON_BuildTests=On
cd clang_analyze_build ; \
$(COMPILER_DIR)/scan-build \
-enable-checker alpha.core.BoolAssignment,alpha.core.CallAndMessageUnInitRefArg,alpha.core.CastSize,alpha.core.CastToStruct,alpha.core.Conversion,alpha.core.DynamicTypeChecker,alpha.core.FixedAddr,alpha.core.PointerArithm,alpha.core.PointerSub,alpha.core.SizeofPtr,alpha.core.StackAddressAsyncEscape,alpha.core.TestAfterDivZero,alpha.deadcode.UnreachableCode,core.builtin.BuiltinFunctions,core.builtin.NoReturnFunctions,core.CallAndMessage,core.DivideZero,core.DynamicTypePropagation,core.NonnilStringConstants,core.NonNullParamChecker,core.NullDereference,core.StackAddressEscape,core.UndefinedBinaryOperatorResult,core.uninitialized.ArraySubscript,core.uninitialized.Assign,core.uninitialized.Branch,core.uninitialized.CapturedBlockVariable,core.uninitialized.UndefReturn,core.VLASize,cplusplus.InnerPointer,cplusplus.Move,cplusplus.NewDelete,cplusplus.NewDeleteLeaks,cplusplus.SelfAssignment,deadcode.DeadStores,nullability.NullableDereferenced,nullability.NullablePassedToNonnull,nullability.NullableReturnedFromNonnull,nullability.NullPassedToNonnull,nullability.NullReturnedFromNonnull \
@ -472,7 +499,7 @@ oclint:
clang_sanitize:
rm -fr clang_sanitize_build
mkdir clang_sanitize_build
cd clang_sanitize_build ; CXX=$(COMPILER_DIR)/clang++ cmake .. -DJSON_Sanitizer=On -DJSON_MultipleHeaders=ON -GNinja
cd clang_sanitize_build ; CXX=$(COMPILER_DIR)/clang++ cmake .. -DJSON_Sanitizer=On -DJSON_MultipleHeaders=ON -DJSON_BuildTests=On -GNinja
cd clang_sanitize_build ; ninja
cd clang_sanitize_build ; ctest -j10