🔧 add more warning flags from GCC 10

parent bb9619ef
...@@ -116,7 +116,7 @@ pedantic_clang: ...@@ -116,7 +116,7 @@ pedantic_clang:
-Wno-padded \ -Wno-padded \
-Wno-range-loop-analysis \ -Wno-range-loop-analysis \
-Wno-switch-enum -Wno-covered-switch-default \ -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 cmake --build build_pedantic
# calling GCC with most warnings # calling GCC with most warnings
...@@ -124,226 +124,253 @@ pedantic_gcc: ...@@ -124,226 +124,253 @@ pedantic_gcc:
rm -fr build_pedantic rm -fr build_pedantic
CXXFLAGS=" \ CXXFLAGS=" \
-std=c++11 \ -std=c++11 \
-Waddress \
-Waddress-of-packed-member \
-Waggressive-loop-optimizations \
-Waligned-new=all \
-Wall \
-Walloc-zero \
-Walloca \
-Warray-bounds \
-Warray-bounds=2 \
-Wattribute-alias=2 \
-Wattribute-warning \
-Wattributes \
-Wbool-compare \
-Wbool-operation \
-Wbuiltin-declaration-mismatch \
-Wbuiltin-macro-redefined \
-Wcannot-profile \
-Wcast-align \
-Wcast-function-type \
-Wcast-qual \
-Wcatch-value=3 \
-Wchar-subscripts \
-Wclass-conversion \
-Wclass-memaccess \
-Wclobbered \
-Wcomment \
-Wcomments \
-Wconditionally-supported \
-Wconversion \
-Wconversion-null \
-Wcoverage-mismatch \
-Wcpp \
-Wctor-dtor-privacy \
-Wdangling-else \
-Wdate-time \
-Wdelete-incomplete \
-Wdelete-non-virtual-dtor \
-Wdeprecated \
-Wdeprecated-copy \
-Wdeprecated-copy-dtor \
-Wdeprecated-declarations \
-Wdisabled-optimization \
-Wdiv-by-zero \
-Wdouble-promotion \
-Wduplicated-branches \
-Wduplicated-cond \
-Weffc++ \
-Wempty-body \
-Wendif-labels \
-Wenum-compare \
-Wexpansion-to-defined \
-Werror \ -Werror \
-Wextra \ -Wno-abi-tag \
-Wextra-semi \ -Waddress \
-Wfloat-conversion \ -Waddress-of-packed-member \
-Wformat \ -Wno-aggregate-return \
-Wformat-contains-nul \ -Waggressive-loop-optimizations \
-Wformat-extra-args \ -Waligned-new=all \
-Wformat-nonliteral \ -Wall \
-Wformat-overflow=2 \ -Walloc-zero \
-Wformat-security \ -Walloca \
-Wformat-signedness \ -Wanalyzer-double-fclose \
-Wformat-truncation=2 \ -Wanalyzer-double-free \
-Wformat-y2k \ -Wanalyzer-exposure-through-output-file \
-Wformat-zero-length \ -Wanalyzer-file-leak \
-Wformat=2 \ -Wanalyzer-free-of-non-heap \
-Wframe-address \ -Wanalyzer-malloc-leak \
-Wfree-nonheap-object \ -Wanalyzer-null-argument \
-Whsa \ -Wanalyzer-null-dereference \
-Wif-not-aligned \ -Wanalyzer-possible-null-argument \
-Wignored-attributes \ -Wanalyzer-possible-null-dereference \
-Wignored-qualifiers \ -Wanalyzer-stale-setjmp-buffer \
-Wimplicit-fallthrough=5 \ -Wanalyzer-tainted-array-index \
-Winherited-variadic-ctor \ -Wanalyzer-too-complex \
-Winit-list-lifetime \ -Wanalyzer-unsafe-call-within-signal-handler \
-Winit-self \ -Wanalyzer-use-after-free \
-Winline \ -Wanalyzer-use-of-pointer-in-stale-stack-frame \
-Wint-in-bool-context \ -Warith-conversion \
-Wint-to-pointer-cast \ -Warray-bounds \
-Winvalid-memory-model \ -Warray-bounds=2 \
-Winvalid-offsetof \ -Wattribute-alias=2 \
-Winvalid-pch \ -Wattribute-warning \
-Wliteral-suffix \ -Wattributes \
-Wlogical-not-parentheses \ -Wbool-compare \
-Wlogical-op \ -Wbool-operation \
-Wlto-type-mismatch \ -Wbuiltin-declaration-mismatch \
-Wmain \ -Wbuiltin-macro-redefined \
-Wmaybe-uninitialized \ -Wc++11-compat \
-Wmemset-elt-size \ -Wc++14-compat \
-Wmemset-transposed-args \ -Wc++17-compat \
-Wmisleading-indentation \ -Wc++20-compat \
-Wmissing-attributes \ -Wcannot-profile \
-Wmissing-braces \ -Wcast-align \
-Wmissing-declarations \ -Wcast-align=strict \
-Wmissing-field-initializers \ -Wcast-function-type \
-Wmissing-format-attribute \ -Wcast-qual \
-Wmissing-include-dirs \ -Wcatch-value=3 \
-Wmissing-noreturn \ -Wchar-subscripts \
-Wmissing-profile \ -Wclass-conversion \
-Wmultichar \ -Wclass-memaccess \
-Wmultiple-inheritance \ -Wclobbered \
-Wmultistatement-macros \ -Wcomma-subscript \
-Wnarrowing \ -Wcomment \
-Wno-deprecated-declarations \ -Wconditionally-supported \
-Wno-float-equal \ -Wconversion \
-Wno-long-long \ -Wconversion-null \
-Wno-namespaces \ -Wcoverage-mismatch \
-Wno-padded \ -Wcpp \
-Wno-switch-enum \ -Wctor-dtor-privacy \
-Wno-system-headers \ -Wdangling-else \
-Wno-templates \ -Wdate-time \
-Wno-undef \ -Wdelete-incomplete \
-Wno-noexcept \ -Wdelete-non-virtual-dtor \
-Wnoexcept-type \ -Wdeprecated \
-Wnon-template-friend \ -Wdeprecated-copy \
-Wnon-virtual-dtor \ -Wdeprecated-copy-dtor \
-Wnonnull \ -Wdeprecated-declarations \
-Wnonnull-compare \ -Wdisabled-optimization \
-Wnonportable-cfstrings \ -Wdiv-by-zero \
-Wnormalized \ -Wdouble-promotion \
-Wnull-dereference \ -Wduplicated-branches \
-Wodr \ -Wduplicated-cond \
-Wold-style-cast \ -Weffc++ \
-Wopenmp-simd \ -Wempty-body \
-Woverflow \ -Wendif-labels \
-Woverlength-strings \ -Wenum-compare \
-Woverloaded-virtual \ -Wexpansion-to-defined \
-Wpacked \ -Wextra \
-Wpacked-bitfield-compat \ -Wextra-semi \
-Wpacked-not-aligned \ -Wfloat-conversion \
-Wparentheses \ -Wfloat-equal \
-Wpedantic \ -Wformat -Wformat-contains-nul \
-Wpessimizing-move \ -Wformat -Wformat-extra-args \
-Wplacement-new=2 \ -Wformat -Wformat-nonliteral \
-Wpmf-conversions \ -Wformat -Wformat-security \
-Wpointer-arith \ -Wformat -Wformat-y2k \
-Wpointer-compare \ -Wformat -Wformat-zero-length \
-Wpragmas \ -Wformat-diag \
-Wprio-ctor-dtor \ -Wformat-overflow=2 \
-Wpsabi \ -Wformat-signedness \
-Wredundant-decls \ -Wformat-truncation=2 \
-Wredundant-move \ -Wformat=2 \
-Wregister \ -Wframe-address \
-Wreorder \ -Wfree-nonheap-object \
-Wrestrict \ -Whsa \
-Wreturn-local-addr \ -Wif-not-aligned \
-Wreturn-type \ -Wignored-attributes \
-Wscalar-storage-order \ -Wignored-qualifiers \
-Wsequence-point \ -Wimplicit-fallthrough=5 \
-Wshadow \ -Winaccessible-base \
-Wshadow-compatible-local \ -Winherited-variadic-ctor \
-Wshadow-local \ -Winit-list-lifetime \
-Wshadow=compatible-local \ -Winit-self \
-Wshadow=global \ -Winline \
-Wshadow=local \ -Wint-in-bool-context \
-Wshift-count-negative \ -Wint-to-pointer-cast \
-Wshift-count-overflow \ -Winvalid-memory-model \
-Wshift-negative-value \ -Winvalid-offsetof \
-Wshift-overflow=2 \ -Winvalid-pch \
-Wsign-compare \ -Wliteral-suffix \
-Wsign-conversion \ -Wlogical-not-parentheses \
-Wsign-promo \ -Wlogical-op \
-Wsized-deallocation \ -Wno-long-long \
-Wsizeof-array-argument \ -Wlto-type-mismatch \
-Wsizeof-pointer-div \ -Wmain \
-Wsizeof-pointer-memaccess \ -Wmaybe-uninitialized \
-Wstack-protector \ -Wmemset-elt-size \
-Wstrict-aliasing=3 \ -Wmemset-transposed-args \
-Wstrict-null-sentinel \ -Wmisleading-indentation \
-Wstrict-overflow=5 \ -Wmismatched-tags \
-Wstringop-overflow=4 \ -Wmissing-attributes \
-Wstringop-truncation \ -Wmissing-braces \
-Wsubobject-linkage \ -Wmissing-declarations \
-Wsuggest-attribute=cold \ -Wmissing-field-initializers \
-Wsuggest-attribute=const \ -Wmissing-include-dirs \
-Wsuggest-attribute=format \ -Wmissing-profile \
-Wsuggest-attribute=malloc \ -Wmultichar \
-Wsuggest-attribute=noreturn \ -Wmultiple-inheritance \
-Wsuggest-attribute=pure \ -Wmultistatement-macros \
-Wsuggest-final-methods \ -Wno-namespaces \
-Wsuggest-final-types \ -Wnarrowing \
-Wsuggest-override \ -Wno-noexcept \
-Wswitch \ -Wnoexcept-type \
-Wswitch-bool \ -Wnon-template-friend \
-Wswitch-default \ -Wnon-virtual-dtor \
-Wswitch-unreachable \ -Wnonnull \
-Wsync-nand \ -Wnonnull-compare \
-Wsynth \ -Wnonportable-cfstrings \
-Wtautological-compare \ -Wnormalized=nfkc \
-Wterminate \ -Wnull-dereference \
-Wtrampolines \ -Wodr \
-Wtrigraphs \ -Wold-style-cast \
-Wtype-limits \ -Wopenmp-simd \
-Wuninitialized \ -Woverflow \
-Wunknown-pragmas \ -Woverlength-strings \
-Wunreachable-code \ -Woverloaded-virtual \
-Wunsafe-loop-optimizations \ -Wpacked \
-Wunused \ -Wpacked-bitfield-compat \
-Wunused-but-set-parameter \ -Wpacked-not-aligned \
-Wunused-but-set-variable \ -Wno-padded \
-Wunused-const-variable=2 \ -Wparentheses \
-Wunused-function \ -Wpedantic \
-Wunused-label \ -Wpessimizing-move \
-Wunused-local-typedefs \ -Wplacement-new=2 \
-Wunused-macros \ -Wpmf-conversions \
-Wunused-parameter \ -Wpointer-arith \
-Wunused-result \ -Wpointer-compare \
-Wunused-value \ -Wpragmas \
-Wunused-variable \ -Wprio-ctor-dtor \
-Wuseless-cast \ -Wpsabi \
-Wvarargs \ -Wredundant-decls \
-Wvariadic-macros \ -Wredundant-move \
-Wvector-operation-performance \ -Wredundant-tags \
-Wvirtual-inheritance \ -Wregister \
-Wvirtual-move-assign \ -Wreorder \
-Wvla \ -Wrestrict \
-Wvolatile-register-var \ -Wreturn-local-addr \
-Wwrite-strings \ -Wreturn-type \
-Wzero-as-null-pointer-constant \ -Wscalar-storage-order \
" cmake -S . -B build_pedantic -GNinja -DCMAKE_BUILD_TYPE=Debug -DJSON_MultipleHeaders=ON -Wsequence-point \
-Wshadow=compatible-local \
-Wshadow=local \
-Wshift-count-negative \
-Wshift-count-overflow \
-Wshift-negative-value \
-Wshift-overflow=2 \
-Wsign-compare \
-Wsign-conversion \
-Wsign-promo \
-Wsized-deallocation \
-Wsizeof-array-argument \
-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 \
-Wsuggest-attribute=cold \
-Wsuggest-attribute=const \
-Wsuggest-attribute=format \
-Wsuggest-attribute=malloc \
-Wsuggest-attribute=noreturn \
-Wsuggest-attribute=pure \
-Wsuggest-final-methods \
-Wsuggest-final-types \
-Wsuggest-override \
-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 \
-Wunsafe-loop-optimizations \
-Wunused \
-Wunused-but-set-parameter \
-Wunused-but-set-variable \
-Wunused-const-variable=2 \
-Wunused-function \
-Wunused-label \
-Wunused-local-typedefs \
-Wunused-macros \
-Wunused-parameter \
-Wunused-result \
-Wunused-value \
-Wunused-variable \
-Wuseless-cast \
-Wvarargs \
-Wvariadic-macros \
-Wvector-operation-performance \
-Wvirtual-inheritance \
-Wvirtual-move-assign \
-Wvla \
-Wvolatile \
-Wvolatile-register-var \
-Wwrite-strings \
-Wzero-as-null-pointer-constant \
-Wzero-length-bounds \
" cmake -S . -B build_pedantic -GNinja -DCMAKE_BUILD_TYPE=Debug -DJSON_MultipleHeaders=ON -DJSON_BuildTests=On
cmake --build build_pedantic cmake --build build_pedantic
########################################################################## ##########################################################################
...@@ -353,7 +380,7 @@ pedantic_gcc: ...@@ -353,7 +380,7 @@ pedantic_gcc:
run_benchmarks: run_benchmarks:
rm -fr build_benchmarks rm -fr build_benchmarks
mkdir 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 ; ninja
cd build_benchmarks ; ./json_benchmarks cd build_benchmarks ; ./json_benchmarks
...@@ -430,7 +457,7 @@ cppcheck: ...@@ -430,7 +457,7 @@ cppcheck:
clang_analyze: clang_analyze:
rm -fr clang_analyze_build rm -fr clang_analyze_build
mkdir 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 ; \ cd clang_analyze_build ; \
$(COMPILER_DIR)/scan-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 \ -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: ...@@ -472,7 +499,7 @@ oclint:
clang_sanitize: clang_sanitize:
rm -fr clang_sanitize_build rm -fr clang_sanitize_build
mkdir 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 ; ninja
cd clang_sanitize_build ; ctest -j10 cd clang_sanitize_build ; ctest -j10
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment