From 26ef64312a5239e27918206f6f26da3b4a6125cd Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Tue, 11 Jun 2013 14:05:36 -0500 Subject: [svn-r23754] HDFFV-8451/8453: add options to enable more warning messages. Tested: local linux --- CMakeLists.txt | 56 ++++++++++++++++++++++++++++++++++++++ config/cmake/CTestCustom.cmake | 2 +- config/cmake/ConfigureChecks.cmake | 18 ++++++------ 3 files changed, 66 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e14fc21..f0b8019 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -456,6 +456,62 @@ IF (HDF5_DISABLE_COMPILER_WARNINGS) ENDIF (HDF5_DISABLE_COMPILER_WARNINGS) #----------------------------------------------------------------------------- +# Option to allow the user to enable all warnings +#----------------------------------------------------------------------------- +OPTION (HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF) +IF (HDF5_ENABLE_ALL_WARNINGS) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wfloat-equal -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wdisabled-optimization -Wformat=2 -Wendif-labels -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros -Wunsafe-loop-optimizations -Wc++-compat -Wstrict-overflow -Wlogical-op -Wlarger-than=2048 -Wvla -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn") +ENDIF (HDF5_ENABLE_ALL_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +OPTION (HDF5_ENABLE_GROUPZERO_WARNINGS "Enable group one warnings" OFF) +IF (HDF5_ENABLE_GROUPZERO_WARNINGS) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wundef") +ENDIF (HDF5_ENABLE_GROUPZERO_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +OPTION (HDF5_ENABLE_GROUPONE_WARNINGS "Enable group one warnings" OFF) +IF (HDF5_ENABLE_GROUPONE_WARNINGS) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return") +ENDIF (HDF5_ENABLE_GROUPONE_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +OPTION (HDF5_ENABLE_GROUPTWO_WARNINGS "Enable group two warnings" OFF) +IF (HDF5_ENABLE_GROUPTWO_WARNINGS) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline -Wfloat-equal -Wmissing-format-attribute -Wmissing-noreturn -Wpacked -Wdisabled-optimization -Wformat=2") +ENDIF (HDF5_ENABLE_GROUPTWO_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +OPTION (HDF5_ENABLE_GROUPTHREE_WARNINGS "Enable group three warnings" OFF) +IF (HDF5_ENABLE_GROUPTHREE_WARNINGS) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wendif-labels -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros") +ENDIF (HDF5_ENABLE_GROUPTHREE_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +OPTION (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF) +IF (HDF5_ENABLE_GROUPFOUR_WARNINGS) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wunsafe-loop-optimizations -Wc++-compat -Wstrict-overflow -Wlogical-op -Wlarger-than=2048 -Wvla -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat -Wstrict-overflow=5") +ENDIF (HDF5_ENABLE_GROUPFOUR_WARNINGS) + +#----------------------------------------------------------------------------- +# Option to allow the user to enable warnings by groups +#----------------------------------------------------------------------------- +OPTION (HDF5_ENABLE_GROUPFIVE_WARNINGS "Enable group five warnings" OFF) +IF (HDF5_ENABLE_GROUPFIVE_WARNINGS) + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wjump-misses-init -Wunsuffixed-float-constants -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn") +ENDIF (HDF5_ENABLE_GROUPFIVE_WARNINGS) + +#----------------------------------------------------------------------------- # This is in here to help some of the GCC based IDES like Eclipse # and code blocks parse the compiler errors and warnings better. #----------------------------------------------------------------------------- diff --git a/config/cmake/CTestCustom.cmake b/config/cmake/CTestCustom.cmake index d59fc3a..c16f9a6 100644 --- a/config/cmake/CTestCustom.cmake +++ b/config/cmake/CTestCustom.cmake @@ -1,4 +1,4 @@ -SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 1500) +SET (CTEST_CUSTOM_MAXIMUM_NUMBER_OF_WARNINGS 3000) SET (CTEST_CUSTOM_WARNING_EXCEPTION ${CTEST_CUSTOM_WARNING_EXCEPTION} diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index a2e0a03..cce71c7 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -183,14 +183,14 @@ IF (WINDOWS) ENDIF (MINGW) SET (H5_HAVE_LIBWS2_32 1) SET (H5_HAVE_LIBWSOCK32 1) -ENDIF (WINDOWS) -#----------------------------------------------------------------------------- -# These tests need to be manually SET for windows since there is currently -# something not quite correct with the actual test implementation. This affects -# the 'dt_arith' test and most likely lots of other code -# ---------------------------------------------------------------------------- -SET (H5_FP_TO_ULLONG_RIGHT_MAXIMUM "" CACHE INTERNAL "") + #----------------------------------------------------------------------------- + # These tests need to be manually SET for windows since there is currently + # something not quite correct with the actual test implementation. This affects + # the 'dt_arith' test and most likely lots of other code + # ---------------------------------------------------------------------------- + SET (H5_FP_TO_ULLONG_RIGHT_MAXIMUM "" CACHE INTERNAL "") +ENDIF (WINDOWS) # ---------------------------------------------------------------------- # END of WINDOWS Hard code Values @@ -1030,7 +1030,7 @@ H5MiscConversionTest (H5_SIZEOF_LONG_DOUBLE H5_LDOUBLE_TO_INTEGER_ACCURATE "chec # yet. (1/8/05 - SLU) # IF (NOT MSVC) -H5ConversionTests (H5_LDOUBLE_TO_INTEGER_WORKS "Checking IF converting from long double to integers works") + H5ConversionTests (H5_LDOUBLE_TO_INTEGER_WORKS "Checking IF converting from long double to integers works") ENDIF (NOT MSVC) # ----------------------------------------------------------------------- # Set flag to indicate that the machine can handle conversion from @@ -1106,7 +1106,7 @@ ENDIF (H5_LLONG_TO_FP_CAST_WORKS MATCHES ^H5_LLONG_TO_FP_CAST_WORKS$) # the conversion, and Cygwin where compiler doesn't do rounding correctly.) # IF (NOT MSVC) -H5ConversionTests (H5_ULLONG_TO_LDOUBLE_PRECISION "Checking IF converting unsigned long long to long double with precision") + H5ConversionTests (H5_ULLONG_TO_LDOUBLE_PRECISION "Checking IF converting unsigned long long to long double with precision") ENDIF (NOT MSVC) # ---------------------------------------------------------------------- # Set the flag to indicate that the machine can handle overflow converting -- cgit v0.12