🧹 add some more warnings

This commit is contained in:
Vladislav Nepogodin 2022-11-19 04:19:55 +04:00
parent 8084d28fb3
commit d7f91ebdba
No known key found for this signature in database
GPG Key ID: B62C3D10C54D5DA9
4 changed files with 124 additions and 5 deletions

View File

@ -53,12 +53,14 @@ CPMAddPackage(
GIT_TAG 22a62fcc2c2fa2418f5d358cdf65c1df73b418ae
EXCLUDE_FROM_ALL YES
)
if(NOT ENABLE_DEVENV)
CPMAddPackage(
NAME cpr
GITHUB_REPOSITORY libcpr/cpr
GIT_TAG 142a496e49bc71dc1be85a3ce47bb25573670000
EXCLUDE_FROM_ALL YES
)
endif()
CPMAddPackage(
NAME range-v3
GITHUB_REPOSITORY ericniebler/range-v3
@ -130,7 +132,10 @@ if(COS_INSTALLER_BUILD_TESTS)
add_subdirectory(tests)
endif()
target_link_libraries(${PROJECT_NAME} PRIVATE project_warnings project_options spdlog::spdlog fmt::fmt ftxui::screen ftxui::dom ftxui::component cpr::cpr range-v3::range-v3 ctre::ctre)
target_link_libraries(${PROJECT_NAME} PRIVATE project_warnings project_options spdlog::spdlog fmt::fmt ftxui::screen ftxui::dom ftxui::component range-v3::range-v3 ctre::ctre)
if(NOT ENABLE_DEVENV)
target_link_libraries(${PROJECT_NAME} PRIVATE cpr::cpr)
endif()
option(ENABLE_UNITY "Enable Unity builds of projects" OFF)
if(ENABLE_UNITY)

View File

@ -1,5 +1,5 @@
function(set_project_warnings project_name)
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" ON)
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" OFF)
option(ENABLE_HARD_WARNINGS "Enable HARD warnings for static ananlyzer" OFF)
set(MSVC_WARNINGS
@ -68,6 +68,7 @@ function(set_project_warnings project_name)
-Wsuggest-attribute=pure
#-Wsuggest-final-methods
#-Wsuggest-final-types
-Wsuggest-override
-Wdiv-by-zero
-Wanalyzer-double-fclose
-Wanalyzer-double-free
@ -75,6 +76,15 @@ function(set_project_warnings project_name)
-Wanalyzer-use-after-free
## some more analyzer flags
-Wnonnull
-Wnonnull-compare
-Wnormalized=nfkc
-Wnull-dereference
-Wopenacc-parallelism
-Wopenmp-simd
-Wpmf-conversions
-Waggressive-loop-optimizations
-Wanalyzer-tainted-allocation-size
-Wanalyzer-use-of-uninitialized-value
-Wanalyzer-use-of-pointer-in-stale-stack-frame
@ -85,6 +95,16 @@ function(set_project_warnings project_name)
)
if(ENABLE_HARD_WARNINGS)
set(CLANG_WARNINGS ${CLANG_WARNINGS}
-Weverything
-Wno-c++98-compat
-Wno-c++98-compat-pedantic
-Wno-c++11-compat
-Wno-c++14-compat
-Wno-documentation-unknown-command
-Wno-reserved-identifier
)
set(GCC_WARNINGS
${GCC_WARNINGS}
-fanalyzer
@ -92,6 +112,93 @@ function(set_project_warnings project_name)
## just for testing
-Weffc++
-Walloca
-Walloc-zero
-Wcannot-profile
-Wcast-align
-Wcast-align=strict
-Wcast-function-type
-Wcast-qual
-Wcatch-value=3
-Wchar-subscripts
-Wclass-conversion
-Wclass-memaccess
-Wclobbered
-Wcomma-subscript
-Wcomment
-Wcomments
-Wconditionally-supported
-Wconversion
-Wconversion-null
-Wcoverage-invalid-line-number
-Wcoverage-mismatch
-Wcpp
-Wctad-maybe-unsupported
-Wctor-dtor-privacy
-Wdangling-else
-Wdangling-pointer=2
-Wdate-time
-Wdelete-incomplete
-Wdelete-non-virtual-dtor
-Wframe-address
-Wfree-nonheap-object
-Whsa
-Wlto-type-mismatch
-Wno-namespaces
-Wnarrowing
-Wnoexcept
-Wnoexcept-type
-Wnon-template-friend
-Wnon-virtual-dtor
-Wodr
-Wold-style-cast
-Woverflow
-Woverlength-strings
-Woverloaded-virtual
-Wpacked
-Wpacked-bitfield-compat
-Wpacked-not-aligned
-Wno-padded
-Wparentheses
-Wpessimizing-move
-Wplacement-new=2
-Wpragmas
-Wprio-ctor-dtor
-Wpsabi
-Wrange-loop-construct
-Wredundant-decls
-Wredundant-move
-Wredundant-tags
-Wregister
-Wscalar-storage-order
-Wsequence-point
-Wshadow=compatible-local
-Wshadow=global
-Wshadow=local
-Wstack-protector
-Wsync-nand
-Wsynth
-Wtsan
-Wtype-limits
-Wundef
-Wuninitialized
-Wunknown-pragmas
-Wunreachable-code
-Wunsafe-loop-optimizations
-Wuse-after-free=3
-Wvector-operation-performance
-Wvexing-parse
-Wvirtual-inheritance
-Wvirtual-move-assign
-Wvla
-Wvla-parameter
-Wvolatile
-Wvolatile-register-var
-Wwrite-strings
-Wzero-as-null-pointer-constant
-Wzero-length-bounds
-Wanalyzer-exposure-through-output-file
-Wanalyzer-file-leak
-Wanalyzer-null-argument

View File

@ -38,11 +38,14 @@ spdlog = dependency('spdlog', version : ['>=1.9.2'], fallback : ['spdlog', 'spdl
fmt = dependency('fmt', version : ['>=9.1.0'], fallback : ['fmt', 'fmt_dep'])
ftxui = dependency('ftxui', modules : ['ftxui::screen', 'ftxui::dom', 'ftxui::component'], fallback : ['ftxui', 'ftxui_dep'])
rapidjson = dependency('rapidjson', version : ['>=1.1.0'], fallback : ['rapidjson', 'rapidjson_dep'])
cpr = dependency('cpr', version : ['>=1.7.0'], fallback : ['cpr', 'cpr_dep'])
ranges = dependency('range-v3', version : ['>=0.11.0'], fallback : ['range-v3', 'range_dep'])
ctre = dependency('ctre', version : ['>=3.7.0'], fallback : ['ctre', 'ctre_dep'])
#glibmm = dependency('glibmm-2.4', version : ['>=2.56.0'])
if not is_dev_environment
cpr = dependency('cpr', version : ['>=1.7.0'], fallback : ['cpr', 'cpr_dep'])
endif
src_files = files(
'src/view.hpp',
'src/definitions.hpp',
@ -135,7 +138,10 @@ endif
add_project_arguments(cc.get_supported_arguments(possible_cc_flags), language : 'cpp')
deps = [fmt, spdlog, ftxui, cpr, ranges, rapidjson, ctre]
deps = [fmt, spdlog, ftxui, ranges, rapidjson, ctre]
if not is_dev_environment
deps += [cpr]
endif
executable(
'cachyos-installer',

View File

@ -50,7 +50,8 @@
#define subprocess_pure __attribute__((pure))
#define subprocess_weak __attribute__((weak))
#else
#error Non clang, non gcc, non MSVC compiler found!
#define subprocess_pure
#define subprocess_weak inline
#endif
struct subprocess_s;