build: compiler warnings handling refactored for clang

This commit is contained in:
Mateusz Pusz
2021-03-15 18:47:21 +01:00
parent 533595d669
commit c46ea4460f

View File

@ -53,7 +53,7 @@ macro(_set_flags)
/permissive- # standards conformance mode for MSVC compiler.
)
set(CLANG_WARNINGS
set(GCC_COMMON_WARNINGS
-Wall
-Wextra # reasonable and standard
-Wpedantic # warn if non-standard C++ is used
@ -67,17 +67,17 @@ macro(_set_flags)
-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)
)
set(CLANG_WARNINGS
${GCC_COMMON_WARNINGS}
-Wno-missing-braces
)
set(GCC_WARNINGS
${CLANG_WARNINGS}
-Wno-float-conversion
-Wno-shorten-64-to-32
-Wno-implicit-float-conversion
-Wno-implicit-int-float-conversion
-Wno-implicit-int-conversion
${GCC_COMMON_WARNINGS}
-Wdouble-promotion # warn if float is implicit promoted to double
-Wmisleading-indentation # warn if indentation implies blocks where blocks do not exist
-Wduplicated-cond # warn if if / else chain has duplicated conditions
-Wduplicated-branches # warn if if / else branches have duplicated code