summaryrefslogtreecommitdiffstats
path: root/config/cmake/HDFCompilerFlags.cmake
diff options
context:
space:
mode:
authorjhendersonHDF <jhenderson@hdfgroup.org>2023-07-27 19:11:46 (GMT)
committerGitHub <noreply@github.com>2023-07-27 19:11:46 (GMT)
commit2bb4c909c4c63cf87d10c494cd76d57092d45335 (patch)
treee5da9e282045d3b17921169e00bb4164aa31bedc /config/cmake/HDFCompilerFlags.cmake
parent17a5a1a37ccc851ca9123b2921fbae15c4814edf (diff)
downloadhdf5-2bb4c909c4c63cf87d10c494cd76d57092d45335.zip
hdf5-2bb4c909c4c63cf87d10c494cd76d57092d45335.tar.gz
hdf5-2bb4c909c4c63cf87d10c494cd76d57092d45335.tar.bz2
Fix some warnings in developer builds (#3247) (#3291)
* Fix some warnings in developer builds * Switch approach to Winline flag
Diffstat (limited to 'config/cmake/HDFCompilerFlags.cmake')
-rw-r--r--config/cmake/HDFCompilerFlags.cmake13
1 files changed, 13 insertions, 0 deletions
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index 00850d3..1878b9b 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -189,6 +189,19 @@ if (HDF5_ENABLE_DEV_WARNINGS)
elseif (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang")
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/developer-general")
endif ()
+
+ # Turn on -Winline warnings now only for non-Debug and
+ # non-Developer builds. For at least GNU compilers this
+ # flag appears to conflict specifically with the -Og
+ # optimization flag and will produce warnings about functions
+ # not being considered for inlining
+ if (NOT ${HDF_CFG_NAME} MATCHES "Debug" AND NOT ${HDF_CFG_NAME} MATCHES "Developer")
+ if (CMAKE_C_COMPILER_ID STREQUAL "GNU")
+ list (APPEND H5_CFLAGS "-Winline")
+ elseif (CMAKE_C_COMPILER_ID STREQUAL "Intel" AND NOT _INTEL_WINDOWS)
+ list (APPEND H5_CFLAGS "-Winline")
+ endif ()
+ endif ()
else ()
if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8)
ADD_H5_FLAGS (H5_CFLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general")