diff options
author | Allen Byrne <50328838+byrnHDF@users.noreply.github.com> | 2021-02-04 14:45:37 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-04 14:45:37 (GMT) |
commit | 197751c5af9692f5d18af723251247c97050b93d (patch) | |
tree | 811463bffc0a49746ba2158b9c0b831161d61f2c /config | |
parent | 8cfcf0e3949c2de67f6fb29dd52d5bc57b76ba0d (diff) | |
download | hdf5-197751c5af9692f5d18af723251247c97050b93d.zip hdf5-197751c5af9692f5d18af723251247c97050b93d.tar.gz hdf5-197751c5af9692f5d18af723251247c97050b93d.tar.bz2 |
Warnings merge 110 (#300)
* HDFFV-10865 - merge from dev, HDFArray perf fix.
* Remove duplicate setting
* Whitespace changes after clang format
* Undo version 11 clang format changes
* Merge CMake changes from develop
* Merge dev warnings refactor from develop
Diffstat (limited to 'config')
-rw-r--r-- | config/clang-cxxflags | 1 | ||||
-rw-r--r-- | config/clang-flags | 15 | ||||
-rw-r--r-- | config/clang-warnings/noerror-general | 80 | ||||
-rw-r--r-- | config/cmake/HDFCXXCompilerFlags.cmake | 18 | ||||
-rw-r--r-- | config/cmake/HDFCompilerFlags.cmake | 34 | ||||
-rw-r--r-- | config/commence.am | 4 | ||||
-rw-r--r-- | config/freebsd | 28 | ||||
-rw-r--r-- | config/gnu-cxxflags | 11 | ||||
-rw-r--r-- | config/gnu-flags | 25 | ||||
-rw-r--r-- | config/gnu-warnings/4.8 | 1 | ||||
-rw-r--r-- | config/gnu-warnings/7 | 1 | ||||
-rw-r--r-- | config/gnu-warnings/9.3 | 1 | ||||
-rw-r--r-- | config/gnu-warnings/cxx-4.8 | 26 | ||||
-rw-r--r-- | config/gnu-warnings/cxx-noerror-5 | 11 | ||||
-rw-r--r-- | config/gnu-warnings/cxx-noerror-general | 32 | ||||
-rw-r--r-- | config/gnu-warnings/developer-10 | 6 | ||||
-rw-r--r-- | config/gnu-warnings/noerror-5 | 12 | ||||
-rw-r--r-- | config/gnu-warnings/noerror-8 | 25 | ||||
-rw-r--r-- | config/gnu-warnings/noerror-general | 91 | ||||
-rw-r--r-- | config/solaris | 21 |
20 files changed, 414 insertions, 29 deletions
diff --git a/config/clang-cxxflags b/config/clang-cxxflags index edd62e7..4926313 100644 --- a/config/clang-cxxflags +++ b/config/clang-cxxflags @@ -173,6 +173,7 @@ if test "X-clang" = "X-$cxx_vendor" -o "X-Apple LLVM" = "X-$cxx_vendor"; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_clang_arguments general)" H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_clang_arguments error-general)" + H5_NECXXFLAGS="$H5_NECXXFLAGS $(load_clang_arguments noerror-general)" ###################### # Developer warnings # diff --git a/config/clang-flags b/config/clang-flags index b4f5e2e..e7b51a3 100644 --- a/config/clang-flags +++ b/config/clang-flags @@ -56,7 +56,10 @@ load_clang_arguments() # 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" + # but on Xcode the version number will follow "Apple LLVM version" + # Note that the Xcode reported LLVM version doesn't match the canonical + # LLVM version, so you'll need to do different version checks for + # Xcode. 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 @@ -160,9 +163,16 @@ if test "X-clang" = "X-$cc_vendor" -o "X-Apple LLVM" = "X-$cc_vendor"; then ################ HIGH_OPT_CFLAGS="-O3" - DEBUG_OPT_CFLAGS="-g" NO_OPT_CFLAGS="-O0" + # -Og is only understood by clang 4+ and Xcode 9+ + # Otherwise use -O1 (which is what -Og usually equates to) + if test "X-clang" = "X-$cc_vendor" -a $cc_vers_major -ge 4 -o "X-Apple LLVM" = "X-$cc_vendor" -a $cc_vers_major -ge 9; then + DEBUG_OPT_CFLAGS="-Og" + else + DEBUG_OPT_CFLAGS="-O1" + fi + ############ # Warnings # ############ @@ -173,6 +183,7 @@ if test "X-clang" = "X-$cc_vendor" -o "X-Apple LLVM" = "X-$cc_vendor"; then H5_CFLAGS="$H5_CFLAGS $(load_clang_arguments general)" H5_ECFLAGS="$H5_ECFLAGS $(load_clang_arguments error-general)" + H5_NECFLAGS="$H5_NECFLAGS $(load_clang_arguments noerror-general)" ###################### # Developer warnings # diff --git a/config/clang-warnings/noerror-general b/config/clang-warnings/noerror-general new file mode 100644 index 0000000..ad50dfc --- /dev/null +++ b/config/clang-warnings/noerror-general @@ -0,0 +1,80 @@ +# +# HDF5 code should not trigger the following warnings under any +# circumstances, so ask the compiler to treat them as errors: +# +-Wbad-function-cast +-Wimplicit-function-declaration +-Wincompatible-pointer-types +-Wmissing-declarations +-Wpacked +-Wshadow +-Wswitch +# +# 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 +# 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: Tools files are not compatible with these warnings as errors +# lib/h5tools.c +# -Werror=cast-align +# +-Wcast-align +# +# lib/h5tools_utils.c +# -Werror=unused-parameter +# +# +# 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) +# +-Wformat +# +# +#Examples and tests do not use the same set of extensive warning flags as libraries +# Here is a list of tests and examples that have issues with the stricter warnings as error +# +# NOTE: Test files are not compatible with these warnings as errors +# thread_id.c, +# -Werror=unused-function +# dsets.c +# -Werror=unused-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 +# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c +# -Werror=strict-prototypes +# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c +# -Werror=old-style-definition +# 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 + diff --git a/config/cmake/HDFCXXCompilerFlags.cmake b/config/cmake/HDFCXXCompilerFlags.cmake index 48da0c6..4f2eabe 100644 --- a/config/cmake/HDFCXXCompilerFlags.cmake +++ b/config/cmake/HDFCXXCompilerFlags.cmake @@ -91,7 +91,11 @@ if (NOT MSVC AND NOT MINGW) AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) # add the general CXX flags for g++ compiler versions 4.8 and above. ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-general") - ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general") + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-general") + else () + ADD_H5_FLAGS (H5_CXXFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-general") + endif () endif () elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang") ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") @@ -156,7 +160,11 @@ if (NOT MSVC AND NOT MINGW) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-5") - ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-5") + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-error-5") + else () + ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-noerror-5") + endif () endif () # Append more extra warning flags that only gcc 6.x+ know about @@ -181,7 +189,11 @@ if (NOT MSVC AND NOT MINGW) if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 8.0) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") - #ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") + #if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + # ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") + #else () + # ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-8") + #endif () if (HDF5_ENABLE_DEV_WARNINGS) # autotools always add the C flags with the CXX flags ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index b813924..fb527d5 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -71,6 +71,18 @@ endif () # break into groups (from the config/gnu-flags file) #----------------------------------------------------------------------------- if (NOT MSVC AND NOT MINGW) + #----------------------------------------------------------------------------- + # Option to allow the user to interpret certain warnings as errors + # + # This should NOT be on by default as it can cause a lot of conflicts with + # new operating systems and compiler versions. Header files that are out of + # our control (MPI, HDFS, etc.) can also raise warnings. + #----------------------------------------------------------------------------- + option (HDF5_ENABLE_WARNINGS_AS_ERRORS "Interpret some warnings as errors" OFF) + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + message (STATUS "...some warnings will be interpreted as errors") + endif () + if (${CMAKE_SYSTEM_NAME} MATCHES "SunOS") list (APPEND HDF5_CMAKE_C_FLAGS "-erroff=%none -DBSD_COMP") else () @@ -98,14 +110,22 @@ if (NOT MSVC AND NOT MINGW) # Add general CFlags for GCC versions 4.8 and above if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 4.8) ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-general") + else () + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/gnu-warnings/noerror-general") + endif () endif () # gcc automatically inlines based on the optimization level # this is just a failsafe list (APPEND H5_CFLAGS0 "-finline-functions") elseif (CMAKE_C_COMPILER_ID STREQUAL "Clang") ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/general") - ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general") + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/error-general") + else () + ADD_H5_FLAGS (H5_CFLAGS0 "${HDF5_SOURCE_DIR}/config/clang-warnings/noerror-general") + endif () elseif (CMAKE_C_COMPILER_ID STREQUAL "PGI") list (APPEND HDF5_CMAKE_C_FLAGS "-Minform=inform") endif () @@ -161,7 +181,11 @@ if (NOT MSVC AND NOT MINGW) # Append more extra warning flags that only gcc 5.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 5.0) ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/5") - ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") + else () + ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-5") + endif () endif () # Append more extra warning flags that only gcc 6.x+ know about @@ -182,7 +206,9 @@ if (NOT MSVC AND NOT MINGW) # Append more extra warning flags that only gcc 8.x+ know about if (NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 8.0) ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/8") - ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") + if (HDF5_ENABLE_WARNINGS_AS_ERRORS) + ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/error-8") + endif () if (HDF5_ENABLE_DEV_WARNINGS) ADD_H5_FLAGS (H5_CFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-8") else () diff --git a/config/commence.am b/config/commence.am index 3bd4a7e..d608800 100644 --- a/config/commence.am +++ b/config/commence.am @@ -70,9 +70,9 @@ H5CPP=${DESTDIR}$(bindir)/h5c++ # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. -AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@ +AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@ AM_FCFLAGS=@AM_FCFLAGS@ @H5_FCFLAGS@ -AM_CXXFLAGS=@AM_CXXFLAGS@ @H5_CXXFLAGS@ @H5_ECXXFLAGS@ +AM_CXXFLAGS=@AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_CPPFLAGS=@AM_CPPFLAGS@ @H5_CPPFLAGS@ AM_LDFLAGS=@AM_LDFLAGS@ @H5_LDFLAGS@ diff --git a/config/freebsd b/config/freebsd index 9a9348b..ba05380 100644 --- a/config/freebsd +++ b/config/freebsd @@ -18,19 +18,26 @@ # # See BlankForm in this directory for details. -# The default compiler is `gcc' +# The default compiler is 'cc' if test "X-" = "X-$CC"; then - CC=gcc - CC_BASENAME=gcc + CC=cc + CC_BASENAME=cc fi -# Figure out C compiler flags +# Figure out clang C compiler flags +. $srcdir/config/clang-flags + +# Figure out GNU C compiler flags . $srcdir/config/gnu-flags # Figure out Intel C compiler flags . $srcdir/config/intel-flags # The default Fortran 90 compiler +# No default Fortran compiler for clang. flang exists on +# FreeBSD as a port, but this is tied to an ancient LLVM +# and lacks Fortran 2003 features which causes configure +# to fail. if test "X-" = "X-$FC"; then case $CC_BASENAME in gcc*|pgcc*) @@ -54,3 +61,16 @@ fi # Figure out Intel F90 compiler flags . $srcdir/config/intel-fflags +# The default C++ compiler + +# The default compiler is 'c++'. +if test -z "$CXX"; then + CXX=c++ + CXX_BASENAME=c++ +fi + +# Figure out Clang CXX compiler flags +. $srcdir/config/clang-cxxflags + +# Figure out GNU CXX compiler flags +. $srcdir/config/gnu-cxxflags diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags index 44cbc69..0b48bdf 100644 --- a/config/gnu-cxxflags +++ b/config/gnu-cxxflags @@ -184,10 +184,11 @@ if test "X-g++" = "X-$cxx_vendor"; then if test $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 8 -o $cxx_vers_major -ge 5; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-general)" H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments cxx-error-general)" + H5_NECXXFLAGS="$H5_NECXXFLAGS $(load_gnu_arguments cxx-noerror-general)" - ###################### - # Developer warnings # - ###################### + ###################### + # Developer warnings # + ###################### NO_DEVELOPER_WARNING_CXXFLAGS=$(load_gnu_arguments no-developer-general) DEVELOPER_WARNING_CXXFLAGS=$(load_gnu_arguments developer-general) @@ -209,7 +210,7 @@ if test "X-g++" = "X-$cxx_vendor"; then # gcc >= 4.8 if test $cxx_vers_major -ge 5 -o $cxx_vers_major -eq 4 -a $cxx_vers_minor -ge 8; then - H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 4.8)" + H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-4.8)" DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-4.8)" NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments no-developer-4.8)" fi @@ -224,6 +225,7 @@ if test "X-g++" = "X-$cxx_vendor"; then if test $cxx_vers_major -ge 5; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments cxx-5)" H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments cxx-error-5)" + H5_NECXXFLAGS="$H5_NECXXFLAGS $(load_gnu_arguments cxx-noerror-5)" fi # gcc >= 6 @@ -241,6 +243,7 @@ if test "X-g++" = "X-$cxx_vendor"; then if test $cxx_vers_major -ge 8; then H5_CXXFLAGS="$H5_CXXFLAGS $(load_gnu_arguments 8)" #H5_ECXXFLAGS="$H5_ECXXFLAGS $(load_gnu_arguments error-8)" + #H5_NECXXFLAGS="$H5_NECXXFLAGS $(load_gnu_arguments noerror-8)" DEVELOPER_WARNING_CXXFLAGS="$DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments developer-8)" NO_DEVELOPER_WARNING_CXXFLAGS="$NO_DEVELOPER_WARNING_CXXFLAGS $(load_gnu_arguments no-developer-8)" fi diff --git a/config/gnu-flags b/config/gnu-flags index 7cf90b8..538fd53 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -118,12 +118,16 @@ if test "X-gcc" = "X-$cc_vendor"; then 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 needs the "-std=c99" flag removed. cygwin-*) ;; - + # On Solaris, gcc needs the gnu99 standard to pick up certain POSIX + # things. Do NOT use this as the gcc norm as this encourages the use + # of non-standard gcc extensions. + *solaris*) + H5_CFLAGS="$H5_CFLAGS -std=gnu99" + ;; + # Everybody else gets c99 as the standard. *) H5_CFLAGS="$H5_CFLAGS -std=c99" ;; @@ -192,6 +196,7 @@ if test "X-gcc" = "X-$cc_vendor"; then if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8 -o $cc_vers_major -gt 4; then H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments general)" H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-general)" + H5_NECFLAGS="$H5_NECFLAGS $(load_gnu_arguments noerror-general)" ###################### # Developer warnings # @@ -231,6 +236,7 @@ if test "X-gcc" = "X-$cc_vendor"; then if test $cc_vers_major -ge 5; then H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 5)" H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-5)" + H5_NECFLAGS="$H5_NECFLAGS $(load_gnu_arguments noerror-5)" fi # gcc >= 6 @@ -248,6 +254,7 @@ if test "X-gcc" = "X-$cc_vendor"; then if test $cc_vers_major -ge 8; then H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 8)" H5_ECFLAGS="$H5_ECFLAGS $(load_gnu_arguments error-8)" + H5_NECFLAGS="$H5_NECFLAGS $(load_gnu_arguments noerror-8)" DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments developer-8)" NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments no-developer-8)" fi @@ -257,6 +264,16 @@ if test "X-gcc" = "X-$cc_vendor"; then H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 9)" fi + # gcc >= 9.3 + if test $cc_vers_major -ge 10 -o $cc_vers_major -eq 9 -a $cc_vers_minor -ge 3; then + H5_CFLAGS="$H5_CFLAGS $(load_gnu_arguments 9.3)" + fi + + # gcc >= 10 + if test $cc_vers_major -ge 10; then + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gnu_arguments developer-10)" + fi + ################# # Flags are set # ################# diff --git a/config/gnu-warnings/4.8 b/config/gnu-warnings/4.8 index 05f4d92..fa678ff 100644 --- a/config/gnu-warnings/4.8 +++ b/config/gnu-warnings/4.8 @@ -9,6 +9,7 @@ # warning flag added for GCC >= 4.5 -Wstrict-overflow=5 + # This warning can only be truly addressed using the gcc extension of # using D to indicate doubles (e.g., 1.23D). -Wno-unsuffixed-float-constants diff --git a/config/gnu-warnings/7 b/config/gnu-warnings/7 index 266f5c1..9d5b44d 100644 --- a/config/gnu-warnings/7 +++ b/config/gnu-warnings/7 @@ -3,5 +3,4 @@ -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 --Wimplicit-fallthrough=5 -Wrestrict diff --git a/config/gnu-warnings/9.3 b/config/gnu-warnings/9.3 new file mode 100644 index 0000000..f37fdd6 --- /dev/null +++ b/config/gnu-warnings/9.3 @@ -0,0 +1 @@ +-Wc11-c2x-compat diff --git a/config/gnu-warnings/cxx-4.8 b/config/gnu-warnings/cxx-4.8 new file mode 100644 index 0000000..744ebdc --- /dev/null +++ b/config/gnu-warnings/cxx-4.8 @@ -0,0 +1,26 @@ +# warning flags added for GCC >= 4.3 +-Wlarger-than=2560 +-Wlogical-op + +# warning flags added for GCC >= 4.4 +-Wframe-larger-than=16384 +-Wpacked-bitfield-compat +-Wsync-nand + +# warning flag added for GCC >= 4.5 +-Wstrict-overflow=5 + +# warning flags added for GCC >= 4.6 +-Wdouble-promotion +-Wtrampolines + +# warning flag added for GCC >= 4.7 +# +# -Wstack-usage=8192 warnings need to be swept up on a branch so +# that we can stop burdening the whole development team. +# +-Wstack-usage=8192 + +# warning flag added for GCC >= 4.8 +-Wmaybe-uninitialized + diff --git a/config/gnu-warnings/cxx-noerror-5 b/config/gnu-warnings/cxx-noerror-5 new file mode 100644 index 0000000..7bce3e8 --- /dev/null +++ b/config/gnu-warnings/cxx-noerror-5 @@ -0,0 +1,11 @@ +# +# In GCC 4.4.7, the compiler gripes about shadowed global +# declarations when a local variable uses the name of a +# function that's in a system header file. For some reason, +# later versions of GCC (e.g., 5.2.0) don't complain about +# the shadowed globals. Maybe later versions are less fussy? +# Anyway, the shadowing seems to be harmless, and GCC 4.4.7 +# is not a supported compiler, so let us promote shadowed globals +# warnings to errors only for GCC 5 and later. +# +-Wshadow diff --git a/config/gnu-warnings/cxx-noerror-general b/config/gnu-warnings/cxx-noerror-general new file mode 100644 index 0000000..8cc1d94 --- /dev/null +++ b/config/gnu-warnings/cxx-noerror-general @@ -0,0 +1,32 @@ +# +# 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 +-Wpacked +-Wredundant-decls +-Wswitch +# 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 +-Wunused-function +-Wunused-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 diff --git a/config/gnu-warnings/developer-10 b/config/gnu-warnings/developer-10 new file mode 100644 index 0000000..fcd460d --- /dev/null +++ b/config/gnu-warnings/developer-10 @@ -0,0 +1,6 @@ +# New warning +-Warith-conversion + +# Enable static analysis of program flow +-fanalyzer +-fdiagnostics-path-format=none diff --git a/config/gnu-warnings/noerror-5 b/config/gnu-warnings/noerror-5 new file mode 100644 index 0000000..a7d40dd --- /dev/null +++ b/config/gnu-warnings/noerror-5 @@ -0,0 +1,12 @@ +-Wincompatible-pointer-types +# +# In GCC 4.4.7, the compiler gripes about shadowed global +# declarations when a local variable uses the name of a +# function that's in a system header file. For some reason, +# later versions of GCC (e.g., 5.2.0) don't complain about +# the shadowed globals. Maybe later versions are less fussy? +# Anyway, the shadowing seems to be harmless, and GCC 4.4.7 +# is not a supported compiler, so let us promote shadowed globals +# warnings to errors only for GCC 5 and later. +# +-Wshadow diff --git a/config/gnu-warnings/noerror-8 b/config/gnu-warnings/noerror-8 new file mode 100644 index 0000000..2f54a4d --- /dev/null +++ b/config/gnu-warnings/noerror-8 @@ -0,0 +1,25 @@ +# NOTE: src/ files are not compatible with these warnings as errors +# src/H5Dchunk.c +# -Werror=cast-function-type +-Wcast-function-type +# +# For GCC 8, promote maybe-initialized warnings to an error. GCC 8 +# reports 0 maybe-uninitialized warnings where earlier versions +# make many false reports. GCC 8 seems to analyze calls to static +# in order to detect initializations that occur there. It's possible +# that GCC 8 only performs that analysis at -O3, though. +# +# +# NOTE: File Driver files are not compatible with these warnings as errors +# H5FDlog.c, +# -Werror=maybe-uninitialized +-Wmaybe-uninitialized +# NOTE: src/ files are not compatible with these warnings as errors +# src/H5Shyper.c,src/H5SL.c,src/H5Shyper.c +# -Werror=maybe-uninitialized +# NOTE: Test files are not compatible with these warnings as errors +# test/cache_common.c, +# -Werror=maybe-uninitialized +# NOTE: hl/src/ files are not compatible with these warnings as errors +# hl/src/H5DS.c, +# -Werror=maybe-uninitialized diff --git a/config/gnu-warnings/noerror-general b/config/gnu-warnings/noerror-general new file mode 100644 index 0000000..e19014f --- /dev/null +++ b/config/gnu-warnings/noerror-general @@ -0,0 +1,91 @@ +# +# HDF5 code should not trigger the following warnings under any +# circumstances, so ask the compiler to treat them as errors: +# +-Wbad-function-cast +-Wdeclaration-after-statement +-Wimplicit-function-declaration +-Wmissing-declarations +-Wmissing-prototypes +-Wnested-externs +-Wold-style-definition +-Wpacked +-Wpointer-sign +-Wpointer-to-int-cast +-Wredundant-decls +-Wstrict-prototypes +-Wswitch +# +#-Werror=discarded-qualifiers +# +# +# 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: 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 +# +-Wunused-but-set-variable +# +# lib/h5tools_utils.c +# -Werror=unused-parameter +# +# +# 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) +# +-Wformat +# +# +#Examples and tests do not use the same set of extensive warning flags as libraries +# Here is a list of tests and examples that have issues with the stricter warnings as error +# +# 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(-truncation) +# +# +# 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 +# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c +# -Werror=strict-prototypes +# h5_rdwt.c,h5_crtgrp.c,h5_crtatt.c,h5_crtdat.c +# -Werror=old-style-definition +# 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 + diff --git a/config/solaris b/config/solaris index 656fee1..a424503 100644 --- a/config/solaris +++ b/config/solaris @@ -29,7 +29,9 @@ fi # Try solaris native compiler flags if test "X-" = "X-$cc_flags_set"; then - H5_CFLAGS="$H5_CFLAGS -erroff=%none -DBSD_COMP" + # HDF5 must be built with a C99 compiler on Solaris + # -erroff=%none turns on all warnings + H5_CFLAGS="$H5_CFLAGS -xc99=all -erroff=%none" # Production # NDEBUG is handled explicitly by the configure script @@ -41,17 +43,26 @@ if test "X-" = "X-$cc_flags_set"; then DEBUG_CFLAGS= # Symbols + # -g produces output for dbx, NOT gdb. You can use "gdb on" from + # inside gdb to use gdb commands if you need to debug. + # If you want a LOT of debugging information (at the expense of + # really slow code), try using -g3. That will even let you debug + # into macros. + # -s strips symbols, as in gcc NO_SYMBOLS_CFLAGS="-s" SYMBOLS_CFLAGS="-g" # Profile + # This produces profiling output for gprof. If you want to use + # the Solaris profiler, use -xprofile instead. PROFILE_CFLAGS="-xpg" # Optimization - # -g produces rather slow code. "-g -O" produces much faster code with some - # loss of debugger functions such as not able to print local variables. - HIGH_OPT_CFLAGS="-O" - DEBUG_OPT_CFLAGS="-O" + # -O has switched to -xO{1|2|3|4|5}. -xO3 is probably a good compromise + # for the daily tests, but you might want to switch to -xO2 or lower + # if you are actively debugging. + HIGH_OPT_CFLAGS="-xO5" + DEBUG_OPT_CFLAGS="-xO3" NO_OPT_CFLAGS= cc_flags_set=yes |