diff options
-rw-r--r-- | JaulibSetup.cmake | 11 | ||||
-rw-r--r-- | include/jau/cpp_pragma.hpp | 13 | ||||
-rw-r--r-- | include/jau/functional.hpp | 1 |
3 files changed, 21 insertions, 4 deletions
diff --git a/JaulibSetup.cmake b/JaulibSetup.cmake index cecda73..9e8e77d 100644 --- a/JaulibSetup.cmake +++ b/JaulibSetup.cmake @@ -218,19 +218,22 @@ message(STATUS "JaulibSetup: cxx_clangd_flags: ${cxx_clangd_flags}") set(CMAKE_EXPORT_COMPILE_COMMANDS ON) -# for all +# for ALL set (CC_FLAGS_WARNING "-pedantic -pedantic-errors -Wall -Wextra -Werror") + +# for GCC set (GCC_FLAGS_WARNING_FORMAT "-Wformat=2 -Wformat-overflow=2 -Wformat-nonliteral -Wformat-security -Wformat-signedness -Wformat-y2k") -set (GCC_FLAGS_WARNING "-Wall -Wextra -Wshadow -Wtype-limits -Wsign-compare -Wcast-align=strict -Wnull-dereference -Winit-self ${GCC_FLAGS_WARNING_FORMAT} -Werror") +set (GCC_FLAGS_WARNING "${CC_FLAGS_WARNING} -Wshadow -Wtype-limits -Wsign-compare -Wcast-align=strict -Wnull-dereference -Winit-self ${GCC_FLAGS_WARNING_FORMAT}") # causes issues in jau::get_int8(..): "-Wnull-dereference" set (GCC_FLAGS_WARNING_NO_ERROR "-Wno-error=array-bounds -Wno-error=null-dereference -Wno-multichar") # too pedantic, but nice to check once in a while # set (DISABLED_CC_FLAGS_WARNING "-Wsign-conversion") +# for CLANG set (CLANG_FLAGS_WARNING_NO_ERROR "") -# debug only +# debug only GCC set (GCC_FLAGS_STACK "-fstack-protector-strong") set (GCC_FLAGS_SANITIZE_ALL "-fsanitize-address-use-after-scope -fsanitize=address -fsanitize=pointer-compare -fsanitize=pointer-subtract -fsanitize=undefined -fsanitize=leak -fsanitize-recover=address") set (GCC_FLAGS_SANITIZE_UNDEFINED "-fsanitize=undefined -fsanitize-recover=address") @@ -244,7 +247,7 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GCC_FLAGS_WARNING} ${GCC_FLAGS_WARNING_NO_ERROR} -fmacro-prefix-map=${CMAKE_SOURCE_DIR}/=/") elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CC_FLAGS_WARNING} ${CLANG_FLAGS_WARNING_NO_ERROR}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CC_FLAGS_WARNING} ${CLANG_FLAGS_WARNING_NO_ERROR} -fmacro-prefix-map=${CMAKE_SOURCE_DIR}/=/") else() set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CC_FLAGS_WARNING}") diff --git a/include/jau/cpp_pragma.hpp b/include/jau/cpp_pragma.hpp index 2f706a6..43ab397 100644 --- a/include/jau/cpp_pragma.hpp +++ b/include/jau/cpp_pragma.hpp @@ -45,6 +45,11 @@ namespace jau { #define PRAGMA_DISABLE_WARNING_FORMAT_OVERFLOW #define PRAGMA_DISABLE_WARNING_FORMAT_NONLITERAL #define PRAGMA_DISABLE_WARNING_PMF_CONVERSIONS + #define PRAGMA_DISABLE_WARNING_STRINGOP_OVERFLOW + #define PRAGMA_DISABLE_WARNING_INT_OVERFLOW + #define PRAGMA_DISABLE_WARNING_RESTRICT + #define PRAGMA_DISABLE_WARNING_PEDANTIC + #define PRAGMA_DISABLE_WARNING_ZERO_LENGTH_ARRAY #elif defined(__GNUC__) || defined(__clang__) #define DO_PRAGMA(X) _Pragma(#X) @@ -65,11 +70,15 @@ namespace jau { #define PRAGMA_DISABLE_WARNING_STRINGOP_OVERFLOW PRAGMA_DISABLE_WARNING(-Wstringop-overflow) #define PRAGMA_DISABLE_WARNING_INT_OVERFLOW #define PRAGMA_DISABLE_WARNING_RESTRICT PRAGMA_DISABLE_WARNING(-Wrestrict) + #define PRAGMA_DISABLE_WARNING_PEDANTIC PRAGMA_DISABLE_WARNING(-Wpedantic) + #define PRAGMA_DISABLE_WARNING_ZERO_LENGTH_ARRAY #else #define PRAGMA_DISABLE_WARNING_PMF_CONVERSIONS #define PRAGMA_DISABLE_WARNING_STRINGOP_OVERFLOW #define PRAGMA_DISABLE_WARNING_INT_OVERFLOW PRAGMA_DISABLE_WARNING(-Winteger-overflow) #define PRAGMA_DISABLE_WARNING_RESTRICT + #define PRAGMA_DISABLE_WARNING_PEDANTIC PRAGMA_DISABLE_WARNING(-Wpedantic) + #define PRAGMA_DISABLE_WARNING_ZERO_LENGTH_ARRAY PRAGMA_DISABLE_WARNING(-Wzero-length-array) #endif #else @@ -84,6 +93,10 @@ namespace jau { #define PRAGMA_DISABLE_WARNING_FORMAT_NONLITERAL #define PRAGMA_DISABLE_WARNING_PMF_CONVERSIONS #define PRAGMA_DISABLE_WARNING_STRINGOP_OVERFLOW + #define PRAGMA_DISABLE_WARNING_INT_OVERFLOW + #define PRAGMA_DISABLE_WARNING_RESTRICT + #define PRAGMA_DISABLE_WARNING_PEDANTIC + #define PRAGMA_DISABLE_WARNING_ZERO_LENGTH_ARRAY #endif diff --git a/include/jau/functional.hpp b/include/jau/functional.hpp index a7e9d53..63c993c 100644 --- a/include/jau/functional.hpp +++ b/include/jau/functional.hpp @@ -807,6 +807,7 @@ namespace jau { { PRAGMA_DISABLE_WARNING_PUSH PRAGMA_DISABLE_WARNING_PMF_CONVERSIONS + PRAGMA_DISABLE_WARNING_PEDANTIC function = (function_t)(_base->*_method); PRAGMA_DISABLE_WARNING_POP } |