From d38a9bb7760a26f55c6113a0f41cd64742d8c6ff Mon Sep 17 00:00:00 2001 From: Martchus Date: Fri, 19 Mar 2021 22:55:58 +0100 Subject: [PATCH] Disable/weaken a few warnings again which don't seem to be very usefull after all --- cmake/modules/BasicConfig.cmake | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/cmake/modules/BasicConfig.cmake b/cmake/modules/BasicConfig.cmake index 44989c8..69bd5aa 100644 --- a/cmake/modules/BasicConfig.cmake +++ b/cmake/modules/BasicConfig.cmake @@ -633,24 +633,26 @@ else () endforeach () endif () -# enable warnings and treat them as errors -option(ENABLE_WARNINGS "adds additional compiler flags to enable warnings" "${ENABLE_DEVEL_DEFAULTS}") +# enable useful warnings and explicitely disable not useful ones and treat warnings them as errors +option(ENABLE_WARNINGS "adds additional compiler flags to enable useful warnings" "${ENABLE_DEVEL_DEFAULTS}") set(CLANG_WARNINGS -Wall -Wextra # reasonable and standard - -Wshadow # warn the user if a variable declaration shadows one from a parent context + -Wshadow=local # warn the user if a variable declaration shadows one from a parent context -Wnon-virtual-dtor # warn the user if a class with virtual functions has a non-virtual destructor. This helps catch hard # to track down memory errors -Wold-style-cast # warn for c-style casts -Wcast-align # warn for potential performance problem casts -Wunused # warn on anything being unused -Woverloaded-virtual # warn if you overload (not override) a virtual function - -Wpedantic # warn if non-standard C++ is used -Wconversion # warn on type conversions that may lose data -Wsign-conversion # warn on sign conversions -Wnull-dereference # warn if a null dereference is detected -Wdouble-promotion # warn if float is implicit promoted to double -Wformat=2 # warn on security issues around functions that format output (ie printf) + -Wno-pedantic # warn NOT if non-standard C++ is used, some vendor extensions are very useful + -Wno-missing-field-initializers # warn NOT about missing field initializers + -Wno-useless-cast # warn NOT about useless cases as this is sometimes very useful in templates ) set(GCC_WARNINGS ${CLANG_WARNINGS} @@ -658,7 +660,6 @@ set(GCC_WARNINGS -Wduplicated-cond # warn if if / else chain has duplicated conditions -Wduplicated-branches # warn if if / else branches have duplicated code -Wlogical-op # warn about logical operations being used where bitwise were probably wanted - -Wuseless-cast # warn if you perform a cast to the same type ) if (ENABLE_WARNINGS) if (CMAKE_CXX_COMPILER_ID MATCHES ".*Clang")