summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2020-06-10 19:25:10 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2020-06-10 19:25:10 (GMT)
commit77efb340a1b06465587ca9dd4599271409a86a44 (patch)
treed3fcb6a99e212c5e7a3ce9beb40f83f19bc63ff4
parent32c353ed4360630646e0bfd40387aa7b4fd403ea (diff)
downloadhdf5-77efb340a1b06465587ca9dd4599271409a86a44.zip
hdf5-77efb340a1b06465587ca9dd4599271409a86a44.tar.gz
hdf5-77efb340a1b06465587ca9dd4599271409a86a44.tar.bz2
Make changes to CMake CompilerFlags.cmake files so extra flags are
loaded for non-GNU compilers.
-rw-r--r--config/clang-warnings/developer-general1
-rw-r--r--config/clang-warnings/error-general12
-rw-r--r--config/cmake/HDFCXXCompilerFlags.cmake56
-rw-r--r--config/cmake/HDFCompilerFlags.cmake26
4 files changed, 35 insertions, 60 deletions
diff --git a/config/clang-warnings/developer-general b/config/clang-warnings/developer-general
index aa8c32e..74d8404 100644
--- a/config/clang-warnings/developer-general
+++ b/config/clang-warnings/developer-general
@@ -1,3 +1,4 @@
-Wformat-nonliteral
-Wmissing-noreturn
+-Wsometimes-uninitialized
-Wswitch-enum
diff --git a/config/clang-warnings/error-general b/config/clang-warnings/error-general
index 558d740..883dff7 100644
--- a/config/clang-warnings/error-general
+++ b/config/clang-warnings/error-general
@@ -4,20 +4,16 @@
#
-Werror=bad-function-cast
-Werror=implicit-function-declaration
-#-Werror=incompatible-pointer-types
+-Werror=incompatible-pointer-types
-Werror=missing-declarations
-Werror=packed
-Werror=shadow
-#-Werror=sometimes-uninitialized
-Werror=switch
#
-#-Werror=discarded-qualifiers
+# NOTE: Following files are not compatible with incompatible-pointer-types as errors
+# src/H5Dchunk.c,src/H5Dint.c,src/H5Gint.c,src/H5HFcache.c,src/H5I.c,src/H5T.c
+-Wno-error=incompatible-pointer-types-discards-qualifiers
#
-# Note: For macos 10.12, etc
-# H5Dint.c,H5Dchunk.c,H5Gint.c
-# -Wincompatible-pointer-types-discards-qualifiers
-# # H5Dvirtual.c,H5SL.c
-# -Wsometimes-uninitialized
#
# NOTE: File Driver files are not compatible with these warnings as errors
# H5FDdirect.c,H5FDmpio.c,H5FDros3.c,
diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake
index 8527327..7bbebbc 100644
--- a/config/cmake/HDFCXXCompilerFlags.cmake
+++ b/config/cmake/HDFCXXCompilerFlags.cmake
@@ -40,7 +40,7 @@ if (HDF5_DISABLE_COMPILER_WARNINGS)
# warning level is given, so remove it.
if (MSVC)
set (HDF5_WARNINGS_BLOCKED 1)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ if (CMAKE_CXX_COMPILER_LOADED)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W0")
endif ()
@@ -51,7 +51,7 @@ if (HDF5_DISABLE_COMPILER_WARNINGS)
# Most compilers use -w to suppress warnings.
if (NOT HDF5_WARNINGS_BLOCKED)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ if (CMAKE_CXX_COMPILER_LOADED)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -w")
endif ()
endif ()
@@ -65,7 +65,7 @@ endif ()
# CDash is configured to only allow 3000 warnings, so
# break into groups (from the config/gnu-flags file)
#-----------------------------------------------------------------------------
-if (NOT MSVC)
+if (NOT MSVC AND NOT MINGW)
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
list (APPEND HDF5_CMAKE_CXX_FLAGS "-erroff=%none -DBSD_COMP")
else ()
@@ -194,7 +194,9 @@ if (NOT MSVC)
endif ()
endif ()
else ()
+ if (NOT MINGW)
list (APPEND HDF5_CMAKE_CXX_FLAGS "/EHsc")
+ endif ()
endif ()
#-----------------------------------------------------------------------------
@@ -204,21 +206,19 @@ if (HDF5_ENABLE_ALL_WARNINGS)
message (STATUS "....All Warnings are enabled")
if (MSVC)
if (HDF5_ENABLE_DEV_WARNINGS)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ if (CMAKE_CXX_COMPILER_LOADED)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
list (APPEND HDF5_CMAKE_CXX_FLAGS "/Wall /wd4668")
endif ()
else ()
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ if (CMAKE_CXX_COMPILER_LOADED)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3")
endif ()
endif ()
else ()
- if (CMAKE_COMPILER_IS_GNUCC)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS0} ${H5_CXXFLAGS1} ${H5_CXXFLAGS2} ${H5_CXXFLAGS3} ${H5_CXXFLAGS4})
- endif ()
+ if (CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS0} ${H5_CXXFLAGS1} ${H5_CXXFLAGS2} ${H5_CXXFLAGS3} ${H5_CXXFLAGS4})
endif ()
endif ()
endif ()
@@ -229,15 +229,13 @@ endif ()
if (HDF5_ENABLE_GROUPZERO_WARNINGS)
message (STATUS "....Group Zero warnings are enabled")
if (MSVC)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ if (CMAKE_CXX_COMPILER_LOADED)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
list (APPEND HDF5_CMAKE_CXX_FLAGS "/W1")
endif ()
else ()
- if (CMAKE_COMPILER_IS_GNUCC)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS0})
- endif ()
+ if (CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS0})
endif ()
endif ()
endif ()
@@ -248,15 +246,13 @@ endif ()
if (HDF5_ENABLE_GROUPONE_WARNINGS)
message (STATUS "....Group One warnings are enabled")
if (MSVC)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ if (CMAKE_CXX_COMPILER_LOADED)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
list (APPEND HDF5_CMAKE_CXX_FLAGS "/W2")
endif ()
else ()
- if (CMAKE_COMPILER_IS_GNUCC)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS1})
- endif ()
+ if (CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS1})
endif ()
endif ()
endif ()
@@ -267,15 +263,13 @@ endif ()
if (HDF5_ENABLE_GROUPTWO_WARNINGS)
message (STATUS "....Group Two warnings are enabled")
if (MSVC)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ if (CMAKE_CXX_COMPILER_LOADED)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
list (APPEND HDF5_CMAKE_CXX_FLAGS "/W3")
endif ()
else ()
- if (CMAKE_COMPILER_IS_GNUCC)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS2})
- endif ()
+ if (CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS2})
endif ()
endif ()
endif ()
@@ -286,15 +280,13 @@ endif ()
if (HDF5_ENABLE_GROUPTHREE_WARNINGS)
message (STATUS "....Group Three warnings are enabled")
if (MSVC)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
+ if (CMAKE_CXX_COMPILER_LOADED)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_CXX_FLAGS "${HDF5_CMAKE_CXX_FLAGS}")
list (APPEND HDF5_CMAKE_CXX_FLAGS "/W4")
endif ()
else ()
- if (CMAKE_COMPILER_IS_GNUCC)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS3})
- endif ()
+ if (CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS3})
endif ()
endif ()
endif ()
@@ -305,10 +297,8 @@ endif ()
if (HDF5_ENABLE_GROUPFOUR_WARNINGS)
message (STATUS "....Group Four warnings are enabled")
if (NOT MSVC)
- if (CMAKE_COMPILER_IS_GNUCC)
- if (CMAKE_COMPILER_IS_GNUCXX AND CMAKE_CXX_COMPILER_LOADED)
- list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS4})
- endif ()
+ if (CMAKE_CXX_COMPILER_LOADED)
+ list (APPEND HDF5_CMAKE_CXX_FLAGS ${H5_CXXFLAGS4})
endif ()
endif ()
endif ()
diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake
index cd4ab48..31af2f8 100644
--- a/config/cmake/HDFCompilerFlags.cmake
+++ b/config/cmake/HDFCompilerFlags.cmake
@@ -68,7 +68,7 @@ endif ()
# CDash is configured to only allow 3000 warnings, so
# break into groups (from the config/gnu-flags file)
#-----------------------------------------------------------------------------
-if (NOT MSVC)
+if (NOT MSVC AND NOT MINGW)
if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS")
list (APPEND HDF5_CMAKE_C_FLAGS "-erroff=%none -DBSD_COMP")
else ()
@@ -209,9 +209,7 @@ if (HDF5_ENABLE_ALL_WARNINGS)
list (APPEND HDF5_CMAKE_C_FLAGS "/W3")
endif ()
else ()
- if (CMAKE_COMPILER_IS_GNUCC)
- list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4})
- endif ()
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0} ${H5_CFLAGS1} ${H5_CFLAGS2} ${H5_CFLAGS3} ${H5_CFLAGS4})
endif ()
endif ()
@@ -225,9 +223,7 @@ if (HDF5_ENABLE_GROUPZERO_WARNINGS)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
list (APPEND HDF5_CMAKE_C_FLAGS "/W1")
else ()
- if (CMAKE_COMPILER_IS_GNUCC)
- list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0})
- endif ()
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS0})
endif ()
endif ()
@@ -241,9 +237,7 @@ if (HDF5_ENABLE_GROUPONE_WARNINGS)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
list (APPEND HDF5_CMAKE_C_FLAGS "/W2")
else ()
- if (CMAKE_COMPILER_IS_GNUCC)
- list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS1})
- endif ()
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS1})
endif ()
endif ()
@@ -257,9 +251,7 @@ if (HDF5_ENABLE_GROUPTWO_WARNINGS)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
list (APPEND HDF5_CMAKE_C_FLAGS "/W3")
else ()
- if (CMAKE_COMPILER_IS_GNUCC)
- list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS2})
- endif ()
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS2})
endif ()
endif ()
@@ -273,9 +265,7 @@ if (HDF5_ENABLE_GROUPTHREE_WARNINGS)
string (REGEX REPLACE "(^| )([/-])W[0-9]( |$)" " " HDF5_CMAKE_C_FLAGS "${HDF5_CMAKE_C_FLAGS}")
list (APPEND HDF5_CMAKE_C_FLAGS "/W4")
else ()
- if (CMAKE_COMPILER_IS_GNUCC)
- list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS3})
- endif ()
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS3})
endif ()
endif ()
@@ -286,9 +276,7 @@ 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)
- if (CMAKE_COMPILER_IS_GNUCC)
- list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS4})
- endif ()
+ list (APPEND HDF5_CMAKE_C_FLAGS ${H5_CFLAGS4})
endif ()
endif ()