Add else choice to error flags option (#128)

This commit is contained in:
Allen Byrne 2020-11-25 11:50:21 -06:00 committed by GitHub
parent ffcb354237
commit 0b54c556a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 279 additions and 0 deletions

View File

@ -158,6 +158,7 @@
./config/clang-warnings/error-general
./config/clang-warnings/general
./config/clang-warnings/no-developer-general
./config/clang-warnings/noerror-general
./config/gnu-warnings/4.8-4.last
./config/gnu-warnings/4.8
./config/gnu-warnings/4.9
@ -171,6 +172,8 @@
./config/gnu-warnings/cxx-5
./config/gnu-warnings/cxx-error-5
./config/gnu-warnings/cxx-error-general
./config/gnu-warnings/cxx-noerror-5
./config/gnu-warnings/cxx-noerror-general
./config/gnu-warnings/developer-4.8
./config/gnu-warnings/developer-7
./config/gnu-warnings/developer-8
@ -187,6 +190,9 @@
./config/gnu-warnings/no-developer-4.8
./config/gnu-warnings/no-developer-8
./config/gnu-warnings/no-developer-general
./config/gnu-warnings/noerror-5
./config/gnu-warnings/noerror-8
./config/gnu-warnings/noerror-general
./config/intel-warnings/ifort-general
./config/intel-warnings/general

View File

@ -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 #

View File

@ -173,6 +173,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 #

View File

@ -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

View File

@ -91,6 +91,8 @@ if (NOT MSVC AND NOT MINGW)
ADD_H5_FLAGS (HDF5_CMAKE_CXX_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-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")
@ -156,6 +158,8 @@ if (NOT MSVC AND NOT MINGW)
ADD_H5_FLAGS (H5_CXXFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/cxx-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 ()
@ -183,6 +187,8 @@ if (NOT MSVC AND NOT MINGW)
ADD_H5_FLAGS (H5_CXXFLAGS3 "${HDF5_SOURCE_DIR}/config/gnu-warnings/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

View File

@ -110,6 +110,8 @@ if (NOT MSVC AND NOT MINGW)
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/gnu-warnings/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
@ -119,6 +121,8 @@ if (NOT MSVC AND NOT MINGW)
ADD_H5_FLAGS (HDF5_CMAKE_C_FLAGS "${HDF5_SOURCE_DIR}/config/clang-warnings/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")
@ -175,6 +179,8 @@ if (NOT MSVC AND NOT MINGW)
ADD_H5_FLAGS (H5_CFLAGS1 "${HDF5_SOURCE_DIR}/config/gnu-warnings/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 ()

View File

@ -184,6 +184,7 @@ 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 #
@ -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

View File

@ -196,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 #
@ -235,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
@ -252,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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -2288,6 +2288,8 @@ case "X-$WARNINGS_AS_ERRORS" in
AC_MSG_RESULT([yes])
;;
X-no)
H5_CFLAGS="$H5_CFLAGS $H5_NECFLAGS"
H5_CXXFLAGS="$H5_CXXFLAGS $H5_NECXXFLAGS"
AC_MSG_RESULT([no])
;;
*)