CI: turn *_CXXFLAGS into CMake lists

This commit is contained in:
Florian Albrechtskirchinger 2022-03-06 15:26:39 +01:00
parent c7e11eab58
commit 4d50e929b7

View File

@ -98,18 +98,19 @@ file(GLOB_RECURSE SRC_FILES ${PROJECT_SOURCE_DIR}/include/nlohmann/*.hpp)
# -Wno-weak-vtables The library is header-only. # -Wno-weak-vtables The library is header-only.
# -Wreserved-identifier See https://github.com/onqtam/doctest/issues/536. # -Wreserved-identifier See https://github.com/onqtam/doctest/issues/536.
set(CLANG_CXXFLAGS "-std=c++11 \ set(CLANG_CXXFLAGS
-Werror \ -std=c++11
-Weverything \ -Werror
-Wno-c++98-compat \ -Weverything
-Wno-c++98-compat-pedantic \ -Wno-c++98-compat
-Wno-deprecated-declarations \ -Wno-c++98-compat-pedantic
-Wno-extra-semi-stmt \ -Wno-deprecated-declarations
-Wno-padded \ -Wno-extra-semi-stmt
-Wno-covered-switch-default \ -Wno-padded
-Wno-weak-vtables \ -Wno-covered-switch-default
-Wno-reserved-identifier \ -Wno-weak-vtables
") -Wno-reserved-identifier
)
# Warning flags determined for GCC 12.0 (experimental) with https://github.com/nlohmann/gcc_flags: # Warning flags determined for GCC 12.0 (experimental) with https://github.com/nlohmann/gcc_flags:
# Ignored GCC warnings: # Ignored GCC warnings:
@ -121,295 +122,296 @@ set(CLANG_CXXFLAGS "-std=c++11 \
# -Wno-system-headers We do not care about warnings in system headers. # -Wno-system-headers We do not care about warnings in system headers.
# -Wno-templates The library uses templates. # -Wno-templates The library uses templates.
set(GCC_CXXFLAGS "-std=c++11 \ set(GCC_CXXFLAGS
-pedantic \ -std=c++11
-Werror \ -pedantic
--all-warnings \ -Werror
--extra-warnings \ --all-warnings
-W \ --extra-warnings
-WNSObject-attribute \ -W
-Wno-abi-tag \ -WNSObject-attribute
-Waddress \ -Wno-abi-tag
-Waddress-of-packed-member \ -Waddress
-Wno-aggregate-return \ -Waddress-of-packed-member
-Waggressive-loop-optimizations \ -Wno-aggregate-return
-Waligned-new=all \ -Waggressive-loop-optimizations
-Wall \ -Waligned-new=all
-Walloc-zero \ -Wall
-Walloca \ -Walloc-zero
-Wanalyzer-double-fclose \ -Walloca
-Wanalyzer-double-free \ -Wanalyzer-double-fclose
-Wanalyzer-exposure-through-output-file \ -Wanalyzer-double-free
-Wanalyzer-file-leak \ -Wanalyzer-exposure-through-output-file
-Wanalyzer-free-of-non-heap \ -Wanalyzer-file-leak
-Wanalyzer-malloc-leak \ -Wanalyzer-free-of-non-heap
-Wanalyzer-mismatching-deallocation \ -Wanalyzer-malloc-leak
-Wanalyzer-null-argument \ -Wanalyzer-mismatching-deallocation
-Wanalyzer-null-dereference \ -Wanalyzer-null-argument
-Wanalyzer-possible-null-argument \ -Wanalyzer-null-dereference
-Wanalyzer-possible-null-dereference \ -Wanalyzer-possible-null-argument
-Wanalyzer-shift-count-negative \ -Wanalyzer-possible-null-dereference
-Wanalyzer-shift-count-overflow \ -Wanalyzer-shift-count-negative
-Wanalyzer-stale-setjmp-buffer \ -Wanalyzer-shift-count-overflow
-Wanalyzer-tainted-allocation-size \ -Wanalyzer-stale-setjmp-buffer
-Wanalyzer-tainted-array-index \ -Wanalyzer-tainted-allocation-size
-Wanalyzer-tainted-divisor \ -Wanalyzer-tainted-array-index
-Wanalyzer-tainted-offset \ -Wanalyzer-tainted-divisor
-Wanalyzer-tainted-size \ -Wanalyzer-tainted-offset
-Wanalyzer-too-complex \ -Wanalyzer-tainted-size
-Wanalyzer-unsafe-call-within-signal-handler \ -Wanalyzer-too-complex
-Wanalyzer-use-after-free \ -Wanalyzer-unsafe-call-within-signal-handler
-Wanalyzer-use-of-pointer-in-stale-stack-frame \ -Wanalyzer-use-after-free
-Wanalyzer-use-of-uninitialized-value \ -Wanalyzer-use-of-pointer-in-stale-stack-frame
-Wanalyzer-write-to-const \ -Wanalyzer-use-of-uninitialized-value
-Wanalyzer-write-to-string-literal \ -Wanalyzer-write-to-const
-Warith-conversion \ -Wanalyzer-write-to-string-literal
-Warray-bounds \ -Warith-conversion
-Warray-bounds=2 \ -Warray-bounds
-Warray-compare \ -Warray-bounds=2
-Warray-parameter=2 \ -Warray-compare
-Wattribute-alias=2 \ -Warray-parameter=2
-Wattribute-warning \ -Wattribute-alias=2
-Wattributes \ -Wattribute-warning
-Wbool-compare \ -Wattributes
-Wbool-operation \ -Wbool-compare
-Wbuiltin-declaration-mismatch \ -Wbool-operation
-Wbuiltin-macro-redefined \ -Wbuiltin-declaration-mismatch
-Wc++0x-compat \ -Wbuiltin-macro-redefined
-Wc++11-compat \ -Wc++0x-compat
-Wc++11-extensions \ -Wc++11-compat
-Wc++14-compat \ -Wc++11-extensions
-Wc++14-extensions \ -Wc++14-compat
-Wc++17-compat \ -Wc++14-extensions
-Wc++17-extensions \ -Wc++17-compat
-Wc++1z-compat \ -Wc++17-extensions
-Wc++20-compat \ -Wc++1z-compat
-Wc++20-extensions \ -Wc++20-compat
-Wc++23-extensions \ -Wc++20-extensions
-Wc++2a-compat \ -Wc++23-extensions
-Wcannot-profile \ -Wc++2a-compat
-Wcast-align \ -Wcannot-profile
-Wcast-align=strict \ -Wcast-align
-Wcast-function-type \ -Wcast-align=strict
-Wcast-qual \ -Wcast-function-type
-Wcatch-value=3 \ -Wcast-qual
-Wchar-subscripts \ -Wcatch-value=3
-Wclass-conversion \ -Wchar-subscripts
-Wclass-memaccess \ -Wclass-conversion
-Wclobbered \ -Wclass-memaccess
-Wcomma-subscript \ -Wclobbered
-Wcomment \ -Wcomma-subscript
-Wcomments \ -Wcomment
-Wconditionally-supported \ -Wcomments
-Wconversion \ -Wconditionally-supported
-Wconversion-null \ -Wconversion
-Wcoverage-invalid-line-number \ -Wconversion-null
-Wcoverage-mismatch \ -Wcoverage-invalid-line-number
-Wcpp \ -Wcoverage-mismatch
-Wctad-maybe-unsupported \ -Wcpp
-Wctor-dtor-privacy \ -Wctad-maybe-unsupported
-Wdangling-else \ -Wctor-dtor-privacy
-Wdate-time \ -Wdangling-else
-Wdelete-incomplete \ -Wdate-time
-Wdelete-non-virtual-dtor \ -Wdelete-incomplete
-Wdeprecated \ -Wdelete-non-virtual-dtor
-Wdeprecated-copy \ -Wdeprecated
-Wdeprecated-copy-dtor \ -Wdeprecated-copy
-Wdeprecated-declarations \ -Wdeprecated-copy-dtor
-Wdeprecated-enum-enum-conversion \ -Wdeprecated-declarations
-Wdeprecated-enum-float-conversion \ -Wdeprecated-enum-enum-conversion
-Wdisabled-optimization \ -Wdeprecated-enum-float-conversion
-Wdiv-by-zero \ -Wdisabled-optimization
-Wdouble-promotion \ -Wdiv-by-zero
-Wduplicated-branches \ -Wdouble-promotion
-Wduplicated-cond \ -Wduplicated-branches
-Weffc++ \ -Wduplicated-cond
-Wempty-body \ -Weffc++
-Wendif-labels \ -Wempty-body
-Wenum-compare \ -Wendif-labels
-Wenum-conversion \ -Wenum-compare
-Wexceptions \ -Wenum-conversion
-Wexpansion-to-defined \ -Wexceptions
-Wextra \ -Wexpansion-to-defined
-Wextra-semi \ -Wextra
-Wfloat-conversion \ -Wextra-semi
-Wfloat-equal \ -Wfloat-conversion
-Wformat-diag \ -Wfloat-equal
-Wformat-overflow=2 \ -Wformat-diag
-Wformat-signedness \ -Wformat-overflow=2
-Wformat-truncation=2 \ -Wformat-signedness
-Wformat=2 \ -Wformat-truncation=2
-Wframe-address \ -Wformat=2
-Wfree-nonheap-object \ -Wframe-address
-Whsa \ -Wfree-nonheap-object
-Wif-not-aligned \ -Whsa
-Wignored-attributes \ -Wif-not-aligned
-Wignored-qualifiers \ -Wignored-attributes
-Wimplicit-fallthrough=5 \ -Wignored-qualifiers
-Winaccessible-base \ -Wimplicit-fallthrough=5
-Winfinite-recursion \ -Winaccessible-base
-Winherited-variadic-ctor \ -Winfinite-recursion
-Winit-list-lifetime \ -Winherited-variadic-ctor
-Winit-self \ -Winit-list-lifetime
-Winline \ -Winit-self
-Wint-in-bool-context \ -Winline
-Wint-to-pointer-cast \ -Wint-in-bool-context
-Winterference-size \ -Wint-to-pointer-cast
-Winvalid-imported-macros \ -Winterference-size
-Winvalid-memory-model \ -Winvalid-imported-macros
-Winvalid-offsetof \ -Winvalid-memory-model
-Winvalid-pch \ -Winvalid-offsetof
-Wliteral-suffix \ -Winvalid-pch
-Wlogical-not-parentheses \ -Wliteral-suffix
-Wlogical-op \ -Wlogical-not-parentheses
-Wno-long-long \ -Wlogical-op
-Wlto-type-mismatch \ -Wno-long-long
-Wmain \ -Wlto-type-mismatch
-Wmaybe-uninitialized \ -Wmain
-Wmemset-elt-size \ -Wmaybe-uninitialized
-Wmemset-transposed-args \ -Wmemset-elt-size
-Wmisleading-indentation \ -Wmemset-transposed-args
-Wmismatched-dealloc \ -Wmisleading-indentation
-Wmismatched-new-delete \ -Wmismatched-dealloc
-Wmismatched-tags \ -Wmismatched-new-delete
-Wmissing-attributes \ -Wmismatched-tags
-Wmissing-braces \ -Wmissing-attributes
-Wmissing-declarations \ -Wmissing-braces
-Wmissing-field-initializers \ -Wmissing-declarations
-Wmissing-include-dirs \ -Wmissing-field-initializers
-Wmissing-profile \ -Wmissing-include-dirs
-Wmissing-requires \ -Wmissing-profile
-Wmultichar \ -Wmissing-requires
-Wmultiple-inheritance \ -Wmultichar
-Wmultistatement-macros \ -Wmultiple-inheritance
-Wno-namespaces \ -Wmultistatement-macros
-Wnarrowing \ -Wno-namespaces
-Wnoexcept \ -Wnarrowing
-Wnoexcept-type \ -Wnoexcept
-Wnon-template-friend \ -Wnoexcept-type
-Wnon-virtual-dtor \ -Wnon-template-friend
-Wnonnull \ -Wnon-virtual-dtor
-Wnonnull-compare \ -Wnonnull
-Wnormalized=nfkc \ -Wnonnull-compare
-Wnull-dereference \ -Wnormalized=nfkc
-Wodr \ -Wnull-dereference
-Wold-style-cast \ -Wodr
-Wopenacc-parallelism \ -Wold-style-cast
-Wopenmp-simd \ -Wopenacc-parallelism
-Woverflow \ -Wopenmp-simd
-Woverlength-strings \ -Woverflow
-Woverloaded-virtual \ -Woverlength-strings
-Wpacked \ -Woverloaded-virtual
-Wpacked-bitfield-compat \ -Wpacked
-Wpacked-not-aligned \ -Wpacked-bitfield-compat
-Wno-padded \ -Wpacked-not-aligned
-Wparentheses \ -Wno-padded
-Wpedantic \ -Wparentheses
-Wpessimizing-move \ -Wpedantic
-Wplacement-new=2 \ -Wpessimizing-move
-Wpmf-conversions \ -Wplacement-new=2
-Wpointer-arith \ -Wpmf-conversions
-Wpointer-compare \ -Wpointer-arith
-Wpragmas \ -Wpointer-compare
-Wprio-ctor-dtor \ -Wpragmas
-Wpsabi \ -Wprio-ctor-dtor
-Wrange-loop-construct \ -Wpsabi
-Wredundant-decls \ -Wrange-loop-construct
-Wredundant-move \ -Wredundant-decls
-Wredundant-tags \ -Wredundant-move
-Wregister \ -Wredundant-tags
-Wreorder \ -Wregister
-Wrestrict \ -Wreorder
-Wreturn-local-addr \ -Wrestrict
-Wreturn-type \ -Wreturn-local-addr
-Wscalar-storage-order \ -Wreturn-type
-Wsequence-point \ -Wscalar-storage-order
-Wshadow=compatible-local \ -Wsequence-point
-Wshadow=global \ -Wshadow=compatible-local
-Wshadow=local \ -Wshadow=global
-Wshift-count-negative \ -Wshadow=local
-Wshift-count-overflow \ -Wshift-count-negative
-Wshift-negative-value \ -Wshift-count-overflow
-Wshift-overflow=2 \ -Wshift-negative-value
-Wsign-compare \ -Wshift-overflow=2
-Wsign-conversion \ -Wsign-compare
-Wsign-promo \ -Wsign-conversion
-Wsized-deallocation \ -Wsign-promo
-Wsizeof-array-argument \ -Wsized-deallocation
-Wsizeof-array-div \ -Wsizeof-array-argument
-Wsizeof-pointer-div \ -Wsizeof-array-div
-Wsizeof-pointer-memaccess \ -Wsizeof-pointer-div
-Wstack-protector \ -Wsizeof-pointer-memaccess
-Wstrict-aliasing \ -Wstack-protector
-Wstrict-aliasing=3 \ -Wstrict-aliasing
-Wstrict-null-sentinel \ -Wstrict-aliasing=3
-Wstrict-overflow \ -Wstrict-null-sentinel
-Wstrict-overflow=5 \ -Wstrict-overflow
-Wstring-compare \ -Wstrict-overflow=5
-Wstringop-overflow=4 \ -Wstring-compare
-Wstringop-overread \ -Wstringop-overflow=4
-Wstringop-truncation \ -Wstringop-overread
-Wsubobject-linkage \ -Wstringop-truncation
-Wsuggest-attribute=cold \ -Wsubobject-linkage
-Wsuggest-attribute=const \ -Wsuggest-attribute=cold
-Wsuggest-attribute=format \ -Wsuggest-attribute=const
-Wsuggest-attribute=malloc \ -Wsuggest-attribute=format
-Wsuggest-attribute=noreturn \ -Wsuggest-attribute=malloc
-Wsuggest-attribute=pure \ -Wsuggest-attribute=noreturn
-Wsuggest-final-methods \ -Wsuggest-attribute=pure
-Wsuggest-final-types \ -Wsuggest-final-methods
-Wsuggest-override \ -Wsuggest-final-types
-Wswitch \ -Wsuggest-override
-Wswitch-bool \ -Wswitch
-Wswitch-default \ -Wswitch-bool
-Wswitch-enum \ -Wswitch-default
-Wswitch-outside-range \ -Wswitch-enum
-Wswitch-unreachable \ -Wswitch-outside-range
-Wsync-nand \ -Wswitch-unreachable
-Wsynth \ -Wsync-nand
-Wno-system-headers \ -Wsynth
-Wtautological-compare \ -Wno-system-headers
-Wno-templates \ -Wtautological-compare
-Wterminate \ -Wno-templates
-Wtrampolines \ -Wterminate
-Wtrigraphs \ -Wtrampolines
-Wtsan \ -Wtrigraphs
-Wtype-limits \ -Wtsan
-Wundef \ -Wtype-limits
-Wuninitialized \ -Wundef
-Wunknown-pragmas \ -Wuninitialized
-Wunreachable-code \ -Wunknown-pragmas
-Wunsafe-loop-optimizations \ -Wunreachable-code
-Wunused \ -Wunsafe-loop-optimizations
-Wunused-but-set-parameter \ -Wunused
-Wunused-but-set-variable \ -Wunused-but-set-parameter
-Wunused-const-variable=2 \ -Wunused-but-set-variable
-Wunused-function \ -Wunused-const-variable=2
-Wunused-label \ -Wunused-function
-Wunused-local-typedefs \ -Wunused-label
-Wunused-macros \ -Wunused-local-typedefs
-Wunused-parameter \ -Wunused-macros
-Wunused-result \ -Wunused-parameter
-Wunused-value \ -Wunused-result
-Wunused-variable \ -Wunused-value
-Wuseless-cast \ -Wunused-variable
-Wvarargs \ -Wuseless-cast
-Wvariadic-macros \ -Wvarargs
-Wvector-operation-performance \ -Wvariadic-macros
-Wvexing-parse \ -Wvector-operation-performance
-Wvirtual-inheritance \ -Wvexing-parse
-Wvirtual-move-assign \ -Wvirtual-inheritance
-Wvla \ -Wvirtual-move-assign
-Wvla-parameter \ -Wvla
-Wvolatile \ -Wvla-parameter
-Wvolatile-register-var \ -Wvolatile
-Wwrite-strings \ -Wvolatile-register-var
-Wzero-as-null-pointer-constant \ -Wwrite-strings
-Wzero-length-bounds \ -Wzero-as-null-pointer-constant
") -Wzero-length-bounds
)
add_custom_target(ci_test_gcc add_custom_target(ci_test_gcc
COMMAND CXX=${GCC_TOOL} CXXFLAGS=${GCC_CXXFLAGS} ${CMAKE_COMMAND} COMMAND CXX=${GCC_TOOL} CXXFLAGS="${GCC_CXXFLAGS}" ${CMAKE_COMMAND}
-DCMAKE_BUILD_TYPE=Debug -GNinja -DCMAKE_BUILD_TYPE=Debug -GNinja
-DJSON_BuildTests=ON -DJSON_MultipleHeaders=ON -DJSON_BuildTests=ON -DJSON_MultipleHeaders=ON
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_gcc -S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_gcc
@ -419,7 +421,7 @@ add_custom_target(ci_test_gcc
) )
add_custom_target(ci_test_clang add_custom_target(ci_test_clang
COMMAND CXX=${CLANG_TOOL} CXXFLAGS=${CLANG_CXXFLAGS} ${CMAKE_COMMAND} COMMAND CXX=${CLANG_TOOL} CXXFLAGS="${CLANG_CXXFLAGS}" ${CMAKE_COMMAND}
-DCMAKE_BUILD_TYPE=Debug -GNinja -DCMAKE_BUILD_TYPE=Debug -GNinja
-DJSON_BuildTests=ON -DJSON_MultipleHeaders=ON -DJSON_BuildTests=ON -DJSON_MultipleHeaders=ON
-S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_clang -S${PROJECT_SOURCE_DIR} -B${PROJECT_BINARY_DIR}/build_clang