summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAllen Byrne <50328838+byrnHDF@users.noreply.github.com>2021-02-04 14:45:37 (GMT)
committerGitHub <noreply@github.com>2021-02-04 14:45:37 (GMT)
commit197751c5af9692f5d18af723251247c97050b93d (patch)
tree811463bffc0a49746ba2158b9c0b831161d61f2c
parent8cfcf0e3949c2de67f6fb29dd52d5bc57b76ba0d (diff)
downloadhdf5-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
-rw-r--r--MANIFEST9
-rwxr-xr-xbin/warnhist109
-rw-r--r--config/clang-cxxflags1
-rw-r--r--config/clang-flags15
-rw-r--r--config/clang-warnings/noerror-general80
-rw-r--r--config/cmake/HDFCXXCompilerFlags.cmake18
-rw-r--r--config/cmake/HDFCompilerFlags.cmake34
-rw-r--r--config/commence.am4
-rw-r--r--config/freebsd28
-rw-r--r--config/gnu-cxxflags11
-rw-r--r--config/gnu-flags25
-rw-r--r--config/gnu-warnings/4.81
-rw-r--r--config/gnu-warnings/71
-rw-r--r--config/gnu-warnings/9.31
-rw-r--r--config/gnu-warnings/cxx-4.826
-rw-r--r--config/gnu-warnings/cxx-noerror-511
-rw-r--r--config/gnu-warnings/cxx-noerror-general32
-rw-r--r--config/gnu-warnings/developer-106
-rw-r--r--config/gnu-warnings/noerror-512
-rw-r--r--config/gnu-warnings/noerror-825
-rw-r--r--config/gnu-warnings/noerror-general91
-rw-r--r--config/solaris21
-rw-r--r--configure.ac47
-rw-r--r--release_docs/RELEASE.txt49
24 files changed, 572 insertions, 85 deletions
diff --git a/MANIFEST b/MANIFEST
index 3faf82c..624ea9e 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -159,6 +159,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
@@ -167,14 +168,19 @@
./config/gnu-warnings/7
./config/gnu-warnings/8
./config/gnu-warnings/9
+./config/gnu-warnings/9.3
./config/gnu-warnings/cxx-general
+./config/gnu-warnings/cxx-4.8
./config/gnu-warnings/cxx-4.9
./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
+./config/gnu-warnings/developer-10
./config/gnu-warnings/developer-general
./config/gnu-warnings/error-5
./config/gnu-warnings/error-8
@@ -188,6 +194,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
diff --git a/bin/warnhist b/bin/warnhist
index 3b2cec6..742a6b5 100755
--- a/bin/warnhist
+++ b/bin/warnhist
@@ -30,10 +30,13 @@ use Getopt::Std;
# Global variables, for accumulating information
my $totalcount = 0;
+my $notecount = 0;
+my $dupcount = 0;
my %warn_count = ();
my $warncount;
my %warn_file = ();
my %warn_file_line = ();
+my %warn_file_line_offset = ();
my %file_count = ();
my $filecount;
my $ignorecount = 0;
@@ -48,10 +51,13 @@ my %file_warn_line = ();
my $current_warning = 0;
my $current_file = 0;
my $warn_index;
+my $genericize = 1;
+
+# Info about last name / line / offset for file
my $last_c_name;
my $last_fort_name;
my $last_fort_line;
-my $genericize = 1;
+my $last_fort_offset;
# Display usage
sub do_help {
@@ -98,7 +104,7 @@ if($options{h}) {
# Parse list of file names to ignore
if(exists $options{i}) {
@ignorenames = split /,/, $options{i};
-#print @ignorenames;
+#print STDERR @ignorenames;
}
# Parse list of warning indices to expand file names
@@ -106,18 +112,18 @@ if(exists $options{w}) {
my @tmp_indices;
@tmp_indices = split /,/, $options{w};
-#print @tmp_indices;
+#print STDERR @tmp_indices;
for my $x (@tmp_indices) {
-#print "x = '$x'\n";
+#print STDERR "x = '$x'\n";
if($x =~ /\-/) {
my $start_index;
my $end_index;
-#print "matched = '$x'\n";
+#print STDERR "matched = '$x'\n";
($start_index, $end_index) = split /\-/, $x;
-#print "start_index = '$start_index', end_index = '$end_index'\n";
+#print STDERR "start_index = '$start_index', end_index = '$end_index'\n";
for my $y ($start_index..$end_index) {
-#print "y = '$y'\n";
+#print STDERR "y = '$y'\n";
if(!exists $warn_file_indices{$y}) {
$warn_file_indices{$y} = $y;
}
@@ -130,14 +136,14 @@ if(exists $options{w}) {
}
}
#foreach (sort keys %warn_file_indices) {
-# print "$_ : $warn_file_indices{$_}\n";
+# print STDERR "$_ : $warn_file_indices{$_}\n";
#}
}
# Parse list of warning strings to expand file names
if(exists $options{s}) {
@warn_match_strings = split /,/, $options{s};
-# print @warn_match_strings;
+# print STDERR @warn_match_strings;
}
# Parse list of file indices to expand warnings
@@ -145,18 +151,18 @@ if(exists $options{f}) {
my @tmp_indices;
@tmp_indices = split /,/, $options{f};
-#print @tmp_indices;
+#print STDERR @tmp_indices;
for my $x (@tmp_indices) {
-#print "x = '$x'\n";
+#print STDERR "x = '$x'\n";
if($x =~ /\-/) {
my $start_index;
my $end_index;
-#print "matched = '$x'\n";
+#print STDERR "matched = '$x'\n";
($start_index, $end_index) = split /\-/, $x;
-#print "start_index = '$start_index', end_index = '$end_index'\n";
+#print STDERR "start_index = '$start_index', end_index = '$end_index'\n";
for my $y ($start_index..$end_index) {
-#print "y = '$y'\n";
+#print STDERR "y = '$y'\n";
if(!exists $file_warn_indices{$y}) {
$file_warn_indices{$y} = $y;
}
@@ -169,14 +175,14 @@ if(exists $options{f}) {
}
}
#foreach (sort keys %warn_file_indices) {
-# print "$_ : $warn_file_indices{$_}\n";
+# print STDERR "$_ : $warn_file_indices{$_}\n";
#}
}
# Parse list of warning strings for files to expand warnings
if(exists $options{S}) {
@file_match_strings = split /,/, $options{S};
-# print @file_match_strings;
+# print STDERR @file_match_strings;
}
# Check if warnings should stay unique and not be "genericized"
@@ -197,7 +203,7 @@ while (<>) {
# Retain last FORTRAN compile line, which comes a few lines before warning
if($_ =~ /.*\.[fF]90:.*/) {
- ($last_fort_name, $last_fort_line, $toss) = split /\:/, $_;
+ ($last_fort_name, $last_fort_line, $last_fort_offset) = split /\:/, $_;
($last_fort_line, $toss) = split /\./, $last_fort_line;
}
@@ -217,38 +223,34 @@ while (<>) {
# Skip warnings from linker
next if $_ =~ /ld: warning:/;
- # Skip warnings from build_py and install_lib
+ # Skip warnings from build_py and install_lib
next if $_ =~ /warning: (build_py|install_lib)/;
+ # Skip variables with the word 'warning' in them
+ next if $_ =~ /_warning_/;
+
# "Hide" the C++ '::' symbol until we've parsed out the parts of the line
while($_ =~ /\:\:/) {
$_ =~ s/\:\:/@@@@/g;
}
# Check for weird formatting of warning message
+ $line = "??";
+ $offset = "??";
if($_ =~ /^cc1: warning:.*/) {
$name = $last_c_name;
- $line = "??";
($toss, $toss, $warning, $extra, $extra2) = split /\:/, $_;
# Check for CMAKE build with warning on first line and no filename
} elsif($_ =~ /^\s*[Ww]arning:.*/) {
$name = $last_c_name;
- $line = "??";
($toss, $warning, $extra, $extra2) = split /\:/, $_;
# Check for FORTRAN warning output
} elsif($_ =~ /^Warning:.*/) {
$name = $last_fort_name;
$line = $last_fort_line;
+ $offset = $last_fort_offset;
($toss, $warning, $extra, $extra2) = split /\:/, $_;
-#print "1:",$.,":",$_;
-# $_ = <>;
-#print "2:",$.,":",$_;
-# if($_ =~ /^\sFC.*/) {
-# $_ = <>;
-#print "3:",$.,":",$_;
-# }
-# ($name, $line, $toss) = split /\:/, $_;
-#print "4:","'",$name,"'","-","'",$line,"'","\n";
+
# Check for improperly parsed filename or line
if($name =~ /^$/) {
print "Filename is a null string! Input line #$. is: '$_'";
@@ -265,8 +267,6 @@ while (<>) {
$name =~ s/^\"//g;
$name =~ s/\"$//g;
$line =~ s/^\s*line\s*//g;
-# print "name:'", $name, "'-'", $line, "'\n";
-# print "warning:'", $warning, "'\n";
# Check for Intel icc warning
} elsif($_ =~ /.*[A-Za-z0-9_]\.[chC]\(.*[0-9]\):.*#.*/) {
($last_c_name, $toss, $warning) = split /\:/, $last_c_name;
@@ -310,9 +310,7 @@ while (<>) {
# Check for ignored file
if(exists $options{i}) {
for my $x (@ignorenames) {
-#print "x = '$x'\n";
if($name =~ /$x/) {
-# print "matched name = '$name'\n";
$ignorecount++;
if(!(exists $ignored_files{$name})) {
$ignored_files{$name} = $name;
@@ -347,13 +345,22 @@ while (<>) {
# These skipped messages & "genericizations" may be specific to GCC
# Skip supplemental warning message
- next if $warning =~ /near initialization for/;
+ if($warning =~ /near initialization for/) {
+ $notecount++;
+ next
+ }
# Skip C++ supplemental warning message
- next if $warning =~ /in call to/;
+ if($warning =~ /in call to/) {
+ $notecount++;
+ next
+ }
# Skip GCC warning that should be a note
- next if $_ =~ /\(this will be reported only once per input file\)/;
+ if($_ =~ /\(this will be reported only once per input file\)/) {
+ $notecount++;
+ next
+ }
if($genericize) {
# Eliminate C/C++ "{aka <some type>}" and "{aka '<some type>'}" info
@@ -402,16 +409,16 @@ while (<>) {
$warning =~ s/[A-Za-z_0-9]*\([A-Za-z_,0-9]*\) in [A-Za-z_0-9]*/-\(-\) in -/g;
}
}
-# print "warning = $warning\n";
# <end possible GCC-specific code>
# Check if we've already seen this warning on this line in this file
# (Can happen for warnings from inside header files)
- if( !exists $warn_file_line{$warning}{$name}{$line} ) {
+ if( !exists $warn_file_line_offset{$warning}{$name}{$line}{$offset} ) {
# Increment count for [generic] warning
$warn_count{$warning}++;
$warn_file{$warning}{$name}++;
$warn_file_line{$warning}{$name}{$line}++;
+ $warn_file_line_offset{$warning}{$name}{$line}{$offset}++;
# Increment count for filename
$file_count{$name}++;
@@ -421,14 +428,20 @@ while (<>) {
# Increment total count of warnings
$totalcount++;
}
+ else {
+ # Increment count of duplicate warnings
+ $dupcount++;
+ }
-# print "name = $name\n";
-# print "line = $line\n";
-# print "offset = $offset\n";
-# print "warning = \"$warning\"\n";
+# print STDERR "name = $name\n";
+# print STDERR "line = $line\n";
+# print STDERR "offset = $offset\n";
+# print STDERR "warning = \"$warning\"\n";
}
print "Total unique [non-ignored] warnings: $totalcount\n";
+print "Ignored notes / supplemental warning lines [not counted in unique warnings]: $notecount\n";
+print "Duplicated warning lines [not counted in unique warnings]: $dupcount\n";
print "Total ignored warnings: $ignorecount\n";
$warncount = keys %warn_count;
print "Total unique kinds of warnings: $warncount\n";
@@ -439,7 +452,7 @@ print "Total files with warnings: $filecount\n\n";
print "# of Warnings by frequency (file count)\n";
print "=======================================\n";
for my $x (sort {$warn_count{$b} <=> $warn_count{$a}} keys(%warn_count)) {
- printf ("[%2d] %4d (%2d) - %s\n", $current_warning++, $warn_count{$x}, scalar(keys %{$warn_file_line{$x}}), $x);
+ printf ("[%2d] %4d (%2d) - %s\n", $current_warning++, $warn_count{$x}, scalar(keys %{$warn_file{$x}}), $x);
if((exists $options{W}) || (exists $options{w}) || (exists $options{s})) {
my $curr_index = $current_warning - 1;
my $match = 0;
@@ -447,9 +460,9 @@ for my $x (sort {$warn_count{$b} <=> $warn_count{$a}} keys(%warn_count)) {
# Check for string from list in current warning
if(exists $options{s}) {
for my $y (@warn_match_strings) {
-# print "y = '$y'\n";
+# print STDERR "y = '$y'\n";
if($x =~ /$y/) {
-# print "matched warning = '$x'\n";
+# print STDERR "matched warning = '$x'\n";
$match = 1;
last;
}
@@ -477,7 +490,7 @@ for my $x (sort {$warn_count{$b} <=> $warn_count{$a}} keys(%warn_count)) {
print "\n# of Warnings by filename (warning type)\n";
print "========================================\n";
for my $x (sort {$file_count{$b} <=> $file_count{$a}} keys(%file_count)) {
- printf ("[%3d] %4d (%2d) - %s\n", $current_file++, $file_count{$x}, scalar(keys %{$file_warn_line{$x}}), $x);
+ printf ("[%3d] %4d (%2d) - %s\n", $current_file++, $file_count{$x}, scalar(keys %{$file_warn{$x}}), $x);
if((exists $options{F}) || (exists $options{f}) || (exists $options{S})) {
my $curr_index = $current_file - 1;
my $match = 0;
@@ -485,9 +498,9 @@ for my $x (sort {$file_count{$b} <=> $file_count{$a}} keys(%file_count)) {
# Check for string from list in current file
if(exists $options{S}) {
for my $y (@file_match_strings) {
-# print "y = '$y'\n";
+# print STDERR "y = '$y'\n";
if($x =~ /$y/) {
-# print "matched warning = '$x'\n";
+# print STDERR "matched warning = '$x'\n";
$match = 1;
last;
}
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
diff --git a/configure.ac b/configure.ac
index e91f06f..9296080 100644
--- a/configure.ac
+++ b/configure.ac
@@ -104,14 +104,10 @@ AC_SUBST([AR_FLAGS])
## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but
## not exported to h5cc (or h5fc, etc.)
##
-## H5_ECFLAGS (and company) are for warnings that should be treated as errors.
-##
AC_SUBST([H5_CFLAGS])
-AC_SUBST([H5_ECFLAGS])
AC_SUBST([H5_CPPFLAGS])
AC_SUBST([H5_FCFLAGS])
AC_SUBST([H5_CXXFLAGS])
-AC_SUBST([H5_ECXXFLAGS])
AC_SUBST([H5_JNIFLAGS])
AC_SUBST([H5_JAVACFLAGS])
AC_SUBST([H5_JAVAFLAGS])
@@ -2248,10 +2244,6 @@ if test "X-$DEV_WARNINGS" = X- ; then
DEV_WARNINGS=no
fi
-## Allow this variable to be substituted in
-## other files (src/libhdf5.settings.in, etc.)
-AC_SUBST([DEV_WARNINGS])
-
case "X-$DEV_WARNINGS" in
X-yes)
H5_CFLAGS="$H5_CFLAGS $DEVELOPER_WARNING_CFLAGS"
@@ -2267,6 +2259,45 @@ case "X-$DEV_WARNINGS" in
esac
## ----------------------------------------------------------------------
+## Check if we should consider certain compiler warnings as errors
+##
+## These should NOT be on by default as the risk of breakage is high
+## when compiling HDF5 on new (or new versions) of platforms and
+## compilers. It can also cause failures when header files we have no
+## control over (e.g. MPI, HDFS) raise warnings.
+##
+AC_MSG_CHECKING([enable warnings as errors])
+AC_ARG_ENABLE([warnings-as-errors],
+ [AS_HELP_STRING([--enable-warnings-as-errors],
+ [Determines whether certain warnings will be
+ considered errors. This is mainly for use
+ by HDF5 library developers.
+ [default=no]
+ ])],
+ [WARNINGS_AS_ERRORS=$enableval])
+
+## Set default
+if test "X-$WARNINGS_AS_ERRORS" = X- ; then
+ WARNINGS_AS_ERRORS=no
+fi
+
+case "X-$WARNINGS_AS_ERRORS" in
+ X-yes)
+ H5_CFLAGS="$H5_CFLAGS $H5_ECFLAGS"
+ H5_CXXFLAGS="$H5_CXXFLAGS $H5_ECXXFLAGS"
+ AC_MSG_RESULT([yes])
+ ;;
+ X-no)
+ H5_CFLAGS="$H5_CFLAGS $H5_NECFLAGS"
+ H5_CXXFLAGS="$H5_CXXFLAGS $H5_NECXXFLAGS"
+ AC_MSG_RESULT([no])
+ ;;
+ *)
+ AC_MSG_ERROR([Unrecognized value: $WARNINGS_AS_ERRORS])
+ ;;
+esac
+
+## ----------------------------------------------------------------------
## Check if the compiler should use profiling flags/settings
##
AC_MSG_CHECKING([profiling])
diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt
index 2c65384..d2d6914 100644
--- a/release_docs/RELEASE.txt
+++ b/release_docs/RELEASE.txt
@@ -64,6 +64,55 @@ New Features
(ADB - 2020/12/10, OESS-98)
+ - FreeBSD Autotools configuration now defaults to 'cc' and 'c++' compilers
+
+ On FreeBSD, the autotools defaulted to 'gcc' as the C compiler and did
+ not process C++ options. Since FreeBSD 10, the default compiler has
+ been clang (via 'cc').
+
+ The default compilers have been set to 'cc' for C and 'c++' for C++,
+ which will pick up clang and clang++ respectively on FreeBSD 10+.
+ Additionally, clang options are now set correctly for both C and C++
+ and g++ options will now be set if that compiler is being used (an
+ omission from the former functionality).
+
+ (DER - 2020/11/28, HDFFV-11193)
+
+ - Fixed POSIX problems when building w/ gcc on Solaris
+
+ When building on Solaris using gcc, the POSIX symbols were not
+ being set correctly, which could lead to issues like clock_gettime()
+ not being found.
+
+ The standard is now set to gnu99 when building with gcc on Solaris,
+ which allows POSIX things to be #defined and linked correctly. This
+ differs slightly from the gcc norm, where we set the standard to c99
+ and manually set POSIX #define symbols.
+
+ (DER - 2020/11/25, HDFFV-11191)
+
+ - Added a configure-time option to consider certain compiler warnings
+ as errors
+
+ A new configure-time option was added that converts some compiler warnings
+ to errors. This is mainly intended for library developers and currently
+ only works for gcc and clang. The warnings that are considered errors
+ will appear in the generated libhdf5.settings file. These warnings apply
+ to C and C++ code and will appear in "H5 C Flags" and H5 C++ Flags",
+ respectively. They will NOT be exported to h5cc, etc.
+
+ The default is OFF. Building with this option may fail when compiling
+ on operating systems and with compiler versions not commonly used by
+ the library developers. Compilation may also fail when headers not
+ under the control of the library developers (e.g., mpi.h, hdfs.h) raise
+ warnings.
+
+ Autotools: --enable-warnings-as-errors
+
+ CMake: HDF5_ENABLE_WARNINGS_AS_ERRORS
+
+ (DER - 2020/11/23, HDFFV-11189)
+
- Autotools and CMake target added to produce doxygen generated documentation
The default is OFF or disabled.