summaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2020-06-21 22:20:04 (GMT)
committerLarry Knox <lrknox@hdfgroup.org>2020-06-21 22:42:59 (GMT)
commite64ed323db7c98a246d3386a146f87003886040a (patch)
tree370d5edd9c2bd8310d1a04866bafdb26eb87700f /config
parent8e62f1fe7b38b630f1a41007a03341cb66dec4b3 (diff)
downloadhdf5-e64ed323db7c98a246d3386a146f87003886040a.zip
hdf5-e64ed323db7c98a246d3386a146f87003886040a.tar.gz
hdf5-e64ed323db7c98a246d3386a146f87003886040a.tar.bz2
Merge pull request #2656 in HDFFV/hdf5 from ~LRKNOX/hdf5_lrk:changes_1_12_merge to hdf5_1_12
* commit '538b1317646f52658c2a896bbde4dce4246a9761': Squashed commit of the following: Addition of clang-warnings flags Update examples/teth5cc.sh.in for version 1.10.
Diffstat (limited to 'config')
-rw-r--r--config/apple3
-rw-r--r--config/clang-cxxflags200
-rw-r--r--config/clang-flags200
-rw-r--r--config/clang-warnings/developer-general1
-rw-r--r--config/clang-warnings/error-general5
-rw-r--r--config/clang-warnings/no-developer-general2
-rw-r--r--config/cmake/HDFCXXCompilerFlags.cmake56
-rw-r--r--config/cmake/HDFCompilerFlags.cmake26
-rw-r--r--config/linux-gnulibc121
9 files changed, 459 insertions, 55 deletions
diff --git a/config/apple b/config/apple
index 0b15dfe..aba48d1 100644
--- a/config/apple
+++ b/config/apple
@@ -49,6 +49,7 @@ fi
# Figure out compiler flags
. $srcdir/config/gnu-flags
+. $srcdir/config/clang-flags
# temp patch: if GCC 4.2.1 is used in Lion or Mountain Lion systems, do not
# use -O option as it causes failures in test/dt_arith.
case "$host_os" in
@@ -155,11 +156,13 @@ esac
# get c++ version info
case $CXX in
clang++)
+ . $srcdir/config/clang-cxxflags
cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\
grep 'Apple' | sed 's/(.*//'`
;;
*g++*)
+ . $srcdir/config/gnu-cxxflags
cxx_version_info=`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\
grep 'GCC' | sed 's/.*\((GCC) [-a-z0-9\. ]*.*\)/\1/'`
;;
diff --git a/config/clang-cxxflags b/config/clang-cxxflags
new file mode 100644
index 0000000..edd62e7
--- /dev/null
+++ b/config/clang-cxxflags
@@ -0,0 +1,200 @@
+# -*- shell-script -*-
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+
+
+# This file should be sourced into configure if the compiler is the
+# Clang clang++ compiler or a derivative. It is careful not to do anything
+# if the compiler is not Clang; otherwise 'cxx_flags_set' is set to 'yes'
+#
+
+#
+# For now, do not promote any warnings to errors.
+#
+PROMOTE_ERRORS_DFLT=no
+
+#
+# This filter rewrites -Werror= as -W, in that way demoting warnings
+# promoted to errors back to warnings, if PROMOTE_ERRORS is no.
+#
+demote_errors()
+{
+ if [ ${PROMOTE_ERRORS:-${PROMOTE_ERRORS_DFLT}} = no ]; then
+ sed 's,-Werror=,-W,g'
+ else
+ cat
+ fi
+}
+
+#
+# Prepend `$srcdir/config/clang-warnings/` to the filename suffix(es) given as
+# subroutine argument(s), remove comments starting with # and ending
+# at EOL, replace spans of whitespace (including newlines) with spaces,
+# and re-emit the file(s) thus filtered on the standard output stream.
+#
+load_clang_arguments()
+{
+ set -- $(for arg; do
+ sed 's,#.*$,,' $srcdir/config/clang-warnings/${arg}
+ done)
+ IFS=' ' echo "$*"
+}
+# Get the compiler version in a way that works for clang++
+# unless a compiler version is already known
+#
+# cxx_vendor: The compiler name: clang++
+# cxx_version: Version number: 6.0.0, 7.3.0, ... 10.0.1
+#
+if test "X-" = "X-$cxx_flags_set"; then
+ # clang++ -v will return version number following "clang" on Linux machines,
+ # but on Macs the version number will follow "Apple LLVM version"
+ cxx_version="`$CXX $CXXFLAGS $H5_CXXFLAGS -v 2>&1 |\
+ grep 'clang version' | sed 's/.*clang version \([-a-z0-9\.]*\).*/\1/'`"
+ if test -n "$cxx_version"; then
+ cxx_vendor="clang"
+ else
+ cxx_version="`$CXX $CXXFLAGS $H5_CXXFLAGS -v 2>&1 |\
+ grep 'Apple LLVM version' | sed 's/.*Apple LLVM version \([-a-z0-9\.]*\).*/\1/'`"
+ if test -n "$cxx_version"; then
+ cxx_vendor="Apple LLVM"
+ fi
+ fi
+ if test "X-" != "X-$cxx_version"; then
+
+ # Get the compiler version numbers
+ cxx_vers_major=`echo $cxx_version | cut -f1 -d.`
+ cxx_vers_minor=`echo $cxx_version | cut -f2 -d.`
+ cxx_vers_patch=`echo $cxx_version | cut -f3 -d.`
+ test -n "$cxx_vers_major" || cxx_vers_major=0
+ test -n "$cxx_vers_minor" || cxx_vers_minor=0
+ test -n "$cxx_vers_patch" || cxx_vers_patch=0
+ fi
+fi
+
+if test "X-clang" = "X-$cxx_vendor" -o "X-Apple LLVM" = "X-$cxx_vendor"; then
+ echo "compiler '$CXX' is $cxx_vendor-$cxx_version"
+ ###############################
+ # Architecture-specific flags #
+ ###############################
+
+ arch=
+ case "$host_os-$host_cpu" in
+ # FreeBSD sets the information from "uname -m" to the general machine
+ # architecture, not the specific CPU for the machine, so even our
+ # Pentium II Xeon server is set to "i386". Once we know we are on a FreeBSD
+ # machine, use the "sysctl" command to get the CPU hardware model.
+ freebsd*-i386)
+ host_cpu_model=`sysctl -n hw.model`
+ case "$host_cpu_model" in
+ # Hmm.. this might not catch Celerons, but it won't hurt them either...
+ *Pro*|*II*|*III*|*IV*|*Athlon*)
+ # architecture-specific optimizations cause problems
+ # for some users who build binaries to be used on
+ # multiple architectures.
+ # arch="-march=i686"
+ ;;
+ esac
+ ;;
+
+ *-i686)
+ # architecture-specific optimizations cause problems
+ # for some users who build binaries to be used on
+ # multiple architectures.
+ # arch="-march=i686"
+ ;;
+ esac
+
+ case "$host_os-$host_cpu" in
+ # cygwin needs the "-std=c99" flag removed, so make
+ # a specific case for Cygwin without the flag and a default
+ # case to add the flag everywhere else
+ cygwin-*)
+ ;;
+
+ *)
+ H5_CXXFLAGS="$H5_CXXFLAGS -std=c++11"
+ ;;
+ esac
+
+ H5_CXXFLAGS="$H5_CXXFLAGS $arch"
+
+ ##############
+ # Production #
+ ##############
+
+ # NDEBUG is handled explicitly by the configure script
+ PROD_CXXFLAGS=
+
+ #########
+ # Debug #
+ #########
+
+ # NDEBUG is handled explicitly by the configure script
+ # -g is handled by the symbols flags
+ DEBUG_CXXFLAGS="-ftrapv -fno-common"
+
+ ###########
+ # Symbols #
+ ###########
+
+ NO_SYMBOLS_CXXFLAGS=
+ SYMBOLS_CXXFLAGS="-g -fno-omit-frame-pointer"
+
+ #############
+ # Profiling #
+ #############
+
+ PROFILE_CXXFLAGS="-pg"
+
+ ################
+ # Optimization #
+ ################
+
+ HIGH_OPT_CXXFLAGS="-O3"
+ DEBUG_OPT_CXXFLAGS="-g"
+ NO_OPT_CXXFLAGS="-O0"
+
+ ############
+ # Warnings #
+ ############
+
+ ###########
+ # General #
+ ###########
+
+ H5_CXXFLAGS="$H5_CXXFLAGS $(load_clang_arguments general)"
+ H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_clang_arguments error-general)"
+
+ ######################
+ # Developer warnings #
+ ######################
+
+ NO_DEVELOPER_WARNING_CXXFLAGS=$(load_clang_arguments no-developer-general)
+ DEVELOPER_WARNING_CXXFLAGS=$(load_clang_arguments developer-general)
+
+ #############################
+ # Version-specific warnings #
+ #############################
+
+
+ #################
+ # Flags are set #
+ #################
+ cxx_flags_set=yes
+fi
+
+# Clear cxx info if no flags set
+if test "X$cxx_flags_set" = "X"; then
+ cxx_vendor=
+ cxx_version=
+fi
+
diff --git a/config/clang-flags b/config/clang-flags
new file mode 100644
index 0000000..b4f5e2e
--- /dev/null
+++ b/config/clang-flags
@@ -0,0 +1,200 @@
+# -*- shell-script -*-
+#
+# Copyright by The HDF Group.
+# Copyright by the Board of Trustees of the University of Illinois.
+# All rights reserved.
+#
+# This file is part of HDF5. The full HDF5 copyright notice, including
+# terms governing use, modification, and redistribution, is contained in
+# the COPYING file, which can be found at the root of the source code
+# distribution tree, or in https://support.hdfgroup.org/ftp/HDF5/releases.
+# If you do not have access to either file, you may request a copy from
+# help@hdfgroup.org.
+
+
+# This file should be sourced into configure if the compiler is the
+# Clang compiler or a derivative. It is careful not to do anything
+# if the compiler is not Clang; otherwise 'cc_flags_set' is set to 'yes'
+#
+
+#
+# For now, do not promote any warnings to errors.
+#
+PROMOTE_ERRORS_DFLT=no
+
+#
+# This filter rewrites -Werror= as -W, in that way demoting warnings
+# promoted to errors back to warnings, if PROMOTE_ERRORS is no.
+#
+demote_errors()
+{
+ if [ ${PROMOTE_ERRORS:-${PROMOTE_ERRORS_DFLT}} = no ]; then
+ sed 's,-Werror=,-W,g'
+ else
+ cat
+ fi
+}
+
+#
+# Prepend `$srcdir/config/clang-warnings/` to the filename suffix(es) given as
+# subroutine argument(s), remove comments starting with # and ending
+# at EOL, replace spans of whitespace (including newlines) with spaces,
+# and re-emit the file(s) thus filtered on the standard output stream.
+#
+load_clang_arguments()
+{
+ set -- $(for arg; do
+ sed 's,#.*$,,' $srcdir/config/clang-warnings/${arg}
+ done)
+ IFS=' ' echo "$*"
+}
+# Get the compiler version in a way that works for clang
+# unless a compiler version is already known
+#
+# cc_vendor: The compiler name: clang
+# cc_version: Version number: 6.0.0, 7.3.0, ... 10.0.1
+#
+if test "X-" = "X-$cc_flags_set"; then
+ # clang -v will return version number following "clang" on Linux machines,
+ # but on Macs the version number will follow "Apple LLVM version"
+ cc_version="`$CC $CFLAGS $H5_CFLAGS -v 2>&1 |\
+ grep 'clang version' | sed 's/.*clang version \([-a-z0-9\.]*\).*/\1/'`"
+ if test -n "$cc_version"; then
+ cc_vendor="clang"
+ else
+ cc_version="`$CC $CFLAGS $H5_CFLAGS -v 2>&1 |\
+ grep 'Apple LLVM version' | sed 's/.*Apple LLVM version \([-a-z0-9\.]*\).*/\1/'`"
+ if test -n "$cc_version"; then
+ cc_vendor="Apple LLVM"
+ fi
+ fi
+ if test "X-" != "X-$cc_version"; then
+
+ # Get the compiler version numbers
+ cc_vers_major=`echo $cc_version | cut -f1 -d.`
+ cc_vers_minor=`echo $cc_version | cut -f2 -d.`
+ cc_vers_patch=`echo $cc_version | cut -f3 -d.`
+ test -n "$cc_vers_major" || cc_vers_major=0
+ test -n "$cc_vers_minor" || cc_vers_minor=0
+ test -n "$cc_vers_patch" || cc_vers_patch=0
+ fi
+fi
+
+if test "X-clang" = "X-$cc_vendor" -o "X-Apple LLVM" = "X-$cc_vendor"; then
+ echo "compiler '$CC' is $cc_vendor-$cc_version"
+ ###############################
+ # Architecture-specific flags #
+ ###############################
+
+ arch=
+ case "$host_os-$host_cpu" in
+ # FreeBSD sets the information from "uname -m" to the general machine
+ # architecture, not the specific CPU for the machine, so even our
+ # Pentium II Xeon server is set to "i386". Once we know we are on a FreeBSD
+ # machine, use the "sysctl" command to get the CPU hardware model.
+ freebsd*-i386)
+ host_cpu_model=`sysctl -n hw.model`
+ case "$host_cpu_model" in
+ # Hmm.. this might not catch Celerons, but it won't hurt them either...
+ *Pro*|*II*|*III*|*IV*|*Athlon*)
+ # architecture-specific optimizations cause problems
+ # for some users who build binaries to be used on
+ # multiple architectures.
+ # arch="-march=i686"
+ ;;
+ esac
+ ;;
+
+ *-i686)
+ # architecture-specific optimizations cause problems
+ # for some users who build binaries to be used on
+ # multiple architectures.
+ # arch="-march=i686"
+ ;;
+ esac
+
+ case "$host_os-$host_cpu" in
+ # cygwin needs the "-std=c99" flag removed, so make
+ # a specific case for Cygwin without the flag and a default
+ # case to add the flag everywhere else
+ cygwin-*)
+ ;;
+
+ *)
+ H5_CFLAGS="$H5_CFLAGS -std=c99"
+ ;;
+ esac
+
+ H5_CFLAGS="$H5_CFLAGS $arch"
+
+ ##############
+ # Production #
+ ##############
+
+ # NDEBUG is handled explicitly by the configure script
+ PROD_CFLAGS=
+
+ #########
+ # Debug #
+ #########
+
+ # NDEBUG is handled explicitly by the configure script
+ # -g is handled by the symbols flags
+ DEBUG_CFLAGS="-ftrapv -fno-common"
+
+ ###########
+ # Symbols #
+ ###########
+
+ NO_SYMBOLS_CFLAGS=
+ SYMBOLS_CFLAGS="-g"
+
+ #############
+ # Profiling #
+ #############
+
+ PROFILE_CFLAGS="-pg"
+
+ ################
+ # Optimization #
+ ################
+
+ HIGH_OPT_CFLAGS="-O3"
+ DEBUG_OPT_CFLAGS="-g"
+ NO_OPT_CFLAGS="-O0"
+
+ ############
+ # Warnings #
+ ############
+
+ ###########
+ # General #
+ ###########
+
+ H5_CFLAGS="$H5_CFLAGS $(load_clang_arguments general)"
+ H5_ECFLAGS="$H5_ECFLAGS $(load_clang_arguments error-general)"
+
+ ######################
+ # Developer warnings #
+ ######################
+
+ NO_DEVELOPER_WARNING_CFLAGS=$(load_clang_arguments no-developer-general)
+ DEVELOPER_WARNING_CFLAGS=$(load_clang_arguments developer-general)
+
+ #############################
+ # Version-specific warnings #
+ #############################
+
+
+ #################
+ # Flags are set #
+ #################
+ cc_flags_set=yes
+fi
+
+# Clear cc info if no flags set
+if test "X$cc_flags_set" = "X"; then
+ cc_vendor=
+ cc_version=
+fi
+
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 a9aa516..883dff7 100644
--- a/config/clang-warnings/error-general
+++ b/config/clang-warnings/error-general
@@ -8,10 +8,11 @@
-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: File Driver files are not compatible with these warnings as errors
diff --git a/config/clang-warnings/no-developer-general b/config/clang-warnings/no-developer-general
index 2f4e0c5..2bf1703 100644
--- a/config/clang-warnings/no-developer-general
+++ b/config/clang-warnings/no-developer-general
@@ -1 +1 @@
--Wmissing-noreturn
+-Wno-missing-noreturn
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 ()
diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1
index 39225e7..a6f81ff 100644
--- a/config/linux-gnulibc1
+++ b/config/linux-gnulibc1
@@ -42,6 +42,9 @@ fi
# Figure out Intel C compiler flags
. $srcdir/config/intel-flags
+# Figure out Clang C compiler flags
+. $srcdir/config/clang-flags
+
# Use default Fortran 90 compiler according to what C compiler is used.
if test "X-" = "X-$FC"; then
case $CC_BASENAME in
@@ -61,6 +64,11 @@ if test "X-" = "X-$FC"; then
FC=mpif90
FC_BASENAME=mpif90
;;
+ clang*)
+ # clang has no fortran compiler. Use gfortran.
+ FC=gfortran
+ FC_BASENAME=gfortran
+ ;;
esac
else
case $FC in
@@ -194,6 +202,9 @@ fi
# Figure out GNU CXX compiler flags
. $srcdir/config/gnu-cxxflags
+# Figure out Clang CXX compiler flags
+. $srcdir/config/clang-cxxflags
+
# compiler version strings
# check if the compiler_version_info is already set
@@ -223,6 +234,11 @@ case $CC in
sed 's/\(Intel.* Compiler\).*\( Version [a-z0-9\.]*\).*\( Build [0-9]*\)/\1\2\3/'`
;;
+ *clang*)
+ cc_version_info="`$CC $CFLAGS $H5_CFLAGS --version 2>&1 |\
+ grep 'clang version' | sed 's/.*clang version \([-a-z0-9\.]*\).*/\1/'`"
+ ;;
+
*)
echo "No match to get cc_version_info for $CC"
;;
@@ -317,6 +333,11 @@ case $CXX in
cxx_version_info=`echo $cxx_version_info`
;;
+ *clang++*)
+ cxx_version_info="`$CXX $CXXFLAGS $H5_CXXFLAGS --version 2>&1 |\
+ grep 'clang version' | sed 's/.*clang version \([-a-z0-9\.]*\).*/\1/'`"
+ ;;
+
*)
echo "No match to get cxx_version_info for $CXX"
;;