@@ -12,15 +12,15 @@ add_compile_options(-Wall -Wextra -Wpedantic -Werror)
12
12
set (THIRD_PARTY_COMPILER_WARNINGS -Wall -Wextra -Wpedantic)
13
13
14
14
# clang warnings
15
- set (CLANG_WARNINGS -Weverything
16
- -Wno-c++20-compat
17
- -Wno-pre-c++20-compat-pedantic
18
- -Wno-pre-c++17-compat
19
- -Wno-c++98-compat
20
- -Wno-c++98-compat-pedantic
21
- -Wno-unsafe-buffer-usage
22
- -Wno-padded
23
- -Wno-switch-default
15
+ set (CLANG_WARNINGS -Weverything
16
+ -Wno-c++20-compat
17
+ -Wno-pre-c++20-compat-pedantic
18
+ -Wno-pre-c++17-compat
19
+ -Wno-c++98-compat
20
+ -Wno-c++98-compat-pedantic
21
+ -Wno-unsafe-buffer-usage
22
+ -Wno-padded
23
+ -Wno-switch-default
24
24
-Wno-ctad-maybe-unsupported
25
25
-Wno-global -constructors
26
26
-Wno-weak-vtables
@@ -39,15 +39,15 @@ set(GCC_WARNINGS
39
39
-Wnull-dereference # warn if a null dereference is detected
40
40
-Wdouble-promotion # warn if float is implicit promoted to double
41
41
-Wformat=2 # warn on security issues around functions that format output (ie printf)
42
- -Wimplicit-fallthrough # warn on statements that fallthrough without an explicit annotation
42
+ -Wimplicit-fallthrough # warn on statements that fallthrough without an explicit annotation
43
43
-Wmisleading-indentation # warn if indentation implies blocks where blocks do not exist
44
44
-Wduplicated-cond # warn if if / else chain has duplicated conditions
45
45
-Wduplicated-branches # warn if if / else branches have duplicated code
46
46
-Wlogical-op # warn about logical operations being used where bitwise were probably wanted
47
47
-Wuseless-cast # warn if you perform a cast to the same type
48
- -Wconversion
49
- -Wcast-qual
50
- -Wpointer-arith
48
+ -Wconversion
49
+ -Wcast-qual
50
+ -Wpointer-arith
51
51
)
52
52
53
53
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" )
@@ -88,10 +88,7 @@ endif()
88
88
option (ENABLE_MSAN "Enable memory sanitizer" FALSE )
89
89
if (${ENABLE_MSAN} )
90
90
if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang" )
91
- message (
92
- WARNING
93
- "Memory sanitizer requires all the code (including libc++) to be MSAN-instrumented otherwise it reports false positives"
94
- )
91
+ message (WARNING "Memory sanitizer requires all code (including libc++) to be MSAN-instrumented to avoid false positives" )
95
92
endif ()
96
93
if ("address" IN_LIST SANITIZERS
97
94
OR "thread" IN_LIST SANITIZERS
@@ -131,8 +128,8 @@ endif()
131
128
option (ENABLE_CACHE "Enable cache if available" ON )
132
129
if (ENABLE_CACHE)
133
130
set (CACHE_PROGRAM_OPTIONS "ccache" "sccache" )
134
- foreach (CACHE_OPTION IN LISTS CACHE_PROGRAM_OPTIONS)
135
- find_program (CACHE_BIN ${CACHE_OPTION } )
131
+ foreach (cache_option IN LISTS CACHE_PROGRAM_OPTIONS)
132
+ find_program (CACHE_BIN ${cache_option } )
136
133
if (CACHE_BIN)
137
134
set (CMAKE_CXX_COMPILER_LAUNCHER ${CACHE_BIN} )
138
135
set (CMAKE_C_COMPILER_LAUNCHER ${CACHE_BIN} )
@@ -156,14 +153,13 @@ option(ENABLE_LINTER "Enable static analysis" ON)
156
153
if (ENABLE_LINTER)
157
154
find_program (LINTER_BIN NAMES clang-tidy QUIET )
158
155
if (LINTER_BIN)
159
- set (LINTER_ARGS
160
- -extra-arg=-Wno-ignored-optimization-argument
156
+ set (LINTER_ARGS
157
+ -extra-arg=-Wno-ignored-optimization-argument
161
158
-extra-arg=-Wno-unknown-warning-option)
162
159
# NOTE: To speed up linting, clang-tidy is invoked via clang-tidy-cache.
163
160
# (https://github.com/matus-chochlik/ctcache) Cache location is set by environment variable
164
161
# CTCACHE_DIR
165
- set (LINTER_INVOKE_COMMAND
166
- ${GBS_TEMPLATES_DIR} /clang-tidy-cache .py ${LINTER_BIN} -p ${CMAKE_BINARY_DIR} ${LINTER_ARGS} )
162
+ set (LINTER_INVOKE_COMMAND ${GBS_TEMPLATES_DIR} /clang-tidy-cache .py ${LINTER_BIN} -p ${CMAKE_BINARY_DIR} ${LINTER_ARGS} )
167
163
set (CMAKE_C_CLANG_TIDY ${LINTER_INVOKE_COMMAND} )
168
164
set (CMAKE_CXX_CLANG_TIDY ${LINTER_INVOKE_COMMAND} )
169
165
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU" )
0 commit comments