diff options
-rwxr-xr-x | bin/warnhist | 111 | ||||
-rw-r--r-- | config/clang-flags | 5 | ||||
-rw-r--r-- | config/freebsd | 28 | ||||
-rw-r--r-- | configure.ac | 83 | ||||
-rw-r--r-- | m4/ax_jni_include_dir.m4 | 18 |
5 files changed, 160 insertions, 85 deletions
diff --git a/bin/warnhist b/bin/warnhist index a88474b..742a6b5 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -15,7 +15,7 @@ use warnings; # http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have # access to either file, you may request a copy from help@hdfgroup.org. # -# Quincey Koziol, koziol@hdfgroup.org +# Quincey Koziol # 9 Aug 2013 # # Purpose: Given an input file containing the output from a build of the @@ -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-flags b/config/clang-flags index b4f5e2e..a349f58 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 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/configure.ac b/configure.ac index d92d23a..523a880 100644 --- a/configure.ac +++ b/configure.ac @@ -14,7 +14,6 @@ ## ---------------------------------------------------------------------- ## Initialize configure. ## -AC_REVISION($Id: configure.ac 22697 2012-08-19 14:35:47Z hdftest $) AC_PREREQ([2.69]) ## AC_INIT takes the name of the package, the version number, and an @@ -37,18 +36,46 @@ AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign subdir-objects]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) # use silent rules where available - automake 1.11 -## AM_MAINTAINER_MODE turns off "rebuild rules" that contain dependencies -## for Makefiles, configure, src/H5config.h, etc. If AM_MAINTAINER_MODE -## is enabled, these files will be rebuilt if out of date. This is a -## problem because if users try to build on a machine with -## the wrong versions of autoconf and automake, these files will be -## rebuilt with the wrong versions and bad things can happen. -## Also, CVS doesn't preserve dependencies between timestamps, so -## Makefiles will often think rebuilding needs to occur when it doesn't. +## AM_MAINTAINER_MODE determines the behavior of "rebuild rules" that contain +## dependencies for Makefile.in files, configure, src/H5config.h, etc. If +## AM_MAINTAINER_MODE is enabled, these files will be rebuilt if out of date. +## When disabled, the autotools build files can get out of sync and the build +## system will not complain or try to regenerate downstream files. ## -## By default, it is enabled. Users can configure with -## --disable-maintainer-mode to prevent running the autotools. -AM_MAINTAINER_MODE([disable]) +## The AM_MAINTAINER_MODE macro also determines whether the +## --(enable|disable)-maintainer-mode configure option is available. When the +## macro is present, with or without a parameter, the option will be added +## to the generated configure script. +## +## In summary: +## +## AM_MAINTAINER_MODE([enable]) +## - Build dependencies ON by default +## - Configure option exists +## +## AM_MAINTAINER_MODE([disable]) +## - Build dependencies OFF by default +## - Configure option exists +## +## AM_MAINTAINER_MODE +## - Build dependencies OFF by default +## - Configure option exists +## +## No AM_MAINTAINER_MODE macro +## - Build dependencies ON by default +## - No configure option to control build dependencies +## +## The biggest concern for us is that version control systems like git +## usually don't preserve dependencies between timestamps, so the build +## system will often think that upstream build files like Makefile.am are +## dirty and that rebuilding needs to occur when it doesn't. This is a problem +## in release branches where we provide the autotools-generated files. Users +## who don't have autoconf, automake, etc. will then have difficulty building +## release branches checked out from git. +## +## By default, maintainer mode is enabled in development branches and disabled +## in release branches. +AM_MAINTAINER_MODE([enable]) ## ---------------------------------------------------------------------- ## Set prefix default (install directory) to a directory in the build area. @@ -296,7 +323,7 @@ AC_MSG_CHECKING([for clang sanitizer checks]) AC_ARG_ENABLE([sanitize-checks], [AS_HELP_STRING([--enable-sanitize-checks=address], [(clang/clang++ compilers only) Enable sanitize checks. - Address is useful for detecting issues dealing with + Address is useful for detecting issues dealing with memory. See AddressSanitizer in config/sanitizer/README.md for more information. [default=none] @@ -311,7 +338,7 @@ fi if test "X$CC_BASENAME" = "Xclang"; then AC_SUBST([CLANG_SANITIZE_CHECKS]) - # There are several sanitizer tools. At present we are testing + # 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) @@ -328,8 +355,8 @@ if test "X$CC_BASENAME" = "Xclang"; then # 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 + # 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 @@ -1024,7 +1051,10 @@ AC_ARG_ENABLE([tests], [HDF5_TESTS=$enableval]) if test "X$HDF5_TESTS" = "Xno"; then + AC_MSG_RESULT([yes]) echo "Building HDF5 tests is disabled" +else + AC_MSG_RESULT([no]) fi ## ---------------------------------------------------------------------- @@ -1045,7 +1075,10 @@ AC_ARG_ENABLE([tools], [HDF5_TOOLS=$enableval]) if test "X$HDF5_TOOLS" = "Xno"; then + AC_MSG_RESULT([yes]) echo "Building HDF5 tools is disabled" +else + AC_MSG_RESULT([no]) fi ## ---------------------------------------------------------------------- @@ -1594,19 +1627,19 @@ case "X-$withval" in AM_CPPFLAGS="$AM_CPPFLAGS -I$szlib_inc" fi - AC_CHECK_HEADERS([szlib.h], - [HAVE_SZLIB_H="yes"], - [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"] [unset HAVE_SZLIB]) - if test -n "$szlib_lib"; then LDFLAGS="$LDFLAGS -L$szlib_lib" AM_LDFLAGS="$AM_LDFLAGS -L$szlib_lib" fi - if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then + if test "x$HAVE_SZLIB" = "xyes"; then AC_CHECK_LIB([sz], [SZ_BufftoBuffCompress],, [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"; LDFLAGS="$saved_LDFLAGS"; AM_LDFLAGS="$saved_AM_LDFLAGS"; unset HAVE_SZLIB]) - if test -z "$HAVE_SZLIB"; then + if test -n "$HAVE_SZLIB"; then + AC_CHECK_HEADERS([szlib.h], + [HAVE_SZLIB_H="yes"], + [CPPFLAGS="$saved_CPPFLAGS"; AM_CPPFLAGS="$saved_AM_CPPFLAGS"] [unset HAVE_SZLIB]) + else AC_MSG_RESULT([Using SZ_BufftoBuffCompress from libsz in $szlib_lib failed. Szip not enabled.]) fi fi @@ -1892,10 +1925,10 @@ esac ## ---------------------------------------------------------------------- -## Does the struct stat have the st_blocks field? This field is not Posix. +## Does the struct stat have the st_blocks field? This field is not POSIX. ## AC_MSG_CHECKING([for st_blocks in struct stat]) -AC_COMPILE_IFELSE([AC_LANG_PROGRAM[[ +AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[ #include <sys/stat.h>]],[[struct stat sb; sb.st_blocks=0;]])], [AC_DEFINE([HAVE_STAT_ST_BLOCKS], [1], [Define if struct stat has the st_blocks field]) @@ -2031,7 +2064,7 @@ AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[ AC_MSG_CHECKING([how to print long long]) AC_CACHE_VAL([hdf5_cv_printf_ll], [ -for hdf5_cv_printf_ll in l ll L q unknown; do +for hdf5_cv_printf_ll in ll l L q unknown; do AC_RUN_IFELSE( [AC_LANG_PROGRAM([ #include <stdio.h> diff --git a/m4/ax_jni_include_dir.m4 b/m4/ax_jni_include_dir.m4 index ae7a5f0..cd72098 100644 --- a/m4/ax_jni_include_dir.m4 +++ b/m4/ax_jni_include_dir.m4 @@ -73,13 +73,19 @@ fi case "$host_os" in darwin*) # Apple Java headers are inside the Xcode bundle. - macos_version=$(sw_vers -productVersion | sed -n -e 's/^@<:@0-9@:>@*.\(@<:@0-9@:>@*\).@<:@0-9@:>@*/\1/p') - if @<:@ "$macos_version" -gt "7" @:>@; then - _JTOPDIR="$(xcrun --show-sdk-path)/System/Library/Frameworks/JavaVM.framework" - _JINC="$_JTOPDIR/Headers" + major_macos_version=$(sw_vers -productVersion | sed -n -e 's/^\(@<:@0-9@:>@*\).@<:@0-9@:>@*.@<:@0-9@:>@*/\1/p') + if @<:@ "$major_macos_version" -gt "10" @:>@; then + _JTOPDIR="$(/usr/libexec/java_home)" + _JINC="$_JTOPDIR/include" else - _JTOPDIR="/System/Library/Frameworks/JavaVM.framework" - _JINC="$_JTOPDIR/Headers" + macos_version=$(sw_vers -productVersion | sed -n -e 's/^@<:@0-9@:>@*.\(@<:@0-9@:>@*\).@<:@0-9@:>@*/\1/p') + if @<:@ "$macos_version" -gt "7" @:>@; then + _JTOPDIR="$(xcrun --show-sdk-path)/System/Library/Frameworks/JavaVM.framework" + _JINC="$_JTOPDIR/Headers" + else + _JTOPDIR="/System/Library/Frameworks/JavaVM.framework" + _JINC="$_JTOPDIR/Headers" + fi fi ;; *) _JINC="$_JTOPDIR/include";; |