Skip to content

Commit 56f0468

Browse files
quality: use more warning flags
Signed-off-by: Daniel Edwards <Daniel.Edwards@vector.com>
1 parent 72fd720 commit 56f0468

2 files changed

Lines changed: 22 additions & 27 deletions

File tree

SilKit/cmake/SilKitBuildSettings.cmake

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -88,38 +88,35 @@ function(silkit_enable_warnings isOn)
8888
/wd4389 # too many bogus signed/unsigned warnings in VS2017 Win32
8989
)
9090
endif()
91-
elseif(MINGW)
92-
set(_flags
93-
-pedantic
94-
-Wall
95-
-Wextra
96-
-Wcast-align
97-
-Wpacked
98-
-Wno-implicit-fallthrough
99-
-Wno-error=dangling-reference
100-
101-
-Wno-shadow # Appears in ThirdParty/spdlog/include/spdlog/common.h:214:9
102-
-Wno-format # MinGW-gcc does not recognize %zu
103-
-Wno-unused-parameter # follow up of the %zu format bug, a lot of unused parameters
104-
-Wstrict-overflow=1 # > 1 fails in fmt-6.1.0
105-
${_warnAsError}
106-
)
10791
else()
10892
set(_flags
10993
-pedantic
11094
-Wall
11195
-Wextra
96+
11297
-Wcast-align
11398
-Wpacked
114-
-Wno-implicit-fallthrough
11599
-Wformat=2
100+
-Wmissing-declarations
101+
-Wundef
102+
-Wunused
103+
-Wstrict-overflow=2
116104

117-
-Wno-shadow # Appears in ThirdParty/spdlog/include/spdlog/common.h:214:9
118-
-Wno-format-nonliteral # Warning in fmt-6.1.0/include/fmt/chrono.h:392:48
119-
-Wstrict-overflow=1 # > 1 fails in fmt-6.1.0
120105
${_warnAsError}
121-
)
106+
)
107+
endif()
122108

109+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
110+
set(_flags ${_flags}
111+
-Wimplicit-fallthrough=2
112+
)
113+
endif()
114+
115+
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
116+
set(_flags ${_flags}
117+
-Wno-implicit-fallthrough
118+
-Wno-undef
119+
)
123120
endif()
124121

125122
# Suppress flaky dangling-reference warning

SilKit/source/extensions/CMakeLists.txt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,10 @@ if(UNIX)
5656
#make sure we don't compile obviously bad code
5757
target_compile_options(O_SilKit_Extensions
5858
PRIVATE
59-
-pedantic -Wall -Wextra
60-
-Wcast-align -Wformat=2 -Wmissing-declarations
61-
-Wshadow -Wsign-conversion -Wsign-promo -Wstrict-overflow=5
62-
-Wundef -Wno-unused
63-
-Wpacked
64-
-Werror -Wfatal-errors
59+
-Wshadow
60+
-Wsign-conversion
61+
-Wsign-promo
62+
-Wstrict-overflow=5
6563
)
6664

6765
elseif(MSVC OR MINGW)

0 commit comments

Comments
 (0)