Add flags from config/clang-warnings/*general files to H5 C and CXX flags for all versions of Clang and Clang++ compilers.

Switched from cut to awk in testcheck_version.sh.in to avoid dependence
on tab vs. " " in version definitions in H5public.h.
This commit is contained in:
Larry Knox 2020-06-06 14:36:44 -05:00
parent f7bc306c19
commit de9491e365
7 changed files with 22 additions and 90 deletions

View File

@ -183,12 +183,8 @@ if test "X-clang" = "X-$cxx_vendor" -o "X-Apple LLVM" = "X-$cxx_vendor"; then
# General #
###########
if test $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 2 -o $cxx_vers_major -gt 4; then
H5_CXXFLAGS="$H5_CXXFLAGS $(load_clang_arguments general)"
fi
# if test $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 8 -o $cxx_vers_major -gt 4; then
# H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_clang_arguments error-general)"
# fi
H5_CXXFLAGS="$H5_CXXFLAGS $(load_clang_arguments general)"
H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_clang_arguments error-general)"
echo "H5_CXXFLAGS: $H5_CXXFLAGS"

View File

@ -183,12 +183,8 @@ if test "X-clang" = "X-$cc_vendor" -o "X-Apple LLVM" = "X-$cc_vendor"; then
# General #
###########
if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -gt 4; then
H5_CFLAGS="$H5_CFLAGS $(load_clang_arguments general)"
fi
# if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8 -o $cc_vers_major -gt 4; then
# H5_ECFLAGS="$H5_ECFLAGS $(load_clang_arguments error-general)"
# fi
H5_CFLAGS="$H5_CFLAGS $(load_clang_arguments general)"
H5_ECFLAGS="$H5_ECFLAGS $(load_clang_arguments error-general)"
echo "H5_CFLAGS: $H5_CFLAGS"

View File

@ -1,32 +0,0 @@
#
# HDF5 code should not trigger the following warnings under any
# circumstances, so ask the compiler to treat them as errors:
#
# NOTE: c++/test files are not compatible with these warnings as errors
# c++/test/tcompound.cpp
# -Werror=cast-align
-Wcast-align
# NOTE: c++/src files are not compatible with these warnings as errors
# c++/src/H5Object.cpp
# -Werror=missing-declarations
-Wmissing-declarations
-Werror=packed
-Werror=redundant-decls
-Werror=switch
# NOTE: c++/test files are not compatible with these warnings as errors
# c++/test/tattr.cpp
# -Werror=unused-but-set-variable
-Wunused-but-set-variable
-Werror=unused-function
-Werror=unused-variable
# NOTE: c++/src files are not compatible with these warnings as errors
# c++/src/H5Object.cpp,c++/src/H5StrType.cpp,c++/src/H5PredType.cpp
# -Werror=unused-parameter
-Wunused-parameter
#
# Other files not compatible
# NOTE: c++/test files are not compatible with these warnings as errors
# c++/test/titerate.cpp,c++/test/tarray.cpp
# -Werror=missing-declarations
# c++/test/titerate.cpp,c++/test/tarray.cpp,c++/test/tlinks.cpp,c++/test/ttypes.cpp,c++/test/dsets.cpp
# -Werror=unused-parameter

View File

@ -1,31 +0,0 @@
# Note that some of the flags listed here really should be developer
# flags (listed in separate files, gnu-warnings-developer*) 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 from the
# environment variable at configure time.
-Wall
-Wcast-qual
-Wconversion
-Wctor-dtor-privacy
-Weffc++
-Wextra
-Wfloat-equal
-Wformat=2
-Winit-self
-Winvalid-pch
-Wmissing-include-dirs
-Wno-format-nonliteral
-Wnon-virtual-dtor
-Wold-style-cast
-Woverloaded-virtual
-Wreorder
-Wshadow
-Wsign-promo
##-Wunreachable-code
-Wundef
##-Wvariadic-macros
-Wwrite-strings
-pedantic

View File

@ -65,6 +65,7 @@ if test "X-" = "X-$FC"; then
FC_BASENAME=mpif90
;;
clang*)
# clang has no fortran compiler. Use gfortran.
FC=gfortran
FC_BASENAME=gfortran
;;

View File

@ -311,16 +311,8 @@ fi
if test "X$CC_BASENAME" = "Xclang"; then
AC_SUBST([CLANG_SANITIZE_CHECKS])
## These are all the packages that use H5*_DEBUG.
## There is no harm in specifying a package not in this list;
## you'll just get an unused H5<pkg>_DEBUG symbol.
##
## Some packages that define debug checks or output are
## too specialized or have huge performance hits. These
## are not listed in the "all" packages list.
##
##all_packages="Address"
# There are several sanitizer tools. At present we are testing
# and describing only -fsanitizer=address with autotools.
case "X-$CLANG_SANITIZE_CHECKS" in
X-no|X-none)
CLANG_SANITIZE_CHECKS=none
@ -332,8 +324,18 @@ if test "X$CC_BASENAME" = "Xclang"; then
esac
AC_MSG_RESULT([$CLANG_SANITIZE_CHECKS])
## Define H5*_DEBUG symbols that control package output
## NOTE: No sanity checking done here!
# Other tools can be added to the list of checks
# The clang compiler doesn't support some of them; they should be
# checked before adding them to the list in the help message.
# The sanitizers/sanitizers.cmake file lists these options:
# address, memory, memoryWithOrigins, undefined, thread, leak,
# 'address;undefined'. Which and which combinations of these are
# supported varies by compiler version, but unsupported options
# or combinations will result in configure errors reported in config.log.
# Comma separated lists of sanitize options wil be entered intact in
# one -fsanitize=<list> flag. Space separated lists will be entered in
# separate -fsanitize=<item> flags.
# NOTE: No sanity checking done here!
if test -n "$CLANG_SANITIZE_LIST"; then
H5_CFLAGS="$H5_CFLAGS -fno-omit-frame-pointer"
for sanitizer in `echo $CLANG_SANITIZE_LIST`; do

View File

@ -216,9 +216,9 @@ h5libsettings=../src/libhdf5.settings
PURPOSE
# Figure out library version numbers from the header file.
h5versmajor=`grep '#define H5_VERS_MAJOR' $srcdir/../src/H5public.h | cut -f2`
h5versminor=`grep '#define H5_VERS_MINOR' $srcdir/../src/H5public.h | cut -f2`
h5versrelease=`grep '#define H5_VERS_RELEASE' $srcdir/../src/H5public.h | cut -f2`
h5versmajor=`grep '#define H5_VERS_MAJOR' $srcdir/../src/H5public.h | awk '{print $3}'`
h5versminor=`grep '#define H5_VERS_MINOR' $srcdir/../src/H5public.h | awk '{print $3}'`
h5versrelease=`grep '#define H5_VERS_RELEASE' $srcdir/../src/H5public.h | awk '{print $3}'`
DEBUGPRINT $h5versmajor.$h5versminor.$h5versrelease
case "$h5versmajor$h5versminor$h5versrelease" in
[0-9]*) # good. noop.