Skip to content

Commit 205f6c0

Browse files
authored
removed unnecessary disabling of compiler warnings and small cleanup (#6881)
1 parent 9fbc137 commit 205f6c0

File tree

3 files changed

+28
-11
lines changed

3 files changed

+28
-11
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ ifeq (clang++, $(findstring clang++,$(CXX)))
136136
CPPCHK_GLIBCXX_DEBUG=
137137
endif
138138
ifndef CXXFLAGS
139-
CXXFLAGS=-pedantic -Wall -Wextra -Wcast-qual -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-shadow -Wno-missing-braces -Wno-sign-compare -Wno-multichar -Woverloaded-virtual $(CPPCHK_GLIBCXX_DEBUG) -g
139+
CXXFLAGS=-pedantic -Wall -Wextra -Wcast-qual -Wfloat-equal -Wmissing-declarations -Wmissing-format-attribute -Wno-long-long -Wpacked -Wredundant-decls -Wundef -Wno-sign-compare -Wno-multichar -Woverloaded-virtual $(CPPCHK_GLIBCXX_DEBUG) -g
140140
endif
141141

142142
ifeq (g++, $(findstring g++,$(CXX)))

cmake/compileroptions.cmake

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,10 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"
3636
if(WARNINGS_ARE_ERRORS)
3737
add_compile_options(-Werror)
3838
endif()
39-
add_compile_options(-pedantic)
39+
add_compile_options(-pedantic) # TODO: is this implied by -Weverything?
40+
endif()
41+
42+
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
4043
add_compile_options(-Wall)
4144
add_compile_options(-Wextra)
4245
add_compile_options(-Wcast-qual) # Cast for removing type qualifiers
@@ -47,7 +50,6 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"
4750
add_compile_options(-Wpacked) #
4851
add_compile_options(-Wredundant-decls) # if anything is declared more than once in the same scope
4952
add_compile_options(-Wundef)
50-
add_compile_options(-Wno-missing-braces)
5153
add_compile_options(-Wno-sign-compare)
5254
add_compile_options(-Wno-multichar)
5355
add_compile_options(-Woverloaded-virtual) # when a function declaration hides virtual functions from a base class
@@ -58,17 +60,31 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang"
5860
#add_compile_options(-Wsign-conversion) # too many warnings
5961
#add_compile_options(-Wunreachable-code) # some GCC versions report lots of warnings
6062
#add_compile_options(-Wsign-promo)
61-
endif()
6263

63-
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
6464
# use pipes instead of temporary files - greatly reduces I/O usage
6565
add_compile_options(-pipe)
6666

67-
add_compile_options(-Wno-maybe-uninitialized) # there are some false positives
6867
add_compile_options(-Wsuggest-attribute=noreturn)
69-
add_compile_options(-Wno-shadow) # whenever a local variable or type declaration shadows another one
7068
add_compile_options_safe(-Wuseless-cast)
7169
# add_compile_options_safe(-Wsuggest-attribute=returns_nonnull) # reports the warning even if the attribute is set
70+
71+
# TODO: evaluate
72+
#add_compile_options_safe(-Wduplicated-branches)
73+
#add_compile_options_safe(-Wduplicated-cond)
74+
#add_compile_options_safe(-Wformat=2)
75+
#add_compile_options_safe(-Wformat-overflow=2)
76+
#add_compile_options_safe(-Wformat-signedness)
77+
#add_compile_options_safe(-Wnull-dereference)
78+
#add_compile_options_safe(-Wnrvo)
79+
#add_compile_options_safe(-Wimplicit-fallthrough=5)
80+
#add_compile_options_safe(-Wmissing-include-dirs)
81+
#add_compile_options_safe(-Wunused)
82+
#add_compile_options_safe(-Wunused-const-variable)
83+
#add_compile_options_safe(-Wuninitialized)
84+
#add_compile_options_safe(-Wsuggest-attribute=pure)
85+
#add_compile_options_safe(-Wsuggest-attribute=const)
86+
#add_compile_options_safe(-Wunused-macros)
87+
#add_compile_options_safe(-Wpedantic)
7288
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
7389
if(CMAKE_CXX_COMPILER_VERSION VERSION_EQUAL 14 OR CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 14)
7490
# TODO: verify this regression still exists in clang-15
@@ -104,11 +120,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
104120
add_compile_options_safe(-Wno-implicit-float-conversion)
105121
add_compile_options_safe(-Wno-switch-enum)
106122
add_compile_options_safe(-Wno-float-conversion)
107-
add_compile_options_safe(-Wno-enum-enum-conversion)
108123
add_compile_options_safe(-Wno-date-time)
109124
add_compile_options(-Wno-disabled-macro-expansion)
110125
add_compile_options_safe(-Wno-bitwise-instead-of-logical)
111-
add_compile_options_safe(-Wno-switch-default)
126+
add_compile_options(-Wno-sign-compare)
112127

113128
# these cannot be fixed properly without adopting later C++ standards
114129
add_compile_options_safe(-Wno-unsafe-buffer-usage)
@@ -125,9 +140,13 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
125140
# only needs to be addressed to work around issues in older compilers
126141
add_compile_options_safe(-Wno-return-std-move-in-c++11)
127142

143+
# this is reported even when it is unnecessary i.e. -Wswitch-enum warnings have been mitigated
144+
add_compile_options_safe(-Wno-switch-default)
145+
128146
# warnings we are currently not interested in
129147
add_compile_options(-Wno-four-char-constants)
130148
add_compile_options(-Wno-weak-vtables)
149+
add_compile_options(-Wno-multichar)
131150

132151
if(ENABLE_COVERAGE OR ENABLE_COVERAGE_XML)
133152
message(FATAL_ERROR "Do not use clang to generate code coverage. Use GCC instead.")

tools/dmake/dmake.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -691,8 +691,6 @@ int main(int argc, char **argv)
691691
"-Wpacked "
692692
"-Wredundant-decls "
693693
"-Wundef "
694-
"-Wno-shadow "
695-
"-Wno-missing-braces "
696694
"-Wno-sign-compare "
697695
"-Wno-multichar "
698696
"-Woverloaded-virtual "

0 commit comments

Comments
 (0)