From 454b04176ae8daeadcd26bb532ed77c4c051a9c3 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Thu, 16 Aug 2018 15:45:17 -0500 Subject: Update cmake warnings to match the autotools files better --- CMakeInstallation.cmake | 1 + MANIFEST | 1 + config/cmake/HDFCompilerFlags.cmake | 105 ++++---- release_docs/INSTALL_CMake.txt | 25 ++ release_docs/INSTALL_Warnings.txt | 474 ++++++++++++++++++++++++++++++++++++ 5 files changed, 542 insertions(+), 64 deletions(-) create mode 100644 release_docs/INSTALL_Warnings.txt diff --git a/CMakeInstallation.cmake b/CMakeInstallation.cmake index 622f0cf..2339049 100644 --- a/CMakeInstallation.cmake +++ b/CMakeInstallation.cmake @@ -215,6 +215,7 @@ if (NOT HDF5_EXTERNALLY_CONFIGURED) if (HDF5_PACK_INSTALL_DOCS) set (release_files ${release_files} + ${HDF5_SOURCE_DIR}/release_docs/INSTALL_Warnings.txt ${HDF5_SOURCE_DIR}/release_docs/INSTALL_CMake.txt ${HDF5_SOURCE_DIR}/release_docs/HISTORY-1_8.txt ${HDF5_SOURCE_DIR}/release_docs/INSTALL diff --git a/MANIFEST b/MANIFEST index 1165240..046d73b 100644 --- a/MANIFEST +++ b/MANIFEST @@ -445,6 +445,7 @@ ./release_docs/INSTALL_CMake.txt ./release_docs/INSTALL_Cygwin.txt ./release_docs/INSTALL_parallel +./release_docs/INSTALL_Warnings.txt ./release_docs/INSTALL_Windows.txt ./release_docs/RELEASE.txt ./release_docs/USING_HDF5_CMake.txt diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 214afa0..ec13272 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -9,6 +9,8 @@ # If you do not have access to either file, you may request a copy from # help@hdfgroup.org. # + +message (STATUS "Warnings Configuration:") #----------------------------------------------------------------------------- # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- @@ -45,6 +47,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF) if (HDF5_DISABLE_COMPILER_WARNINGS) + message (STATUS "....Compiler warnings are suppressed") # MSVC uses /w to suppress warnings. It also complains if another # warning level is given, so remove it. if (MSVC) @@ -79,79 +82,55 @@ endif () # break into groups (from the config/gnu-flags file) #----------------------------------------------------------------------------- if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) - if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "SunOS") - set (CMAKE_C_FLAGS_5 "${CMAKE_C_FLAGS_5} -Wcast-qual") - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs") - else () + if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -erroff=%none -DBSD_COMP") + else () + # General flags + # + # Note that some of the flags listed here really should be developer + # flags (listed in a separate variable, below) but we put them here + # because they are not raised by the current code and we'd like to + # know if they do start showing up. + # + # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) + # warnings that are emitted. If you need it, add it at configure time. + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wc++-compat -Wcast-align") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings") + # gcc automatically inlines based on the optimization level + # this is just a failsafe + set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") endif () #----------------------------------------------------------------------------- # Option to allow the user to enable developer warnings + # Developer warnings (suggestions from gcc, not code problems) #----------------------------------------------------------------------------- option (HDF5_ENABLE_DEV_WARNINGS "Enable HDF5 developer group warnings" OFF) if (HDF5_ENABLE_DEV_WARNINGS) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Winline -Waggregate-return") - else () - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-parameter -Wno-inline -Wno-aggregate-return") - endif () - - # Append warning flags - # Don't use the '-Wtraditional' flag, we're way past having K&R C code - # set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional") - # Don't use the '-Wtraditional-conversion' flag, there's too many warnings - # from GCC's assert macro - # set (H5_CFLAGS "${H5_CFLAGS} -Wtraditional-conversion") - - # Append warning flags from gcc-3* case - # (don't use -Wpadded flag for normal builds, many of the warnings its - # issuing can't be fixed and they are making it hard to detect other, - # more important warnings) - #set (H5_CFLAGS "${H5_CFLAGS} -Wfloat-equal -Wmissing-format-attribute -Wpadded") - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wfloat-equal -Wmissing-format-attribute") - - # Append warning flags from gcc-3.2* case - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wpacked -Wdisabled-optimization") - if (HDF5_ENABLE_DEV_WARNINGS) - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wmissing-noreturn") + message (STATUS "....HDF5 developer group warnings are enabled") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Waggregate-return -Wmissing-format-attribute -Wmissing-noreturn") else () - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wno-missing-noreturn") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-inline -Wno-aggregate-return -Wno-missing-format-attribute -Wno-missing-noreturn") endif () - # Enable more format checking flags, beyond the basic -Wformat included - # in -Wall - set (H5_CFLAGS1_5 "${H5_CFLAGS1_5} -Wformat=2") - - # Append warning flags from gcc-3.3* case - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wendif-labels") - - # Append warning flags from gcc-3.4* case - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wdeclaration-after-statement -Wold-style-definition -Winvalid-pch") - - # Append more extra warning flags that only gcc4.0+ know about - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros") - - # Append more extra warning flags that only gcc 4.1+ know about - set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wunsafe-loop-optimizations") - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wc++-compat") - # Append more extra warning flags that only gcc 4.2+ know about - set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wstrict-overflow") - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-strict-overflow") - - # Append more extra warning flags that only gcc 4.3+ know about + # Append warning flags that only gcc 4.3+ knows about # # Technically, variable-length arrays are part of the C99 standard, but # we should approach them a bit cautiously... -QAK - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wlogical-op -Wlarger-than=2048 -Wvla") + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2048 -Wvla") # Append more extra warning flags that only gcc 4.4+ know about - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") # Append more extra warning flags that only gcc 4.5+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) - set (H5_CFLAGS2_5 "${H5_CFLAGS2_5} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wjump-misses-init -Wunsuffixed-float-constants") + set (H5_CFLAGS1 "${H5_CFLAGS1} -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants") endif () # Append more extra warning flags that only gcc 4.6+ know about @@ -164,12 +143,6 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif () endif () - # The "unreachable code" warning appears to be reliable now... - # (this warning was removed in gcc 4.5+) - if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wunreachable-code") - endif () - # Append more extra warning flags that only gcc 4.7+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) set (H5_CFLAGS2 "${H5_CFLAGS2} -Wstack-usage=8192 -Wvector-operation-performance") @@ -191,11 +164,9 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # Append more extra warning flags that only gcc 4.9+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time -Wopenmp-simd") + set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time") endif () - # (There was no release of gcc 5.0) - # Append more extra warning flags that only gcc 5.1+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) set (H5_CFLAGS3 "${H5_CFLAGS3} -Warray-bounds=2 -Wc99-c11-compat") @@ -213,6 +184,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF) if (HDF5_ENABLE_ALL_WARNINGS) + message (STATUS "....All Warnings are enabled") if (MSVC) if (HDF5_ENABLE_DEV_WARNINGS) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") @@ -231,7 +203,7 @@ if (HDF5_ENABLE_ALL_WARNINGS) endif () else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic ${H5_CFLAGS1} ${H5_CFLAGS2}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2}") endif () endif () endif () @@ -241,6 +213,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPZERO_WARNINGS "Enable group zero warnings" OFF) if (HDF5_ENABLE_GROUPZERO_WARNINGS) + message (STATUS "....Group Zero warnings are enabled") if (MSVC) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W1") @@ -250,7 +223,7 @@ if (HDF5_ENABLE_GROUPZERO_WARNINGS) endif () else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -pedantic") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0}") endif () endif () endif () @@ -260,6 +233,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPONE_WARNINGS "Enable group one warnings" OFF) if (HDF5_ENABLE_GROUPONE_WARNINGS) + message (STATUS "....Group One warnings are enabled") if (MSVC) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W2") @@ -277,6 +251,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPTWO_WARNINGS "Enable group two warnings" OFF) if (HDF5_ENABLE_GROUPTWO_WARNINGS) + message (STATUS "....Group Two warnings are enabled") if (MSVC) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W3") @@ -294,6 +269,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPTHREE_WARNINGS "Enable group three warnings" OFF) if (HDF5_ENABLE_GROUPTHREE_WARNINGS) + message (STATUS "....Group Three warnings are enabled") if (MSVC) string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /W4") @@ -311,6 +287,7 @@ endif () #----------------------------------------------------------------------------- option (HDF5_ENABLE_GROUPFOUR_WARNINGS "Enable group four warnings" OFF) if (HDF5_ENABLE_GROUPFOUR_WARNINGS) + message (STATUS "....Group Four warnings are enabled") if (NOT MSVC) set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS4}") endif () diff --git a/release_docs/INSTALL_CMake.txt b/release_docs/INSTALL_CMake.txt index 708e713..728fd05 100644 --- a/release_docs/INSTALL_CMake.txt +++ b/release_docs/INSTALL_CMake.txt @@ -12,6 +12,7 @@ Section IV: Further considerations Section V: Options for building HDF5 Libraries with CMake command line Section VI: CMake option defaults for HDF5 Section VII: User Defined Options for HDF5 Libraries with CMake +Section VIII: User Defined Compile Flags for HDF5 Libraries with CMake ************************************************************************ @@ -663,6 +664,30 @@ Copy the contents of the file, both macro and option, into the UserMacros.cmake file. Then enable the option to the CMake configuration, build and test process. + +======================================================================== +VIII. User Defined Compile Flags for HDF5 Libraries with CMake +======================================================================== + +Custom compiler flags can be added by defining the CMAKE_C_FLAGS and +CMAKE_CXX_FLAGS variables. +Using a cmake script: + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O2") +Defined on the configure line: + cmake -G "Visual Studio 12 2013" -DCMAKE_C_FLAGS:STRING=-O2 .. + +Debug symbols are enabled with configuration selections Debug or RelWithDebInfo. +The difference between Debug and RelWithDebInfo configurations is that +RelWithDebInfo optimizes the code similar to Release. It produces fully optimized +code, but also creates the symbol table and the debug metadata to give the +debugger input to map the execution back to the original code. +RelwithDebInfo configuration should not affect the performance when the code +is run without a debugger attached. + +The HDF5_ENABLE_COVERAGE option will add "-g -O0 -fprofile-arcs -ftest-coverage" +to CMAKE_C_FLAGS. + + ======================================================================== For further assistance, send email to help@hdfgroup.org ======================================================================== diff --git a/release_docs/INSTALL_Warnings.txt b/release_docs/INSTALL_Warnings.txt new file mode 100644 index 0000000..5fde45f --- /dev/null +++ b/release_docs/INSTALL_Warnings.txt @@ -0,0 +1,474 @@ +*********************************************************************** +* COMPILER WARNINGS OPTIONS +*********************************************************************** + + Table of Contents + +Section I: Managing Warnings +Section II: Default Warnings +Section III: All Warnings +Section IV: Group 0 Warnings +Section V: Group 1 Warnings +Section VI: Group 2 Warnings +Section VII: Group 3 Warnings +Section VIII: Group 4 Warnings +Section IX: Disable Warnings + +************************************************************************ + + +======================================================================== +I. Managing Warnings +======================================================================== +Compiler warnings are managed by setting the compiler flags variables. + +Autotools uses the H5_CFLAGS and H5_CXXFLAGS, both variables set the flags nearly + identical, along with H5_FCFLAGS for Fortran. Autotools uses the type + and version of the compiler to determine which warning flags are used. + However, there is an option, enable-developer-warnings, to enable extra + flags for developers. + +CMake uses the CMAKE_C_FLAGS and CMAKE_CXX_FLAGS, both sets are nearly + identical, along with CMAKE_Fortran_FLAGS for Fortran. CMake has a + minimum set of flags for GNU type compilers and for MSVC compilers. In + addition, CMake breaks the list of flags into groups. The groups for + GNU are roughly associated with the version of the compiler, while + the MSVC groups are associated with the warning levels for the + Microsoft compilers. The CMake option for enabling extra developer + warnings is HDF5_ENABLE_DEV_WARNINGS. + +Custom settings can be used by setting; + Environment variables H5_CFLAGS and H5_CXXFLAGS for Autotools + CMake defines CMAKE_C_FLAGS and CMAKE_CXX_FLAGS for CMake + + +======================================================================== +II. Default Warnings +======================================================================== + +-------------------------------------------------- +Autotools UNIX warnings added to H5_CFLAGS +-------------------------------------------------- + -std=c99 + + the following warning switches should not raise warnings by the current code + -pedantic + -Wall + -Wextra + -Wbad-function-cast + -Wc++-compat + -Wcast-align + -Wcast-qual + -Wconversion + -Wdeclaration-after-statement + -Wdisabled-optimization + -Wfloat-equal + -Wformat=2 + -Winit-self + -Winvalid-pch + -Wmissing-declarations + -Wmissing-include-dirs + -Wmissing-prototypes + -Wnested-externs + -Wold-style-definition + -Wpacked + -Wpointer-arith + -Wredundant-decls + -Wshadow + -Wstrict-prototypes + -Wswitch-default + -Wswitch-enum + -Wundef + -Wunused-macros + -Wunsafe-loop-optimizations + -Wwrite-strings + + enable-developer-warnings=ON + -Winline + -Waggregate-return + -Wmissing-format-attribute + -Wmissing-noreturn + enable-developer-warnings=OFF + -Wno-inline + -Wno-aggregate-return + -Wno-missing-format-attribute + -Wno-missing-noreturn + +IF GCC <= 4.3 + -Wno-long-long + -Wvolatile-register-var + -Wstrict-overflow + +IF GCC <= 4.4 + -Wno-long-long + -Wvolatile-register-var + -Wstrict-overflow + -Wlogical-op + -Wvla + +IF GCC <= 4.5 + -Wno-long-long + -Wvolatile-register-var + -Wstrict-overflow + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + +IF GCC <= 4.6 + -Wno-long-long + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-aliasing + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + +IF GCC <= 4.7 + -Wno-long-long + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-aliasing + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + enable-developer-warnings=ON: + -Wsuggest-attribute=const + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + +IF GCC <= 4.8 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + +IF GCC <= 4.9 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + -Wno-suggest-attribute=format + +IF GCC < 5 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + -Wdate-time + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + -Wno-suggest-attribute=format + +IF GCC < 6 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + -Wdate-time + -Warray-bounds=2 + -Wc99-c11-compat + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + -Wno-suggest-attribute=format + +IF GCC < 7 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + -Wdouble-promotion + -Wtrampolines + -Wstack-usage=8192 + -Wvector-operation-performance + -Wdate-time + -Warray-bounds=2 + -Wc99-c11-compat + -Wnull-dereference + -Wunused-const-variable + -Wduplicated-cond -Whsa + enable-developer-warnings=ON: + -Wsuggest-attribute=const + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + -Wno-suggest-attribute=format + + +-------------------------------------------- +CMake warnings added to CMAKE_C_FLAGS +-------------------------------------------- + +IF GNU GCC + -pedantic + -Wall + -Wextra + -Wbad-function-cast + -Wc++-compat + -Wcast-align + -Wcast-qual + -Wconversion + -Wdeclaration-after-statement + -Wdisabled-optimization + -Wfloat-equal + -Wformat=2 + -Winit-self + -Winvalid-pch + -Wmissing-declarations + -Wmissing-include-dirs + -Wmissing-prototypes + -Wnested-externs + -Wold-style-definition + -Wpacked + -Wpointer-arith + -Wredundant-decls + -Wshadow + -Wstrict-prototypes + -Wswitch-default + -Wswitch-enum + -Wundef + -Wunused-macros + -Wunsafe-loop-optimizations + -Wwrite-strings + + -fmessage-length=0 + HDF5_ENABLE_DEV_WARNINGS=ON + -Winline + -Waggregate-return + HDF5_ENABLE_DEV_WARNINGS=OFF + -Wno-unused-parameter + -Wno-inline + -Wno-aggregate-return + + +======================================================================== +III. All Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_DEV_WARNINGS:BOOL=OFF + For Visual Studio: + /W3 + +HDF5_ENABLE_ALL_WARNINGS:BOOL=ON + For Visual Studio: + /Wall + /wd4668 + + For GNU GCC + Group 0 flags + Group 1 flags + Group 2 flags + + +======================================================================== +IV. Group 0 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPZERO_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPZERO_WARNINGS:BOOL=ON + For Visual Studio + /W1 + + For GNU GCC + Default Warnings + + +======================================================================== +V. Group 1 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPONE_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPONE_WARNINGS:BOOL=ON + For Visual Studio + /W2 + + For GNU GCC + IF GCC >= 4.3 + -Wlogical-op + -Wvla + -Wlarger-than=2048 + IF GCC >= 4.4 + -Wsync-nand + -Wframe-larger-than=16384 + -Wpacked-bitfield-compat + IF GCC >= 4.5 + -Wstrict-overflow=5 + -Wjump-misses-init + -Wunsuffixed-float-constants + + +======================================================================== +VI. Group 2 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPTWO_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPTWO_WARNINGS:BOOL=ON + For Visual Studio + /W3 + + For GNU GCC + IF GCC >= 4.6 + -Wdouble-promotion + -Wtrampolines + enable-developer-warnings=ON: + -Wsuggest-attribute=const + enable-developer-warnings=OFF: + -Wno-suggest-attribute=const + IF GCC >= 4.7 + -Wstack-usage=8192 + -Wvector-operation-performance + enable-developer-warnings=ON: + -Wsuggest-attribute=pure + -Wsuggest-attribute=noreturn + enable-developer-warnings=OFF: + -Wno-suggest-attribute=pure + -Wno-suggest-attribute=noreturn + IF GCC >= 4.8 + enable-developer-warnings=ON: + -Wsuggest-attribute=format + enable-developer-warnings=OFF: + -Wno-suggest-attribute=format + IF GCC >= 4.8 + -Wdate-time + + +======================================================================== +VII. Group 3 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPTHREE_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPTHREE_WARNINGS:BOOL=ON + For Visual Studio + /W4 + + For GNU GCC + IF GCC >= 5.1 + -Warray-bounds=2 + -Wc99-c11-compat + + +======================================================================== +VIII. Group 4 Warnings in CMake +======================================================================== + +Default: HDF5_ENABLE_GROUPFOUR_WARNINGS:BOOL=OFF + +HDF5_ENABLE_GROUPFOUR_WARNINGS:BOOL=ON + For GNU GCC + IF GCC >= 6.0 + -Wnull-dereference + -Wunused-const-variable + -Wduplicated-cond + -Whsa + + +======================================================================== +IX. Disable Warnings in CMake +======================================================================== + +Default: HDF5_DISABLE_COMPILER_WARNINGS:BOOL=OFF + +HDF5_DISABLE_COMPILER_WARNINGS:BOOL=ON + For Visual Studio + HDF5_WARNINGS_BLOCKED:BOOL=ON + /W0 + + For GNU GCC + -w + + +======================================================================== +For further assistance, send email to help@hdfgroup.org +======================================================================== + -- cgit v0.12