diff options
-rw-r--r-- | config/cmake/HDFCompilerFlags.cmake | 113 | ||||
-rw-r--r-- | config/gnu-warnings/error-5 | 7 | ||||
-rw-r--r-- | config/gnu-warnings/error-general | 76 | ||||
-rw-r--r-- | config/sanitizer/sanitizers.cmake | 109 | ||||
-rw-r--r-- | config/toolchain/intel.cmake | 13 | ||||
-rw-r--r-- | release_docs/RELEASE.txt | 15 |
6 files changed, 232 insertions, 101 deletions
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index c395193..31ba748 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -131,12 +131,8 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) ADD_H5_FLAGS (CMAKE_C_FLAGS_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") message (STATUS "CMAKE_C_FLAGS_GENERAL=${CMAKE_C_FLAGS_GENERAL}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_GENERAL}") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wcast-align") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wdeclaration-after-statement -Wdisabled-optimization") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-declarations") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wredundant-decls -Wstrict-prototypes -Wswitch-enum -Wswitch-default") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunused-macros -Wunsafe-loop-optimizations") + ADD_H5_FLAGS (CMAKE_C_FLAGS_ERROR_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") + set (H5_CFLAGS0 "${H5_CFLAGS0} ${CMAKE_C_FLAGS_ERROR_GENERAL}") # gcc automatically inlines based on the optimization level # this is just a failsafe set (H5_CFLAGS0 "${H5_CFLAGS0} -finline-functions") @@ -167,82 +163,137 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) if (CMAKE_C_COMPILER_ID STREQUAL "GNU") # Append warning flags that only gcc 4.3+ knows about + ADD_H5_FLAGS (CMAKE_C_FLAGS_4_3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.3") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_3}") # # Technically, variable-length arrays are part of the C99 standard, but - # we should approach them a bit cautiously... -QAK - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wlogical-op -Wlarger-than=2560 -Wvla") + # we should approach them a bit cautiously... Only needed for gcc 4.X + if (CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + ADD_H5_FLAGS (CMAKE_C_FLAGS_4_LAST "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.last") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_LAST}") + endif () # Append more extra warning flags that only gcc 4.4+ know about - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat") + if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.4) + ADD_H5_FLAGS (CMAKE_C_FLAGS_4_4 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.4") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_4}") + endif () endif () # Append more extra warning flags that only gcc 4.5+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5) - set (H5_CFLAGS1 "${H5_CFLAGS1} -Wstrict-overflow=5 -Wjump-misses-init") - if (HDF5_ENABLE_DEV_WARNINGS) - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wunsuffixed-float-constants") - else () - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wno-unsuffixed-float-constants") - endif () + ADD_H5_FLAGS (CMAKE_C_FLAGS_4_5 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_5}") + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_4_5 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.5") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_DEV_4_5}") + else () + ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_4_5 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.5") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_NO_DEV_4_5}") + endif () + endif () + + # Append more extra warning flags that only gcc 4.6 and less know about + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + ADD_H5_FLAGS (CMAKE_C_FLAGS_4_2_4_6 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.2-4.6") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_2_4_6}") + endif () + + # Append more extra warning flags that only gcc 4.5-4.6 know about + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.5 AND CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) + ADD_H5_FLAGS (CMAKE_C_FLAGS_4_5_4_6 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.5-4.6") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_5_4_6}") endif () # Append more extra warning flags that only gcc 4.6+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.6) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdouble-promotion -Wtrampolines") + ADD_H5_FLAGS (CMAKE_C_FLAGS_4_6 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.6") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_6}") if (HDF5_ENABLE_DEV_WARNINGS) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=const") + ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_4_6 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.6") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_DEV_4_6}") else () - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-suggest-attribute=const") + ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_4_6 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.6") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_NO_DEV_4_6}") endif () endif () # Append more extra warning flags that only gcc 4.7+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.7) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wstack-usage=8192 -Wvector-operation-performance") + ADD_H5_FLAGS (CMAKE_C_FLAGS_4_7 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.7") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_7}") if (HDF5_ENABLE_DEV_WARNINGS) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn") + ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_4_7 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.7") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_DEV_4_7}") else () - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn") + ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_4_7 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.7") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_NO_DEV_4_7}") endif () endif () # Append more extra warning flags that only gcc 4.8+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.8) + ADD_H5_FLAGS (CMAKE_C_FLAGS_4_8 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.8") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_8}") if (HDF5_ENABLE_DEV_WARNINGS) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wsuggest-attribute=format") + ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_4_8 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-4.8") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_DEV_4_8}") else () - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wno-suggest-attribute=format") + ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_4_8 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-4.8") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_NO_DEV_4_8}") endif () endif () # Append more extra warning flags that only gcc 4.9+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 4.9) - set (H5_CFLAGS2 "${H5_CFLAGS2} -Wdate-time") + ADD_H5_FLAGS (CMAKE_C_FLAGS_4_9 "${HDF5_SOURCE_DIR}/config/gnu-warnings/4.9") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_4_9}") endif () # Append more extra warning flags that only gcc 5.1+ know about - if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.1) - set (H5_CFLAGS3 "${H5_CFLAGS3} -Warray-bounds=2 -Wc99-c11-compat") + if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) + ADD_H5_FLAGS (CMAKE_C_FLAGS_5 "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_5}") + ADD_H5_FLAGS (CMAKE_C_FLAGS_ERROR_5 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_ERROR_5}") endif () # Append more extra warning flags that only gcc 6.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 6.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized") + ADD_H5_FLAGS (CMAKE_C_FLAGS_6 "${HDF5_SOURCE_DIR}/config/gnu-warnings/6") + set (H5_CFLAGS1 "${H5_CFLAGS1} ${CMAKE_C_FLAGS_6}") endif () # Append more extra warning flags that only gcc 7.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wimplicit-fallthrough=5 -Wrestrict") + ADD_H5_FLAGS (CMAKE_C_FLAGS_7 "${HDF5_SOURCE_DIR}/config/gnu-warnings/7") + set (H5_CFLAGS2 "${H5_CFLAGS2} ${CMAKE_C_FLAGS_7}") + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_7 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-7") + set (H5_CFLAGS2 "${H5_CFLAGS2} ${CMAKE_C_FLAGS_DEV_7}") + #else () + # ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_7 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-7") + # set (H5_CFLAGS2 "${H5_CFLAGS2} ${CMAKE_C_FLAGS_NO_DEV_7}") + endif () endif () # Append more extra warning flags that only gcc 8.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2 -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc") + ADD_H5_FLAGS (CMAKE_C_FLAGS_8 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") + set (H5_CFLAGS3 "${H5_CFLAGS3} ${CMAKE_C_FLAGS_8}") + if (HDF5_ENABLE_DEV_WARNINGS) + ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_8 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") + set (H5_CFLAGS3 "${H5_CFLAGS3} ${CMAKE_C_FLAGS_DEV_8}") + else () + ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_8 "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-8") + set (H5_CFLAGS3 "${H5_CFLAGS3} ${CMAKE_C_FLAGS_NO_DEV_8}") + endif () endif () # Append more extra warning flags that only gcc 9.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 9.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Wattribute-alias=2 -Wmissing-profile") + ADD_H5_FLAGS (CMAKE_C_FLAGS_9 "${HDF5_SOURCE_DIR}/config/gnu-warnings/9") + set (H5_CFLAGS4 "${H5_CFLAGS4} ${CMAKE_C_FLAGS_9}") endif () elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Minform=inform") @@ -272,7 +323,7 @@ if (HDF5_ENABLE_ALL_WARNINGS) endif () else () if (CMAKE_COMPILER_IS_GNUCC) - set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2}") + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4}") endif () endif () endif () diff --git a/config/gnu-warnings/error-5 b/config/gnu-warnings/error-5 index f7e1138..74137b5 100644 --- a/config/gnu-warnings/error-5 +++ b/config/gnu-warnings/error-5 @@ -9,4 +9,9 @@ # is not a supported compiler, so let us promote shadowed globals # warnings to errors only for GCC 5 and later. # --Werror=shadow +# +# +# NOTE: JNI files are not compatible with these warnings as errors +# jni/h5aImp.c,jni/h5eImp.c,jni/h5lImp.c,jni/h5oImp.c +# -Werror=shadow +-Wshadow diff --git a/config/gnu-warnings/error-general b/config/gnu-warnings/error-general index d0e272a..55c86db 100644 --- a/config/gnu-warnings/error-general +++ b/config/gnu-warnings/error-general @@ -3,22 +3,78 @@ # circumstances, so ask the compiler to treat them as errors: # -Werror=bad-function-cast --Werror=cast-align -Werror=declaration-after-statement --Werror=format -Werror=implicit-function-declaration --Werror=missing-declarations --Werror=missing-prototypes -Werror=nested-externs --Werror=old-style-definition -Werror=packed -Werror=pointer-sign -Werror=pointer-to-int-cast -Werror=redundant-decls --Werror=strict-prototypes -Werror=switch --Werror=unused-but-set-variable --Werror=unused-function --Werror=unused-parameter --Werror=unused-variable #-Werror=discarded-qualifiers +# +# NOTE: CMake FortranCInterface module fails to compile with +# -Werror=missing-declarations +# -Werror=missing-prototypes +-Wmissing-declarations +-Wmissing-prototypes +# +# NOTE: File Driver files are not compatible with these warnings as errors +# H5FDdirect.c,H5FDmpio.c,H5FDros3.c, +# -Werror=unused-function +-Wunused-function +# H5FDdrvr_module.h +# -Werror=unused-variable +-Wunused-variable +# H5VLpassthru.c +# -Werror=unused-parameter +-Wunused-parameter +# +# +# NOTE: Examples files are not compatible with these warnings as errors +# h5_vds-eiger.c,h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c,h5_vds-percival-unlim-maxmin.c +# h5_vds-percival.c,h5_read.c,h5_rdwt.c,h5_mount.c,h5_extend.c,h5_extend_write.c +# h5_write.c,h5_vds-simpleIO.c,h5_ref2reg_deprec.c,h5_crtgrp.c,h5_select.c +# h5_vds-percival-unlim.c,h5_crtatt.c,h5_group.c,h5_attribute.c,h5_crtdat.c +# h5_reference_deprec.c +# -Werror=unused-but-set-variable +-Wunused-but-set-variable +# h5_vds-exclim.c,h5_vds.c,h5_vds-exc.c, +# -Werror=unused-variable +# h5_elink_unix2win.c,h5_extlink.c,h5_attribute.c +# -Werror=unused-parameter +# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c +# -Werror=strict-prototypes +-Wstrict-prototypes +# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c +# -Werror=old-style-definition +-Wold-style-definition +# +# +# NOTE: Tools files are not compatible with these warnings as errors +# lib/h5tools.c +# -Werror=cast-align +-Wcast-align +# lib/h5diff_array.c +# -Werror=unused-but-set-variable +# lib/h5tools_utils.c +# -Werror=unused-parameter +# +# +# NOTE: Test files are not compatible with these warnings as errors +# thread_id.c, +# -Werror=unused-function +# dsets.c +# -Werror=unused-parameter +# external.c,perform/sio_engine.c +# -Werror=format(-trunaction) +-Wformat +# +# +# NOTE: JNI files are not compatible with these warnings as errors +# jni/h5pDCPLImp.c,jni/nativeData.c,jni/h5util.c,jni/h5rImp.c +# jni/h5sImp.c,jni/h5tImp.c +# -Werror=cast-align +# jni/h5util.c +# -Werror=format(-overflow) + diff --git a/config/sanitizer/sanitizers.cmake b/config/sanitizer/sanitizers.cmake index ecee2de..0803279 100644 --- a/config/sanitizer/sanitizers.cmake +++ b/config/sanitizer/sanitizers.cmake @@ -29,69 +29,66 @@ function(append value) endfunction() message(STATUS "USE_SANITIZER=${USE_SANITIZER}, CMAKE_C_COMPILER_ID=${CMAKE_C_COMPILER_ID}") -if(USE_SANITIZER AND "${CMAKE_C_COMPILER_ID}" MATCHES "Clang") - set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +if(USE_SANITIZER) + if(INTEL_CLANG OR "${CMAKE_C_COMPILER_ID}" MATCHES "Clang") + set(CMAKE_EXPORT_COMPILE_COMMANDS ON) - append("-fno-omit-frame-pointer" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - message(STATUS "Building with sanitize, base flags=${CMAKE_C_SANITIZER_FLAGS}") + append("-fno-omit-frame-pointer" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + message(STATUS "Building with sanitize, base flags=${CMAKE_C_SANITIZER_FLAGS}") - if(UNIX) - - if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") - append("-O1" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - endif() + if(UNIX) + if(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG") + append("-O1" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + endif() - if(USE_SANITIZER MATCHES "([Aa]ddress);([Uu]ndefined)" - OR USE_SANITIZER MATCHES "([Uu]ndefined);([Aa]ddress)") - message(STATUS "Building with Address, Undefined sanitizers") - append("-fsanitize=address,undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - set(MEMCHECK_TYPE AddressSanitizer) - elseif(USE_SANITIZER MATCHES "([Aa]ddress)") - # Optional: -fno-optimize-sibling-calls -fsanitize-address-use-after-scope - message(STATUS "Building with Address sanitizer") - append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - set(MEMCHECK_TYPE AddressSanitizer) - elseif(USE_SANITIZER MATCHES "([Mm]emory([Ww]ith[Oo]rigins)?)") - # Optional: -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 - append("-fsanitize=memory" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - if(USE_SANITIZER MATCHES "([Mm]emory[Ww]ith[Oo]rigins)") - message(STATUS "Building with MemoryWithOrigins sanitizer") - append("-fsanitize-memory-track-origins" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + if(USE_SANITIZER MATCHES "([Aa]ddress);([Uu]ndefined)" + OR USE_SANITIZER MATCHES "([Uu]ndefined);([Aa]ddress)") + message(STATUS "Building with Address, Undefined sanitizers") + append("-fsanitize=address,undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + set(MEMCHECK_TYPE AddressSanitizer) + elseif(USE_SANITIZER MATCHES "([Aa]ddress)") + # Optional: -fno-optimize-sibling-calls -fsanitize-address-use-after-scope + message(STATUS "Building with Address sanitizer") + append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + set(MEMCHECK_TYPE AddressSanitizer) + elseif(USE_SANITIZER MATCHES "([Mm]emory([Ww]ith[Oo]rigins)?)") + # Optional: -fno-optimize-sibling-calls -fsanitize-memory-track-origins=2 + append("-fsanitize=memory" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + if(USE_SANITIZER MATCHES "([Mm]emory[Ww]ith[Oo]rigins)") + message(STATUS "Building with MemoryWithOrigins sanitizer") + append("-fsanitize-memory-track-origins" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + else() + message(STATUS "Building with Memory sanitizer") + endif() + set(MEMCHECK_TYPE MemorySanitizer) + elseif(USE_SANITIZER MATCHES "([Uu]ndefined)") + message(STATUS "Building with Undefined sanitizer") + append("-fsanitize=undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + if(EXISTS "${BLACKLIST_FILE}") + append("-fsanitize-blacklist=${BLACKLIST_FILE}" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + endif() + set(MEMCHECK_TYPE UndefinedBehaviorSanitizer) + elseif(USE_SANITIZER MATCHES "([Tt]hread)") + message(STATUS "Building with Thread sanitizer") + append("-fsanitize=thread" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + set(MEMCHECK_TYPE ThreadSanitizer) + elseif(USE_SANITIZER MATCHES "([Ll]eak)") + message(STATUS "Building with Leak sanitizer") + append("-fsanitize=leak" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + set(MEMCHECK_TYPE LeakSanitizer) else() - message(STATUS "Building with Memory sanitizer") + message( + FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}") endif() - set(MEMCHECK_TYPE MemorySanitizer) - elseif(USE_SANITIZER MATCHES "([Uu]ndefined)") - message(STATUS "Building with Undefined sanitizer") - append("-fsanitize=undefined" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - if(EXISTS "${BLACKLIST_FILE}") - append("-fsanitize-blacklist=${BLACKLIST_FILE}" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + elseif(MSVC) + if(USE_SANITIZER MATCHES "([Aa]ddress)") + message(STATUS "Building with Address sanitizer") + append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) + else() + message(FATAL_ERROR "This sanitizer not yet supported in the MSVC environment: ${USE_SANITIZER}") endif() - set(MEMCHECK_TYPE UndefinedBehaviorSanitizer) - elseif(USE_SANITIZER MATCHES "([Tt]hread)") - message(STATUS "Building with Thread sanitizer") - append("-fsanitize=thread" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - set(MEMCHECK_TYPE ThreadSanitizer) - elseif(USE_SANITIZER MATCHES "([Ll]eak)") - message(STATUS "Building with Leak sanitizer") - append("-fsanitize=leak" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - set(MEMCHECK_TYPE LeakSanitizer) else() - message( - FATAL_ERROR "Unsupported value of USE_SANITIZER: ${USE_SANITIZER}") + message(FATAL_ERROR "USE_SANITIZER is not supported on this platform.") endif() - elseif(MSVC) - if(USE_SANITIZER MATCHES "([Aa]ddress)") - message(STATUS "Building with Address sanitizer") - append("-fsanitize=address" CMAKE_C_SANITIZER_FLAGS CMAKE_CXX_SANITIZER_FLAGS) - else() - message( - FATAL_ERROR - "This sanitizer not yet supported in the MSVC environment: ${USE_SANITIZER}" - ) - endif() - else() - message(FATAL_ERROR "USE_SANITIZER is not supported on this platform.") endif() - endif() diff --git a/config/toolchain/intel.cmake b/config/toolchain/intel.cmake index 97f6a64..ae1d2f8 100644 --- a/config/toolchain/intel.cmake +++ b/config/toolchain/intel.cmake @@ -3,9 +3,16 @@ set(CMAKE_COMPILER_VENDOR "intel") -set(CMAKE_C_COMPILER icc) -set(CMAKE_CXX_COMPILER icpc) -set(CMAKE_Fortran_COMPILER ifort) +if(USE_SANITIZER) + set(CMAKE_C_COMPILER icl) + set(CMAKE_CXX_COMPILER icl++) + set(CMAKE_Fortran_COMPILER ifort) + set(INTEL_CLANG ON) +else () + set(CMAKE_C_COMPILER icc) + set(CMAKE_CXX_COMPILER icpc) + set(CMAKE_Fortran_COMPILER ifort) +endif () # the following is used if cross-compiling set(CMAKE_CROSSCOMPILING_EMULATOR "") diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index c7a8e53..17987f6 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -48,6 +48,21 @@ New Features Configuration: ------------- + - Both build systems use same set of warnings flags + + GNU C warnings flags were moved to files in a config sub-folder + named gnu-warnings. Flags that only are available for a specific + version of the compiler are in files named with that version. + + There are flags in named "error-xxx" files with warnings that may + be promoted to errors. Some source files may still need fixes. + + There are also pairs of files named "developer-xxx" and "no-developer-xxx" + that are chosen by the CMake option:HDF5_ENABLE_DEV_WARNINGS or the + configure option:--enable-developer-warnings. + + (ADB - 2020/03/24, TRILAB-192) + - Added test script for file size compare if CMake minimum version is at least 3.14, the fileCompareTest.cmake |