From 61ab7b8bf3f15e31728ed5d4274a4e826f76ff7a Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Fri, 29 Jan 2016 08:51:29 -0500 Subject: [svn-r29016] Merge of r28936, 28949, 28960-29009 from trunk. Tested on: 64-bit Ubuntu 15.10 (Linux 4.2.0 x86_64) gcc 5.2.1 autotools serial w/ Fortran and C++ autotools parallel (MPICH 3.1.4) w/ Fortran CMake serial (3.3.2, via cmakehdf5) --- MANIFEST | 1 + bin/cmakehdf5 | 10 + c++/src/H5Library.cpp | 4 +- config/cce-fflags | 17 +- config/cce-flags | 18 +- config/cmake/ConfigureChecks.cmake | 9 - config/cmake/H5pubconf.h.in | 4 - config/gnu-cxxflags | 795 +++++++++++++++++++++++++++++++++++ config/gnu-fflags | 20 +- config/gnu-flags | 47 ++- config/ibm-flags | 29 +- config/intel-fflags | 16 +- config/intel-flags | 20 +- config/linux-gnulibc1 | 9 +- config/pgi-fflags | 16 +- config/pgi-flags | 36 +- configure.ac | 823 +++++++++++++++++++++++++------------ fortran/src/H5Sff.F90 | 4 +- hl/tools/gif2h5/h52giftest.sh.in | 2 +- src/CMakeLists.txt | 4 +- src/H5.c | 133 +++--- src/H5B.c | 11 +- src/H5B2cache.c | 4 - src/H5B2hdr.c | 4 +- src/H5B2int.c | 22 +- src/H5Bcache.c | 2 - src/H5Dcontig.c | 7 +- src/H5FDcore.c | 4 - src/H5Faccum.c | 35 +- src/H5Gcache.c | 2 - src/H5Gprivate.h | 7 - src/H5HFdblock.c | 4 +- src/H5HFtiny.c | 5 +- src/H5HG.c | 16 +- src/H5HLcache.c | 2 - src/H5MFprivate.h | 9 - src/H5Pdcpl.c | 14 +- src/H5SMcache.c | 3 +- src/H5STprivate.h | 4 +- src/H5Zscaleoffset.c | 4 - src/libhdf5.settings.in | 71 ++-- test/objcopy.c | 2 - 42 files changed, 1724 insertions(+), 525 deletions(-) create mode 100644 config/gnu-cxxflags diff --git a/MANIFEST b/MANIFEST index 8bfaaa2..9882fb1 100644 --- a/MANIFEST +++ b/MANIFEST @@ -81,6 +81,7 @@ ./config/conclude_fc.am ./config/examples.am ./config/freebsd +./config/gnu-cxxflags ./config/gnu-fflags ./config/gnu-flags ./config/i386-pc-cygwin32 diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index 7d9caa8..ccef469 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -46,6 +46,7 @@ cacheinit=$srcdir/config/cmake/cacheinit.cmake build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF # C++ interface default off build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF # Fortran interface default off build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON # High Level interface default on +build_threadsafe=-DHDF5_ENABLE_THREADSAFE:BOOL=OFF # Threadsafe feature default off build_testing=-DBUILD_TESTING:BOOL=ON # Build tests default on build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON # Build tools default on with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT=ON # enable zlib filter default on @@ -82,6 +83,8 @@ Usage: $progname [] enable or disable c++ API. Default is off. --enable-hl | --disable-hl: enable or disable high level API. Default is on. + --enable-threadsafe | --disable-threadsafe: + enable or disable threadsafe feature. Default is off --enable-shared | --disable-shared: enable or disable shared lib. Default is on. --enable-tools | --disable-tools: @@ -229,6 +232,12 @@ while [ $# -gt 0 ]; do --disable-hl) build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=OFF ;; + --enable-threadsafe) + build_threadsafe=-DHDF5_ENABLE_THREADSAFE:BOOL=ON + ;; + --disable-threadsafe) + build_threadsafe=-DHDF5_ENABLE_THREADSAFE:BOOL=OFF + ;; --enable-shared) shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON ;; @@ -330,6 +339,7 @@ STEP "Configure..." \ $build_cpp_lib \ $build_fortran \ $build_hl_lib \ + $build_threadsafe \ $shared_lib \ $build_testing \ $build_tools \ diff --git a/c++/src/H5Library.cpp b/c++/src/H5Library.cpp index 40c766a..be80fe4 100644 --- a/c++/src/H5Library.cpp +++ b/c++/src/H5Library.cpp @@ -262,10 +262,10 @@ void H5Library::setFreeListLimits(int reg_global_lim, int reg_list_lim, } // Default constructor - private -H5Library::H5Library(){}; +H5Library::H5Library(){} // Destructor - private -H5Library::~H5Library(){}; +H5Library::~H5Library(){} #ifndef H5_NO_NAMESPACE } // end namespace diff --git a/config/cce-fflags b/config/cce-fflags index 896e711..b96551d 100644 --- a/config/cce-fflags +++ b/config/cce-fflags @@ -53,14 +53,23 @@ if test "X-cce" = "X-$f9x_vendor"; then # Production # -Wl,-s to remove all symbols for smaller file - PROD_FCFLAGS="-O3 -Wl,-s" + # Note that this will likely override the symbols flag + PROD_FCFLAGS="-Wl,-s" # Debug - DEBUG_FCFLAGS="-g -O0" + DEBUG_FCFLAGS= - # Profile + # Symbols + SYMBOLS_FCFLAGS="-g" + + # Profiling # Use this for profiling with gprof - PROFILE_FCFLAGS="-g -p" + PROFILE_FCFLAGS="-p" + + # Optimization + HIGH_OPT_FCFLAGS="-O3" + DEBUG_OPT_FCFLAGS="-O0" + NO_OPT_FCFLAGS="-O0" # Flags are set f9x_flags_set=yes diff --git a/config/cce-flags b/config/cce-flags index a34fcbe..bdfb5f9 100644 --- a/config/cce-flags +++ b/config/cce-flags @@ -55,18 +55,28 @@ if test "X-cce" = "X-$cc_vendor"; then # Production # -Wl,-s to remove all symbols for smaller file - PROD_CFLAGS="-O3 -Wl,-s" + PROD_CFLAGS="-Wl,-s" PROD_CPPFLAGS= # Debug - DEBUG_CFLAGS="-g -O0" + # NDEBUG is handled explicitly in configure + DEBUG_CFLAGS= DEBUG_CPPFLAGS= - # Profile + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= + + # Profiling # Use this for profiling with gprof - PROFILE_CFLAGS="-g -p" + PROFILE_CFLAGS="-p" PROFILE_CPPFLAGS= + # Optimization + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS="-O0" + NO_OPT_CFLAGS="-O0" + # Flags are set cc_flags_set=yes diff --git a/config/cmake/ConfigureChecks.cmake b/config/cmake/ConfigureChecks.cmake index 8bd6f45..49e9a05 100644 --- a/config/cmake/ConfigureChecks.cmake +++ b/config/cmake/ConfigureChecks.cmake @@ -6,15 +6,6 @@ include (${HDF_RESOURCES_EXT_DIR}/ConfigureChecks.cmake) include (${CMAKE_ROOT}/Modules/TestForSTDNamespace.cmake) #----------------------------------------------------------------------------- -# Option to Clear File Buffers before write --enable-clear-file-buffers -#----------------------------------------------------------------------------- -option (HDF5_Enable_Clear_File_Buffers "Securely clear file buffers before writing to file" ON) -if (HDF5_Enable_Clear_File_Buffers) - set (H5_CLEAR_MEMORY 1) -endif (HDF5_Enable_Clear_File_Buffers) -MARK_AS_ADVANCED (HDF5_Enable_Clear_File_Buffers) - -#----------------------------------------------------------------------------- # Option for --enable-strict-format-checks #----------------------------------------------------------------------------- option (HDF5_STRICT_FORMAT_CHECKS "Whether to perform strict file format checks" OFF) diff --git a/config/cmake/H5pubconf.h.in b/config/cmake/H5pubconf.h.in index ce8219f..31c5afb 100644 --- a/config/cmake/H5pubconf.h.in +++ b/config/cmake/H5pubconf.h.in @@ -18,10 +18,6 @@ /* Define if building universal (internal helper macro) */ #cmakedefine H5_AC_APPLE_UNIVERSAL_BUILD @H5_AC_APPLE_UNIVERSAL_BUILD@ -/* Define if the memory buffers being written to disk should be cleared before - writing. */ -#cmakedefine H5_CLEAR_MEMORY @H5_CLEAR_MEMORY@ - /* Define if C++ compiler recognizes offsetof */ #cmakedefine H5_CXX_HAVE_OFFSETOF @H5_CXX_HAVE_OFFSETOF@ diff --git a/config/gnu-cxxflags b/config/gnu-cxxflags new file mode 100644 index 0000000..ee690db --- /dev/null +++ b/config/gnu-cxxflags @@ -0,0 +1,795 @@ +# -*- shell-script -*- +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the files COPYING and Copyright.html. COPYING can be found at the root +# of the source code distribution tree; Copyright.html can be found at the +# root level of an installed copy of the electronic HDF5 document set and +# is linked from the top-level documents page. It can also be found at +# 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. + + +# This file should be sourced into configure if the compiler is the +# GNU g++ compiler or a derivative. It is careful not to do anything +# if the compiler is not GNU; otherwise `cxx_flags_set' is set to `yes' +# + +# Get the compiler version in a way that works for g++ +# unless a compiler version is already known +# +# cxx_vendor: The compiler name: g++ +# cxx_version: Version number: 2.91.60, 2.7.2.1 +# +if test X = "X$cxx_flags_set"; then + # PathScale compiler spits out gcc version string too. Need to + # filter it out. + # icc beginning with version 12 includes a "gcc version compatiblilty" + # string, causing the gcc H5_CFLAGS to be erroneously added. The line + # "grep -v 'icc version'" causes the discarding of any output + # containing 'icc version'. The cc_version for icc is correctly determined + # and flags added in the intel-flags script. + cxx_version="`$CXX $CXXFLAGS $H5_CXXFLAGS -v 2>&1 | grep -v 'PathScale' |\ + grep -v 'icc version' |\ + grep 'gcc version' | sed 's/.*gcc version \([-a-z0-9\.]*\).*/\1/'`" + cxx_vendor=`echo $cxx_version |sed 's/\([a-z]*\).*/\1/'` + cxx_version=`echo $cxx_version |sed 's/[-a-z]//g'` + if test X = "X$cxx_vendor" -a X != "X$cxx_version"; then + cxx_vendor=g++ + fi + if test "-" != "$cxx_vendor-$cxx_version"; then + echo "compiler '$CXX' is GNU $cxx_vendor-$cxx_version" + fi + + # Some version numbers + cxx_vers_major=`echo $cxx_version | cut -f1 -d.` + cxx_vers_minor=`echo $cxx_version | cut -f2 -d.` + cxx_vers_patch=`echo $cxx_version | cut -f3 -d.` + test -n "$cc_vers_major" || cxx_vers_major=0 + test -n "$cc_vers_minor" || cxx_vers_minor=0 + test -n "$cc_vers_patch" || cxx_vers_patch=0 + cxx_vers_all=`expr $cxx_vers_major '*' 1000000 + $cxx_vers_minor '*' 1000 + $cxx_vers_patch` +fi + +# Common g++ flags for various situations +case "$cxx_vendor-$cxx_version" in + g++*) + # Architecture-specific flags + arch= + case "$host_os-$host_cpu" in + # FreeBSD sets the information from "uname -m" to the general machine + # architecture, not the specific CPU for the machine, so even our + # Pentium II Xeon server is set to "i386". Once we know we are on a FreeBSD + # machine, use the "sysctl" command to get the CPU hardware model. + freebsd*-i386) + host_cpu_model=`sysctl -n hw.model` + case "$host_cpu_model" in + # Hmm.. this might not catch Celerons, but it won't hurt them either... + *Pro*|*II*|*III*|*IV*|*Athlon*) + # architecture-specific optimizations cause problems + # for some users who build binaries to be used on + # multiple architectures. + # arch="-march=i686" + ;; + esac + ;; + + *-i686) + # architecture-specific optimizations cause problems + # for some users who build binaries to be used on + # multiple architectures. + # arch="-march=i686" + ;; + esac + + # Host-specific flags + case "`hostname`" in + sleipnir.ncsa.uiuc.edu) + arch="$arch -pipe" + ;; + esac + + # General (copied from H5_CFLAGS) + H5_CXXFLAGS="$H5_CXXFLAGS $arch -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wmissing-declarations -Wredundant-decls -Winline" + + # C++-specific + H5_CXXFLAGS="$H5_CXXFLAGS -Wsign-promo -Woverloaded-virtual -Wold-style-cast -Weffc++ -Wreorder -Wnon-virtual-dtor -Wctor-dtor-privacy -Wabi" + + # Production + case "$cxx_vendor-$cxx_version" in + g++-[34].*) + PROD_CXXFLAGS="-O3" + ;; + g++-5.*) + PROD_CXXFLAGS="-O3 -fstdarg-opt" + ;; + *) + PROD_CXXFLAGS="-O -finline-functions" + ;; + esac + + # Debug + case "$cxx_vendor-$cxx_version" in + g++-5.*) + DEBUG_CXXFLAGS="-Og -g -ftrapv -fno-common" + ;; + *) + DEBUG_CXXFLAGS="-g" + ;; + esac + + # Profile + PROFILE_CXXFLAGS="-Og -g -pg" + + # Flags are set + cxx_flags_set=yes + ;; +esac + +# Version-specific g++ flags +# +# Please follow the pattern below by adding new versions at the top, copying +# the information from the previous version and adding modifications to that. +case "$cxx_vendor-$cxx_version" in + +# Closer to the g++ 5.2 release, we should check for additional flags to +# include and break it out into it's own section, like the other versions +# below. -QAK + g++-5*) + + # Append warning flags from gcc-3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + + # Append more extra warning flags that only gcc 4.8+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsuggest-attribute=format" + + # Append more extra warning flags that only gcc 4.9+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdate-time -Wopenmp-simd" + + # (There was no release of gcc 5.0) + + # Append more extra warning flags that only gcc 5.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Warray-bounds=2" + ;; + + g++-4.9*) + # Append warning flags + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc 3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc 3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + + # Append more extra warning flags that only gcc 4.8+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsuggest-attribute=format" + + # Append more extra warning flags that only gcc 4.9+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdate-time -Wopenmp-simd" + ;; + + g++-4.8*) + # Append warning flags + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + + # Append more extra warning flags that only gcc 4.8+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsuggest-attribute=format" + ;; + + g++-4.7*) + # Append warning flags + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + # (this warning was removed in gcc 4.5+) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + + # Append more extra warning flags that only gcc 4.7+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstack-usage=8192 -Wvector-operation-performance -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + ;; + + g++-4.6*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + # (this warning was removed in gcc 4.5+) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-aliasing -Wstrict-overflow=5" + + # Append more extra warning flags that only gcc 4.6+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wdouble-promotion -Wsuggest-attribute=const -Wtrampolines" + ;; + + g++-4.5*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + # (this warning was removed in gcc 4.5+) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append more extra warning flags that only gcc 4.5+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-aliasing -Wstrict-overflow=5" + ;; + + g++-4.4*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append more extra warning flags that only gcc 4.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + ;; + + g++-4.3*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning appears to be reliable now... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + + # Append more extra warning flags that only gcc 4.3+ know about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CXXFLAGS="$H5_CXXFLAGS -Wlogical-op -Wvla" + ;; + + g++-4.2*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" + + # Append more extra warning flags that only gcc 4.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wstrict-overflow" + ;; + + g++-4.1.*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # Enable more format checking flags, beyond the basic -Wformat included + # in -Wall + H5_CXXFLAGS="$H5_CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + H5_CXXFLAGS="$H5_CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + + # Append more extra warning flags that only gcc 4.1+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wunsafe-loop-optimizations -Wvolatile-register-var" + ;; + + g++-4.0*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # The "format=2" warning generates too many warnings about valid + # usage in the library. + #CXXFLAGS="$CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append warning flags from gcc-3.4* case + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + + # Append more extra warning flags that only gcc 4.0+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wvariadic-macros -Wnonnull -Winit-self -Wmissing-include-dirs -Wswitch-default -Wswitch-enum -Wunused-macros" + ;; + + g++-3.4*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # The "format=2" warning generates too many warnings about valid + # usage in the library. + #CXXFLAGS="$CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + + # Append warning flags from gcc-3.3* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + + # Append more extra warning flags that only gcc3.4+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Winvalid-pch" + + # Replace old -W flag with new -Wextra flag + H5_CXXFLAGS="`echo $H5_CXXFLAGS | sed -e 's/-W\ /-Wextra\ /g'`" + ;; + + g++-3.3*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append warning flags from gcc-3.2* case + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # The "format=2" warning generates too many warnings about valid + # usage in the library. + #CXXFLAGS="$CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + + # Append more extra warning flags that only gcc3.3+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wendif-labels" + ;; + + g++-3.2*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append warning flags from gcc-3* case + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + + # Append more extra warning flags that only gcc3.2+ know about + H5_CXXFLAGS="$H5_CXXFLAGS -Wmissing-noreturn -Wpacked -Wdisabled-optimization" + + # The "format=2" warning generates too many warnings about valid + # usage in the library. + #CXXFLAGS="$CXXFLAGS -Wformat=2" + + # The "unreachable code" warning does not appear to be reliable yet... + #CXXFLAGS="$CXXFLAGS -Wunreachable-code" + ;; + + g++-3*) + # Disable warnings about using 'long long' type + H5_CXXFLAGS="$H5_CXXFLAGS -Wno-long-long" + + # Append some extra warning flags that only gcc3+ know about + # (don't use -Wpadded flag for normal builds, many of the warnings its + # issuing can't be fixed and they are making it hard to detect other, + # more important warnings) + #H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute -Wpadded" + H5_CXXFLAGS="$H5_CXXFLAGS -Wfloat-equal -Wmissing-format-attribute" + ;; +esac + +# Clear cxx info if no flags set +if test "X$cxx_flags_set" = "X"; then + cxx_vendor= + cxx_version= +fi diff --git a/config/gnu-fflags b/config/gnu-fflags index 1d6caa1..3a90c10 100644 --- a/config/gnu-fflags +++ b/config/gnu-fflags @@ -78,14 +78,26 @@ if test "X-gfortran" = "X-$f9x_vendor"; then FSEARCH_DIRS="" H5_FCFLAGS="$H5_FCFLAGS -pedantic -Wall -Wconversion -Wunderflow -Wimplicit-interface -W" + # Turn off warnings for passing non-ANSI types to BIND(). + # We pass a lot of hid_t, etc. types so this generates a LOT of spurious warnings. + H5_FCFLAGS="$H5_FCFLAGS -Wno-c-binding-type" + # Production - PROD_FCFLAGS="-O2 -s" + PROD_FCFLAGS="-s" # Debug - DEBUG_FCFLAGS="-g -fbounds-check" + DEBUG_FCFLAGS="-fbounds-check" + + # Symbols + SYMBOLS_FCFLAGS="-g" + + # Profiling + PROFILE_FCFLAGS="-pg" - # Profile - PROFILE_FCFLAGS="-g -pg" + # Optimization + HIGH_OPT_FCFLAGS="-O2" + DEBUG_OPT_FCFLAGS="-O0" + NO_OPT_FCFLAGS="-O0" # Flags are set f9x_flags_set=yes diff --git a/config/gnu-flags b/config/gnu-flags index e7f8f14..232bf05 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -97,39 +97,64 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS $arch -std=c99 -pedantic -Wall -W -Wundef -Wshadow -Wpointer-arith -Wbad-function-cast -Wcast-qual -Wcast-align -Wwrite-strings -Wconversion -Waggregate-return -Wstrict-prototypes -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls -Wnested-externs -Winline" # Production + # NDEBUG is handled explicitly by the configure script case "$cc_vendor-$cc_version" in gcc-[34].*) - PROD_CFLAGS="-O3" + PROD_CFLAGS= ;; gcc-5.*) - PROD_CFLAGS="-O3 -fstdarg-opt" + PROD_CFLAGS="-fstdarg-opt" ;; *) - PROD_CFLAGS="-O -finline-functions" + # gcc automatically inlines based on the optimization level + # this is just a failsafe + PROD_CFLAGS="-finline-functions" ;; esac - PROD_CPPFLAGS= # Debug + # NDEBUG is handled explicitly by the configure script + # -g is hanled by the symbols flags case "$cc_vendor-$cc_version" in gcc-5.*) - DEBUG_CFLAGS="-Og -g -ftrapv -fno-common" + DEBUG_CFLAGS="-ftrapv -fno-common" ;; *) - DEBUG_CFLAGS="-g" + DEBUG_CFLAGS= ;; esac - #DEBUG_CFLAGS="$DEBUG_CFLAGS -fsanitize=undefined" + #DEBUG_CFLAGS="-fsanitize=undefined" DEBUG_CPPFLAGS= - # Try out the new "stack protector" feature introduced in gcc 4.1 - # (We should also think about adding some of the other memory protection options) - #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all" + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= # Profile - PROFILE_CFLAGS="-Og -g -pg" + PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + # Optimization (only CFLAGS at this time) + case "$cc_vendor-$cc_version" in + gcc-[34].*) + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS= + ;; + gcc-5.*) + HIGH_OPT_CFLAGS="-O3" + DEBUG_OPT_CFLAGS="-Og" + ;; + *) + HIGH_OPT_CFLAGS="-O" + DEBUG_OPT_CFLAGS= + ;; + esac + NO_OPT_CFLAGS="-O0" + + # Try out the new "stack protector" feature introduced in gcc 4.1 + # (We should also think about adding some of the other memory protection options) + #DEBUG_CFLAGS="$DEBUG_CFLAGS -Wstack-protector -fstack-protector-all" + # Flags are set cc_flags_set=yes ;; diff --git a/config/ibm-flags b/config/ibm-flags index 462372d..731968d 100644 --- a/config/ibm-flags +++ b/config/ibm-flags @@ -55,19 +55,38 @@ if test "XL" = "$cc_vendor"; then # Turn off shared lib option. It causes some test suite to fail. enable_shared="${enable_shared:-no}" + # Make sure this is applied to other API compile options such as C++. AM_CFLAGS="$AM_CFLAGS" + # -qflag=w:w makes the lowest level of reported compile issues to be "warning" # instead of "information". This suppresses a very large number of messages # concerning the portability of __inline__. H5_CFLAGS="-qlanglvl=stdc99 -qflag=w:w $H5_CFLAGS" - DEBUG_CFLAGS="-g -qfullpath" - DEBUG_CPPFLAGS= - # -O causes test/dtypes to fail badly. Turn it off for now. - PROD_CFLAGS="" + + # Produciton + PROD_CFLAGS= PROD_CPPFLAGS= - PROFILE_CFLAGS="-g -qfullpath -pg" + + # Debug + # NDEBUG is handled explicitly in configure + DEBUG_CFLAGS="-qfullpath" + DEBUG_CPPFLAGS= + + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= + + # Profiling + PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + + # Optimization + # -O causes test/dtypes to fail badly. Turn it off for now. + HIGH_OPT_CFLAGS= + DEBUG_OPT_CFLAGS= + NO_OPT_CFLAGS= + # Flags are set cc_flags_set=yes fi diff --git a/config/intel-fflags b/config/intel-fflags index 3e33fc9..1f7cf78 100644 --- a/config/intel-fflags +++ b/config/intel-fflags @@ -73,14 +73,22 @@ if test "X-ifort" = "X-$f9x_vendor"; then H5_FCFLAGS="$H5_FCFLAGS" # Production - PROD_FCFLAGS="-O3" + PROD_FCFLAGS= # Debug - DEBUG_FCFLAGS="-g -check all" + DEBUG_FCFLAGS="-check all" - # Profile + # Symbols + SYMBOLS_FCFLAGS="-g" + + # Profiling # Use this for profiling with gprof - PROFILE_FCFLAGS="-g -p" + PROFILE_FCFLAGS="-p" + + # Optimization + HIGH_OPT_FCFLAGS="-O3" + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= # Flags are set f9x_flags_set=yes diff --git a/config/intel-flags b/config/intel-flags index 3187daf..a3238fa 100644 --- a/config/intel-flags +++ b/config/intel-flags @@ -68,21 +68,31 @@ if test "X-icc" = "X-$cc_vendor"; then # General # Default to C99 standard. - H5_CFLAGS="${H5_CFLAGS:--std=c99 $arch}" + H5_CFLAGS="${H5_CFLAGS:--std=c99 $arch} -Wcheck -Wall" # Production is set to default; see settings for specific version further down - PROD_CFLAGS="-O" + PROD_CFLAGS= PROD_CPPFLAGS= # Debug - DEBUG_CFLAGS="-Wcheck -Wall -g -O0" + # NDEBUG is handled explicitly in configure + DEBUG_CFLAGS= DEBUG_CPPFLAGS= - # Profile + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= + + # Profiling # Use this for profiling with gprof - PROFILE_CFLAGS="-g -p" + PROFILE_CFLAGS="-p" PROFILE_CPPFLAGS= + # Optimization + HIGH_OPT_CFLAGS="-O" + DEBUG_OPT_CFLAGS="-O0" + NO_OPT_CFLAGS="-O0" + # Flags are set cc_flags_set=yes diff --git a/config/linux-gnulibc1 b/config/linux-gnulibc1 index 465bfed..46771dc 100644 --- a/config/linux-gnulibc1 +++ b/config/linux-gnulibc1 @@ -51,7 +51,7 @@ if test "X-" = "X-$FC"; then FC=gfortran FC_BASENAME=gfortran ;; - pgcc*) + pgcc*) FC=pgf90 FC_BASENAME=pgf90 ;; @@ -92,6 +92,9 @@ else esac fi +# Figure out GNU FC compiler flags +. $srcdir/config/gnu-fflags + # Figure out PGI FC compiler flags . $srcdir/config/pgi-fflags @@ -130,6 +133,9 @@ if test -z "$CXX"; then CXX_BASENAME=g++ fi +# Figure out GNU CXX compiler flags +. $srcdir/config/gnu-cxxflags + # compiler version strings # check if the compiler_version_info is already set @@ -177,6 +183,7 @@ case $FC in *mpif90*) fc_version_info=`$FC $FCFLAGS $H5_FCFLAGS -v 2>&1 | grep 'version' |\ sed 's/^[a-z0-9]* for //' |\ + sed ā€™s/\ā€/\\\ā€/gā€™ |\ sed 's/^\([a-z]* \)/ built with \1/1'` fc_version_info=`echo $fc_version_info` ;; diff --git a/config/pgi-fflags b/config/pgi-fflags index 8e574e4..fbcba52 100644 --- a/config/pgi-fflags +++ b/config/pgi-fflags @@ -87,12 +87,20 @@ if test "X-pgf90" = "X-$f9x_vendor"; then PROD_FCFLAGS="-fast -s -Mnoframe" # Debug - DEBUG_FCFLAGS="-g -Mbounds -Mchkptr -Mdclchk" + DEBUG_FCFLAGS="-Mbounds -Mchkptr -Mdclchk" - # Profile - PROFILE_FCFLAGS="-g -Mprof=func,line" + # Symbols + SYMBOLS_FCFLAGS="-g" + + # Profiling + PROFILE_FCFLAGS="-Mprof=func,line" # Use this for profiling with gprof - #PROFILE_FCFLAGS="-g -pg" + #PROFILE_FCFLAGS="-pg" + + # Optimization + HIGH_OPT_FCFLAGS= + DEBUG_OPT_FCFLAGS= + NO_OPT_FCFLAGS= # Flags are set f9x_flags_set=yes diff --git a/config/pgi-flags b/config/pgi-flags index 29e6f05..674f60e 100644 --- a/config/pgi-flags +++ b/config/pgi-flags @@ -72,13 +72,11 @@ if test "X-pgcc" = "X-$cc_vendor"; then # Production case "$cc_vendor-$cc_version" in - # Tweak down compiler optimizations for v10.6, it has a bug pgcc-10.6*) - PROD_CFLAGS="-O1 -s" + PROD_CFLAGS="-s" ;; - # Tweak down compiler optimizations for v9.x pgcc-9.*) - PROD_CFLAGS="-O1 -s" + PROD_CFLAGS="-s" ;; *) PROD_CFLAGS="-fast -s" @@ -87,15 +85,37 @@ if test "X-pgcc" = "X-$cc_vendor"; then PROD_CPPFLAGS= # Debug - DEBUG_CFLAGS="-g -Mbounds" + # NDEBUG is handled explicitly by the configure script + DEBUG_CFLAGS="-Mbounds" DEBUG_CPPFLAGS= - # Profile - PROFILE_CFLAGS="-g -Mprof=func,line" + # Symbols + SYMBOL_CFLAGS="-g" + SYMBOL_CPPFLAGS= + + # Profiling + PROFILE_CFLAGS="-Mprof=func,line" # Use this for profiling with gprof - #PROFILE_CFLAGS="-g -pg" + #PROFILE_CFLAGS="-pg" PROFILE_CPPFLAGS= + # Optimization + case "$cc_vendor-$cc_version" in + # Tweak down compiler optimizations for v10.6, it has a bug + pgcc-10.6*) + HIGH_OPT_CFLAGS="-O1" + ;; + # Tweak down compiler optimizations for v9.x + pgcc-9.*) + HIGH_OPT_CFLAGS="-O1" + ;; + *) + HIGH_OPT_CFLAGS= + ;; + esac + DEBUG_OPT_CFLAGS= + NO_OPT_CFLAGS= + # Flags are set cc_flags_set=yes diff --git a/configure.ac b/configure.ac index 75e9d63..de8a348 100644 --- a/configure.ac +++ b/configure.ac @@ -151,46 +151,64 @@ AC_MSG_CHECKING([shell variables initial values]) set >&AS_MESSAGE_LOG_FD AC_MSG_RESULT([done]) -## Define all symbol variables used for configure summary. -## EXTERNAL_FILTERS equals all external filters. Default none. -## MPE: whether MPE option is enabled. Default no. -## STATIC_EXEC: whether static-exec is enabled. Default no. -## HDF_FORTRAN: whether Fortran is enabled. Default no. -## FC: Fortran compiler. -## HDF_CXX: whether C++ is enabled. Default no. -## CXX: C++ compiler. -## HDF5_HL: whether high-level library is enabled. Default is yes. -## INSTRUMENT: whether INSTRUMENT is enabled. No default set here. -## CODESTACK: whether CODESTACK is enabled. Default no. -## HAVE_DMALLOC: whether system has dmalloc support. Default no. -## HAVE_FLOAT128: whether system has Quad-Precision Math Library. Default no. -## DIRECT_VFD: whether DIRECT_VFD is enabled. Default no. -## THREADSAFE: whether THREADSAFE is enabled. Default no. -## STATIC_SHARED: whether static and/or shared libraries are requested. -## enable_shared: whether shared lib is enabled. -## enable_static: whether static lib is enabled. -## UNAME_INFO: System information. +## ---------------------------------------------------------------------- +## Save system information for the library settings file. +## +AC_SUBST([UNAME_INFO]) +UNAME_INFO=`uname -a` + +## ---------------------------------------------------------------------- +## Determine build mode (debug, production, clean). +## This has to be done early since the build mode is referred to +## frequently. +## +AC_MSG_CHECKING([build mode]) +AC_ARG_ENABLE([build-mode], + [AS_HELP_STRING([--enable-build-mode=(debug|production|clean)], + [Sets the build mode. Debug turns on symbols, API + tracing, asserts, and debug optimization, + as well as several other minor configure options + that aid in debugging. + Production turns high optimizations on. + Clean turns nothing on and disables optimization + (i.e.: a 'clean slate' configuration). + All these settings can be overridden by using + specific configure flags. + [default=debug] + ])], + [BUILD_MODE=$enableval]) -AC_SUBST([EXTERNAL_FILTERS]) -AC_SUBST([MPE]) MPE=no -AC_SUBST([STATIC_EXEC]) STATIC_EXEC=no -AC_SUBST([HDF_FORTRAN]) HDF_FORTRAN=no -AC_SUBST([FC]) HDF_FORTRAN=no -AC_SUBST([HDF_CXX]) HDF_CXX=no -AC_SUBST([CXX]) HDF_CXX=no -AC_SUBST([HDF5_HL]) HDF5_HL=yes -AC_SUBST([INSTRUMENT]) -AC_SUBST([CODESTACK]) CODESTACK=no -AC_SUBST([HAVE_DMALLOC]) HAVE_DMALLOC=no -AC_SUBST([DIRECT_VFD]) DIRECT_VFD=no -AC_SUBST([THREADSAFE]) THREADSAFE=no -AC_SUBST([STATIC_SHARED]) -AC_SUBST([enable_shared]) -AC_SUBST([enable_static]) -AC_SUBST([UNAME_INFO]) UNAME_INFO=`uname -a` -AC_SUBST([PAC_C_MAX_REAL_PRECISION]) -AC_SUBST([Fortran_COMPILER_ID]) -Fortran_COMPILER_ID=none +## Set the default +## Depends on branch, set via script at branch creation time +if test "X-$BUILD_MODE" = X- ; then + BUILD_MODE=debug +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([BUILD_MODE]) + +case "X-$BUILD_MODE" in + X-clean) + AC_MSG_RESULT([clean]) + ;; + X-debug) + H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS" + H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS" + AC_MSG_RESULT([debug]) + ;; + X-production) + H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS" + H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS" + AC_MSG_RESULT([production]) + ;; + *) + AC_MSG_ERROR([Unrecognized build mode: $BUILD_MODE. Use debug, production, or clean.]) +esac ## ---------------------------------------------------------------------- ## Some platforms have broken basename, and/or xargs programs. Check @@ -373,7 +391,9 @@ AC_CHECK_SIZEOF([float]) AC_CHECK_SIZEOF([double]) AC_CHECK_SIZEOF([long double]) +## ---------------------------------------------------------------------- ## Check for non-standard extenstion __FLOAT128 +## HAVE_FLOAT128=0 HAVE_QUADMATH=0 FLT128_DIG=0 @@ -384,6 +404,8 @@ AC_CHECK_SIZEOF([_Quad]) AC_CHECK_HEADERS([quadmath.h], [HAVE_QUADMATH=1], []) PAC_FC_LDBL_DIG +AC_SUBST([PAC_C_MAX_REAL_PRECISION]) + if test "$ac_cv_sizeof___float128" != 0 && test "$FLT128_DIG" != 0 ; then AC_DEFINE([HAVE_FLOAT128], [1], [Determine if __float128 is available]) PAC_C_MAX_REAL_PRECISION=$FLT128_DIG @@ -392,9 +414,17 @@ else fi AC_DEFINE_UNQUOTED([PAC_C_MAX_REAL_PRECISION], $PAC_C_MAX_REAL_PRECISION, [Determine the maximum decimal precision in C]) AC_MSG_RESULT([$PAC_C_MAX_REAL_PRECISION]) + ## ---------------------------------------------------------------------- ## Check if they would like the Fortran interface compiled ## + +## This needs to be exposed for the library info file even if Fortran is disabled. +AC_SUBST([HDF_FORTRAN]) + +## Default is no Fortran +HDF_FORTRAN=no + AC_SUBST([HDF5_INTERFACES]) HDF5_INTERFACES="" AC_MSG_CHECKING([if Fortran interface enabled]) AC_ARG_ENABLE([fortran], @@ -417,7 +447,7 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_CONFIG_HEADERS([fortran/src/H5config_f.inc], [cat fortran/src/H5config_f.inc | sed '1d;s%^/\* \(.*\) \*/%\1%;s/#define /#define H5_/;s/#undef /#undef H5_/' >fortran/src/H5config_f.inc.tmp; mv -f fortran/src/H5config_f.inc.tmp fortran/src/H5config_f.inc]) - AC_SUBST([FC]) HDF_FORTRAN=yes + AC_SUBST([FC]) HDF5_INTERFACES="$HDF5_INTERFACES fortran" @@ -520,6 +550,8 @@ if test "X$HDF_FORTRAN" = "Xyes"; then AC_SUBST([H5CONFIG_F_RKIND_SIZEOF]) AC_SUBST([H5CONFIG_F_NUM_IKIND]) AC_SUBST([H5CONFIG_F_IKIND]) + AC_SUBST([Fortran_COMPILER_ID]) + Fortran_COMPILER_ID=none AC_DEFINE_UNQUOTED([Fortran_COMPILER_ID], $Fortran_COMPILER_ID, [Define Fortran compiler ID]) ## Setting definition if there is a 16 byte fortran integer @@ -609,11 +641,17 @@ fi ## ---------------------------------------------------------------------- ## Check if they would like the C++ interface compiled ## +## This needs to be exposed for the library info file even if C++ is disabled. +AC_SUBST([HDF_CXX]) + +## Default is no C++ +HDF_CXX=no + ## We need to check for a C++ compiler unconditionally, since ## AC_PROG_CXX defines some macros that Automake 1.9.x uses and will ## miss even if c++ is not enabled. - AC_PROG_CXX - AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done +AC_PROG_CXX +AC_PROG_CXXCPP ## this is checked for when AC_HEADER_STDC is done AC_MSG_CHECKING([if c++ interface enabled]) @@ -626,19 +664,22 @@ if test "X$HDF_CXX" = "Xyes"; then echo "yes" HDF5_INTERFACES="$HDF5_INTERFACES c++" + ## Expose the compiler for *.in files + AC_SUBST([CXX]) + ## Change to the C++ language AC_LANG_PUSH(C++) - # Checking if C++ needs old style header files in includes + ## Checking if C++ needs old style header files in includes PAC_PROG_CXX_HEADERS - # Checking if C++ can handle namespaces + ## Checking if C++ can handle namespaces PAC_PROG_CXX_NAMESPACE - # Checking if C++ has offsetof extension + ## Checking if C++ has offsetof extension PAC_PROG_CXX_OFFSETOF - # if C++ can handle static cast + ## if C++ can handle static cast PAC_PROG_CXX_STATIC_CAST else @@ -654,23 +695,41 @@ AC_LANG_POP(C++) ## Check if they would like the High Level library compiled ## -AC_SUBST(HL) HL="" -## name of fortran folder inside "hl", if FORTRAN compile is requested -AC_SUBST(HL_FOR) HL_FOR="" -AC_MSG_CHECKING([if high level library is enabled]) +## This needs to be exposed for the library info file even if the HL +## library is disabled. +AC_SUBST([HDF5_HL]) + +## The high-level library is enabled unless the build mode is clean. +if test "X-$BUILD_MODE" = "X-clean" ; then + HDF5_HL=no +else + HDF5_HL=yes +fi + +## high-level library directories (set when needed, blank until then) +## +## main high-level library +AC_SUBST(HL) +HL="" +## Fortran high-level library +AC_SUBST(HL_FOR) +HL_FOR="" + +AC_MSG_CHECKING([if the high-level library is enabled]) AC_ARG_ENABLE([hl], [AS_HELP_STRING([--enable-hl], - [Enable the high level library [default=yes]])], - [HDF5_HL=$enableval], - [HDF5_HL=yes]) + [Enable the high-level library. + [default=yes (unless build mode = clean)] + ])], + [HDF5_HL=$enableval]) -if test "X$HDF5_HL" = "Xyes"; then - echo "yes" +if test "X-$HDF5_HL" = "X-yes"; then + AC_MSG_RESULT([yes]) HL="hl" AC_DEFINE([INCLUDE_HL], [1], - [Define if HDF5's high-level library headers should be included in hdf5.h]) + [Define if the high-level library headers should be included in hdf5.h]) else - echo "no" + AC_MSG_RESULT([no]) fi @@ -693,7 +752,8 @@ AC_PROG_INSTALL ## ---------------------------------------------------------------------- -## Set up ${TR} which is used to process DEBUG_PKG. +## Set up ${TR} which is used to process the package list for extra +## debugging output in the C library. AC_PATH_PROG([TR], [tr]) @@ -829,6 +889,11 @@ LT_INIT([dlopen,win32-dll]) ## This check needs to occur after libtool is initialized because ## we check a libtool cache value and may issue a warning based ## on its result. +AC_SUBST([STATIC_EXEC]) + +## Default is no +STATIC_EXEC=no + AC_MSG_CHECKING([if we should install only statically linked executables]) AC_ARG_ENABLE([static_exec], [AS_HELP_STRING([--enable-static-exec], @@ -840,8 +905,8 @@ if test "X$STATIC_EXEC" = "Xyes"; then echo "yes" ## Issue a warning if -static flag is not supported. if test "X$lt_cv_prog_compiler_static_works" = "Xno"; then - echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." - LT_STATIC_EXEC="" + echo " warning: -static flag not supported on this system; executable won't statically link shared system libraries." + LT_STATIC_EXEC="" else LT_STATIC_EXEC="-all-static" fi @@ -890,50 +955,6 @@ case "X-$RPATH" in esac ## ---------------------------------------------------------------------- -## Production flags? Save the value in $CONFIG_MODE so we have it for -## the record. -## -AC_MSG_CHECKING([for production mode]) -AC_ARG_ENABLE([production], - [AS_HELP_STRING([--enable-production], - [Determines how to run the compiler.])]) - -case "X-$enable_production" in - X-yes) - enable_production="yes" - AC_MSG_RESULT([production]) - CONFIG_MODE=production - H5_CFLAGS="$H5_CFLAGS $PROD_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $PROD_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $PROD_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $PROD_FCFLAGS" - ;; - X-|X-no) - enable_production="no" - AC_MSG_RESULT([development]) - CONFIG_MODE=development - H5_CFLAGS="$H5_CFLAGS $DEBUG_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $DEBUG_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $DEBUG_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $DEBUG_FCFLAGS" - ;; - X-pg|X-profile) - enable_production="profile" - AC_MSG_RESULT([profile]) - CONFIG_MODE=profile - H5_CFLAGS="$H5_CFLAGS $PROFILE_CFLAGS" - H5_CPPFLAGS="$H5_CPPFLAGS $PROFILE_CPPFLAGS" - H5_CXXFLAGS="$H5_CXXFLAGS $PROFILE_CXXFLAGS" - H5_FCFLAGS="$H5_FCFLAGS $PROFILE_FCFLAGS" - ;; - *) - enable_production="user-defined" - AC_MSG_RESULT([user-defined]) - CONFIG_MODE="$enableval" - ;; -esac - -## ---------------------------------------------------------------------- ## Check for system libraries. "dl" stands for dynamically loaded library ## AC_CHECK_LIB([m], [ceil]) @@ -1182,6 +1203,11 @@ AC_ARG_WITH([fnord], ## command-line switch. The value is an include path and/or a library path. ## If the library path is specified then it must be preceded by a comma. ## +AC_SUBST([HAVE_DMALLOC]) + +## Default is not present +HAVE_DMALLOC=no + AC_ARG_WITH([dmalloc], [AS_HELP_STRING([--with-dmalloc=DIR], [Use dmalloc memory debugging aid [default=no]])],, @@ -1246,6 +1272,14 @@ case $withval in esac ## ---------------------------------------------------------------------- +## Make the external filters list available to *.in files +## At this point it's unset (no external filters by default) but it +## will be filled in during the deflate (zlib) and szip processing +## below. +## +AC_SUBST([EXTERNAL_FILTERS]) + +## ---------------------------------------------------------------------- ## Is the GNU zlib present? It has a header file `zlib.h' and a library ## `-lz' and their locations might be specified with the `--with-zlib' ## command-line switch. The value is an include path and/or a library path. @@ -1335,7 +1369,7 @@ if test "x$HAVE_ZLIB" = "xyes" -a "x$HAVE_ZLIB_H" = "xyes" -a "x$HAVE_COMPRESS2" if test "X$EXTERNAL_FILTERS" != "X"; then EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)" + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}deflate(zlib)" fi @@ -1458,13 +1492,13 @@ if test "x$HAVE_SZLIB" = "xyes" -a "x$HAVE_SZLIB_H" = "xyes"; then if test "X$EXTERNAL_FILTERS" != "X"; then EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)" + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(encoder)" fi if test ${hdf5_cv_szlib_can_encode} = "no"; then if test "X$EXTERNAL_FILTERS" != "X"; then EXTERNAL_FILTERS="${EXTERNAL_FILTERS}," fi - EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)" + EXTERNAL_FILTERS="${EXTERNAL_FILTERS}szip(no encoder)" fi fi @@ -1477,6 +1511,11 @@ AC_CACHE_SAVE ## Enable thread-safe version of library. It requires Pthreads support ## on POSIX systems. ## +AC_SUBST([THREADSAFE]) + +## Default is no thread-safety +THREADSAFE=no + AC_MSG_CHECKING([for thread safe support]) AC_ARG_ENABLE([threadsafe], [AS_HELP_STRING([--enable-threadsafe], @@ -1484,7 +1523,7 @@ AC_ARG_ENABLE([threadsafe], [default=no]])], [THREADSAFE=$enableval]) -## NOTE: The high-level, C++, and Fortran interfaces are not compatible +## The high-level, C++, and Fortran interfaces are not compatible ## with the thread-safety option because the lock is not hoisted ## into the higher-level API calls. @@ -1837,56 +1876,277 @@ AC_MSG_RESULT([%${hdf5_cv_printf_ll}d and %${hdf5_cv_printf_ll}u]) AC_DEFINE_UNQUOTED([PRINTF_LL_WIDTH], ["$hdf5_cv_printf_ll"], [Width for printf() for type `long long' or `__int64', use `ll']) - ## ---------------------------------------------------------------------- -## Turn on debugging by setting compiler flags -## This must come after the enable-production since it depends on production. +## Deprecate old ways of determining debug/production build +## These can probably be removed in the future (1.10.1?) ## -AC_MSG_CHECKING([for debug flags]) AC_ARG_ENABLE([debug], - [AS_HELP_STRING([--enable-debug=all], - [Turn on debugging in all packages. One may - also specify a comma-separated list of - package names without the leading H5 or - the word no. The default is most packages - if production is disabled; no if it is enabled. + [AS_HELP_STRING([--enable-debug], + [DEPRECATED: use --enable-build-mode=debug])], + [DEPRECATED_DEBUG=$enableval]) + +if test "X-$DEPRECATED_DEBUG" != "X-" ; then + AC_MSG_ERROR([--enable-debug is deprecated, use --enable-build-mode=debug instead.]) +fi + +AC_ARG_ENABLE([production], + [AS_HELP_STRING([--enable-production], + [DEPRECATED: use --enable-build-mode=production])], + [DEPRECATED_PRODUCTION=$enableval]) + +if test "X-$DEPRECATED_PRODUCTION" != "X-" ; then + AC_MSG_ERROR([--enable-production is deprecated, use --enable-build-mode=production instead.]) +fi + + +## ---------------------------------------------------------------------- +## Check if the compiler should include symbols +## +AC_MSG_CHECKING([enable debugging symbols]) +AC_ARG_ENABLE([symbols], + [AS_HELP_STRING([--enable-symbols=(yes|no|)], + [Add debug symbols to the library (e.g.: build with -g). + This is independent of the build mode and optimization + level. The custom string allows special settings like + -ggdb, etc. to be used. + [default=yes if debug build, otherwise no] ])], - [DEBUG_PKG=$enableval]) + [SYMBOLS=$enableval]) -## Default to no if producton is enabled -if test "X-$DEBUG_PKG" = X- ; then - if test "$enable_production" = yes ; then - DEBUG_PKG=no - else - DEBUG_PKG=yes - fi +## Set default +if test "X-$SYMBOLS" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + SYMBOLS=yes + else + SYMBOLS=no + fi fi -AC_SUBST([DEBUG_PKG]) -all_packages="ac,b,b2,d,e,f,g,hg,hl,i,mf,mm,o,p,s,t,v,z" -case "X-$DEBUG_PKG" in +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([SYMBOLS]) + +case "X-$SYMBOLS" in X-yes) - DEBUG_PKG="d,e,f,g,hg,i,mm,o,p,s,t,v,z" -## H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG" - AC_MSG_RESULT([default ($DEBUG_PKG)]) + H5_CFLAGS="$H5_CFLAGS $SYMBOLS_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $SYMBOLS_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $SYMBOLS_FCFLAGS" + AC_MSG_RESULT([yes]) ;; - X-all) - DEBUG_PKG=$all_packages -## H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG" - AC_MSG_RESULT([all ($DEBUG_PKG)]) + X-no) + AC_MSG_RESULT([no]) ;; - X-no|X-none) + *) + H5_CFLAGS="$H5_CFLAGS $SYMBOLS" + H5_CXXFLAGS="$H5_CXXFLAGS $SYMBOLS" + H5_FCFLAGS="$H5_FCFLAGS $SYMBOLS" + SYMBOLS="custom ($SYMBOLS)" + AC_MSG_RESULT([$SYMBOLS]) + ;; +esac + +## ---------------------------------------------------------------------- +## Check if the assert macro should be enabled +## +AC_MSG_CHECKING([enable asserts]) +AC_ARG_ENABLE([asserts], + [AS_HELP_STRING([--enable-asserts], + [Determines whether NDEBUG is defined or not, which + controls assertions. + This is independent of the build mode and presence + of debugging symbols. + [default=yes if debug build, otherwise no] + ])], + [ASSERTS=$enableval]) + +## Set default +if test "X-$ASSERTS" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + ASSERTS=yes + else + ASSERTS=no + fi +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([ASSERTS]) + +case "X-$ASSERTS" in + X-yes) + H5_CPPFLAGS="$H5_CPPFLAGS -UNDEBUG" + AC_MSG_RESULT([yes]) + ;; + X-no) + H5_CPPFLAGS="$H5_CPPFLAGS -DNDEBUG" + AC_MSG_RESULT([no]) + ;; + *) + AC_MSG_ERROR([Unrecognized value: $ASSERTS]) + ;; +esac + +## ---------------------------------------------------------------------- +## Check if the compiler should use profiling flags/settings +## +AC_MSG_CHECKING([profiling]) +AC_ARG_ENABLE([profiling], + [AS_HELP_STRING([--enable-profiling=(yes|no|)], + [Enable profiling flags (e.g.: -pg). + This can be set independently from the build mode. + The custom setting can be used to pass alternative + profiling flags (e.g.: -P for using Prof with gcc). + [default=no] + ])], + [PROFILING=$enableval]) + +## Default is no profiling +if test "X-$PROFILING" = X- ; then + PROFILING=no +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([PROFILING]) + +case "X-$PROFILING" in + X-yes) + H5_CFLAGS="$H5_CFLAGS $PROFILE_CFLAGS" + H5_CXXFLAGS="$H5_CXXFLAGS $PROFILE_CXXFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $PROFILE_FCFLAGS" + AC_MSG_RESULT([yes]) + ;; + X-no) + AC_MSG_RESULT([no]) + ;; + *) + H5_CFLAGS="$H5_CFLAGS $PROFILING" + H5_CXXFLAGS="$H5_CXXFLAGS $PROFILING" + H5_FCFLAGS="$H5_FCFLAGS $PROFILING" + PROFILING="custom ($PROFILING)" + AC_MSG_RESULT([$PROFILING]) + ;; +esac + +## ---------------------------------------------------------------------- +## Check if the compiler should use a particular optimization setting +## +AC_MSG_CHECKING([optimization level]) +AC_ARG_ENABLE([optimization], + [AS_HELP_STRING([--enable-optimization=(high|debug|none|)], + [Enable optimization flags/settings (e.g.: -O3). + This can be set independently from the build mode. + Optimizations for a given compiler can be specified + at several levels: High, with aggressive optimizations + turned on; debug, with optimizations that are + unlikely to interfere with debugging or profiling; + and none, with no optimizations at all. + See the compiler-specific config/*-flags file for more + details. + Alternatively, optimization options can + be specified directly by specifying them as a + string value. These custom optimzation flags will + completely replace all other optimization flags. + [default depends on build mode: debug=debug, + production=high, clean=none] + ])], + [OPTIMIZATION=$enableval]) + +## Set the default optimization level. This depends on the compiler mode. +if test "X-$OPTIMIZATION" = X- ; then + case "X-$BUILD_MODE" in + X-debug) + OPTIMIZATION=debug + ;; + X-production) + OPTIMIZATION=high + ;; + X-clean) + OPTIMIZATION=none + ;; + esac +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([OPTIMIZATION]) + +case "X-$OPTIMIZATION" in + X-high) + H5_CFLAGS="$H5_CFLAGS $HIGH_OPT_CFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $HIGH_OPT_FCFLAGS" + AC_MSG_RESULT([high]) + ;; + X-debug) + H5_CFLAGS="$H5_CFLAGS $DEBUG_OPT_CFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $DEBUG_OPT_FCFLAGS" + AC_MSG_RESULT([debug]) + ;; + X-none) + H5_CFLAGS="$H5_CFLAGS $NO_OPT_CFLAGS" + H5_FCFLAGS="$H5_FCFLAGS $NO_OPT_FCFLAGS" AC_MSG_RESULT([none]) - DEBUG_PKG= -## H5_CPPFLAGS="$H5_CPPFLAGS -DNDEBUG" ;; *) - AC_MSG_RESULT([$DEBUG_PKG]) + H5_CFLAGS="$H5_CFLAGS $OPTIMIZATION" + H5_FCFLAGS="$H5_FCFLAGS $OPTIMIZATION" + OPTIMIZATION="custom ($OPTIMIZATION)" + AC_MSG_RESULT([$OPTIMIZATION]) + ;; +esac + +## ---------------------------------------------------------------------- +## Enable/disable internal package-level debugging output +## +AC_MSG_CHECKING([for internal debug output]) +AC_ARG_ENABLE([internal-debug], + [AS_HELP_STRING([--enable-internal-debug=(yes|all|no|none|)], + [Enable extra debugging output on HDF5 library + errors. One may also specify a comma-separated + list of package names without the leading H5. + This is independent of the build mode + and is mainly of interest to HDF Group developers. + Yes/all and no/none are synonymous. + [default=all if debug build, otherwise none] + ])], + [INTERNAL_DEBUG_OUTPUT=$enableval]) + +## Set default +if test "X-$INTERNAL_DEBUG_OUTPUT" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + INTERNAL_DEBUG_OUTPUT=all + else + INTERNAL_DEBUG_OUTPUT=none + fi +fi + +AC_SUBST([INTERNAL_DEBUG_OUTPUT]) + +## These are all the packages that use H5*_DEBUG. +## There is no harm in specifying a package not in this list; +## you'll just get an unused H5_DEBUG symbol. +## all_packages="AC,B,B2,D,F,FA,FL,FS,HL,I,O,S,ST,T,Z" +all_packages="AC,B,B2,D,F,HL,I,O,S,ST,T,Z" + +case "X-$INTERNAL_DEBUG_OUTPUT" in + X-yes|X-all) + INTERNAL_DEBUG_OUTPUT=$all_packages + DEBUG_PKG_LIST=$all_packages + ;; + X-no|X-none) + INTERNAL_DEBUG_OUTPUT=none + DEBUG_PKG_LIST= + ;; + *) + DEBUG_PKG_LIST=$INTERNAL_DEBUG_OUTPUT ;; esac +AC_MSG_RESULT([$INTERNAL_DEBUG_OUTPUT]) -if test -n "$DEBUG_PKG"; then - for pkg in `echo $DEBUG_PKG | ${TR} ${as_cr_letters}"," ${as_cr_LETTERS}" "`; do +## Define H5*_DEBUG symbols that control package output +## NOTE: No sanity checking done here! +if test -n "$DEBUG_PKG_LIST"; then + for pkg in `echo $DEBUG_PKG_LIST | ${TR} ${as_cr_letters}"," ${as_cr_LETTERS}" "`; do H5_CPPFLAGS="$H5_CPPFLAGS -DH5${pkg}_DEBUG" done fi @@ -1897,20 +2157,32 @@ fi AC_MSG_CHECKING([whether function stack tracking is enabled]) AC_ARG_ENABLE([codestack], [AS_HELP_STRING([--enable-codestack], - [Enable the function stack tracing (for developer debugging).])], + [Enable the function stack tracing (for developer debugging). + [default=no] + ])], [CODESTACK=$enableval]) +## Set the default level. +if test "X-$CODESTACK" = X- ; then + CODESTACK=no +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([CODESTACK]) + case "X-$CODESTACK" in X-yes) - CODESTACK=yes AC_MSG_RESULT([yes]) AC_DEFINE([HAVE_CODESTACK], [1], [Define if the function stack tracing code is to be compiled in]) ;; - *) - CODESTACK=no + X-no) AC_MSG_RESULT([no]) ;; + *) + AC_MSG_ERROR([Unrecognized value: $CODESTACK]) + ;; esac ## ---------------------------------------------------------------------- @@ -1919,113 +2191,69 @@ esac AC_MSG_CHECKING([whether metadata trace file code is enabled]) AC_ARG_ENABLE([metadata-trace-file], [AS_HELP_STRING([--enable-metadata-trace-file], - [Enable metadata trace file collection.])], + [Enable metadata trace file collection. + [default=no] + ])], [METADATATRACEFILE=$enableval]) +## Set the default level. +if test "X-$METADATATRACEFILE" = X- ; then + METADATATRACEFILE=no +fi + +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([METADATATRACEFILE]) + case "X-$METADATATRACEFILE" in X-yes) - METADATATRACEFILE=yes AC_MSG_RESULT([yes]) AC_DEFINE([METADATA_TRACE_FILE], [1], [Define if the metadata trace file code is to be compiled in]) ;; - *) - METADATATRACEFILE=no + X-no) AC_MSG_RESULT([no]) ;; + *) + AC_MSG_ERROR([Unrecognized value: $METADATATRACEFILE]) + ;; esac ## ---------------------------------------------------------------------- ## Enable tracing of the API -## This must come after the enable-debug since it depends on debug. ## -AC_SUBST([TRACE_API]) AC_MSG_CHECKING([for API tracing]); AC_ARG_ENABLE([trace], [AS_HELP_STRING([--enable-trace], - [Enable API tracing capability. Default=no - if debug is disabled.])], - [TRACE=$enableval]) - -## Default to no if debug is disabled -if test "X-$TRACE" = X- ; then - if test -z "$DEBUG_PKG" ; then - TRACE=no - else - TRACE=yes - fi -fi + [Enable HDF5 API tracing capability. + [default=yes if debug build, otherwise no] + ])], + [TRACE_API=$enableval]) -case "X-$TRACE" in - X-yes) - AC_MSG_RESULT([yes]) +## Set the default level. +if test "X-$TRACE_API" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then TRACE_API=yes - H5_CPPFLAGS="$H5_CPPFLAGS -DH5_DEBUG_API" - ;; - X-no|*) - AC_MSG_RESULT([no]) - TRACE_API=no - H5_CPPFLAGS="$H5_CPPFLAGS -UH5_DEBUG_API" - ;; -esac - -## ---------------------------------------------------------------------- -## Enable instrumenting of the library's internal operations -## This must come after the enable-debug since it depends on debug. -## -AC_SUBST([INSTRUMENT_LIBRARY]) -AC_MSG_CHECKING([for instrumented library]); -AC_ARG_ENABLE([instrument], - [AS_HELP_STRING([--enable-instrument], - [Enable library instrumentation of optimization - tracing. Default=no if debug is disabled.])], - [INSTRUMENT=$enableval]) - -## Default to no if debug is disabled -if test "X-$INSTRUMENT" = X- ; then - if test -z "$DEBUG_PKG" ; then - INSTRUMENT=no else - INSTRUMENT=yes + TRACE_API=no fi fi -case "X-$INSTRUMENT" in +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([TRACE_API]) + +case "X-$TRACE_API" in X-yes) AC_MSG_RESULT([yes]) - INSTRUMENT_LIBRARY=yes - AC_DEFINE([HAVE_INSTRUMENTED_LIBRARY], [1], - [Define if library will contain instrumentation to detect correct optimization operation]) + H5_CPPFLAGS="$H5_CPPFLAGS -DH5_DEBUG_API" ;; - X-no|*) + X-no) AC_MSG_RESULT([no]) - INSTRUMENT_LIBRARY=no + H5_CPPFLAGS="$H5_CPPFLAGS -UH5_DEBUG_API" ;; -esac - -## ---------------------------------------------------------------------- -## Check if they would like to securely clear file buffers before they are -## written. -## -AC_SUBST([CLEARFILEBUF]) -AC_MSG_CHECKING([whether to clear file buffers]) -AC_ARG_ENABLE([clear-file-buffers], - [AS_HELP_STRING([--enable-clear-file-buffers], - [Securely clear file buffers before writing - to file. Default=yes.])], - [CLEARFILEBUF=$enableval]) - -case "X-$CLEARFILEBUF" in *) - CLEARFILEBUF=yes - AC_MSG_RESULT([yes]) - AC_DEFINE([CLEAR_MEMORY], [1], - [Define if the memory buffers being written to disk should be - cleared before writing.]) - ;; - X-no) - CLEARFILEBUF=no - AC_MSG_RESULT([no]) + AC_MSG_ERROR([Unrecognized value: $TRACE_API]) ;; esac @@ -2035,40 +2263,49 @@ esac ## more scrupulous with it's memory operations. Enabling this also ## disables the library's free space manager code. ## -AC_SUBST([USINGMEMCHECKER]) AC_MSG_CHECKING([whether a memory checking tool will be used]) AC_ARG_ENABLE([using-memchecker], [AS_HELP_STRING([--enable-using-memchecker], [Enable this option if a memory allocation and/or bounds checking tool will be used on the HDF5 library. Enabling this causes the library to be - more picky about it's memory operations and also + more picky about its memory operations and also disables the library's free space manager code. This option is orthogonal to the --enable-memory-alloc-sanity-check option. - Default=no.])], + [default=no] + ])], [USINGMEMCHECKER=$enableval]) +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([USINGMEMCHECKER]) + +## Set the default level. +if test "X-$USINGMEMCHECKER" = X- ; then + USINGMEMCHECKER=no +fi + case "X-$USINGMEMCHECKER" in X-yes) - USINGMEMCHECKER=yes - AC_MSG_RESULT([yes]) AC_DEFINE([USING_MEMCHECKER], [1], [Define if a memory checking tool will be used on the library, to cause library to be very picky about memory operations and also disable the internal free list manager code.]) + AC_MSG_RESULT([yes]) ;; - *) - USINGMEMCHECKER=no + X-no) AC_MSG_RESULT([no]) ;; + *) + AC_MSG_ERROR([Unrecognized value: $USINGMEMCHECKER]) + ;; esac ## ---------------------------------------------------------------------- ## Check if they would like to enable the internal memory allocation sanity ## checking code. ## -AC_SUBST([MEMORYALLOCSANITYCHECK]) AC_MSG_CHECKING([whether internal memory allocation sanity checking is used]) AC_ARG_ENABLE([memory-alloc-sanity-check], [AS_HELP_STRING([--enable-memory-alloc-sanity-check], @@ -2077,20 +2314,35 @@ AC_ARG_ENABLE([memory-alloc-sanity-check], more memory use and somewhat slower allocation. This option is orthogonal to the --enable-using-memchecker option. - Default=no.])], + [default=yes if debug build, otherwise no] + ])], [MEMORYALLOCSANITYCHECK=$enableval]) +## Allow this variable to be substituted in +## other files (src/libhdf5.settings.in, etc.) +AC_SUBST([MEMORYALLOCSANITYCHECK]) + +## Set default +if test "X-$MEMORYALLOCSANITYCHECK" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + MEMORYALLOCSANITYCHECK=yes + else + MEMORYALLOCSANITYCHECK=no + fi +fi + case "X-$MEMORYALLOCSANITYCHECK" in X-yes) - MEMORYALLOCSANITYCHECK=yes - AC_MSG_RESULT([yes]) AC_DEFINE([MEMORY_ALLOC_SANITY_CHECK], [1], [Define to enable internal memory allocation sanity checking.]) + AC_MSG_RESULT([yes]) ;; - *) - MEMORYALLOCSANITYCHECK=no + X-no) AC_MSG_RESULT([no]) ;; + *) + AC_MSG_ERROR([Unrecognized value: $MEMORYALLOCSANITYCHECK]) + ;; esac ## Checkpoint the cache @@ -2161,8 +2413,12 @@ esac ## ---------------------------------------------------------------------- ## Print some other parallel information and do some sanity checks. +## Needs to be done outside of the PARALLEL block since the serial +## build also needs to have values defined. ## AC_SUBST([ADD_PARALLEL_FILES]) ADD_PARALLEL_FILES="no" +AC_SUBST([MPE]) MPE=no +AC_SUBST([INSTRUMENT_LIBRARY]) INSTRUMENT_LIBRARY=no if test -n "$PARALLEL"; then ## The 'testpar' directory should participate in the build @@ -2217,6 +2473,45 @@ if test -n "$PARALLEL"; then ) fi + ## ---------------------------------------------------------------------- + ## Enable instrumenting of the library's internal operations + ## in parallel builds. + ## + + ## Set default + if test "X-$BUILD_MODE" = "X-debug" ; then + INSTRUMENT_LIBRARY=yes + else + INSTRUMENT_LIBRARY=no + fi + + AC_MSG_CHECKING([for instrumented library]); + AC_ARG_ENABLE([instrument], + [AS_HELP_STRING([--enable-instrument], + [Enable library instrumentation of optimization + tracing (only used with parallel builds). + [default=yes if a parallel debug build, otherwise no] + ])], + [INSTRUMENT_LIBRARY=$enableval]) + + ## Allow this variable to be substituted in + ## other files (src/libhdf5.settings.in, etc.) + AC_SUBST([INSTRUMENT_LIBRARY]) + + case "X-$INSTRUMENT_LIBRARY" in + X-yes) + AC_DEFINE([HAVE_INSTRUMENTED_LIBRARY], [1], + [Define if parallel library will contain instrumentation to detect correct optimization operation]) + AC_MSG_RESULT([yes]) + ;; + X-no) + AC_MSG_RESULT([no]) + ;; + *) + AC_MSG_ERROR([Unrecognized value: $INSTRUMENT_LIBRARY]) + ;; + esac + ## -------------------------------------------------------------------- ## Do we want MPE instrumentation feature on? ## @@ -2284,6 +2579,11 @@ fi ## ---------------------------------------------------------------------- ## Check if Direct I/O driver is enabled by --enable-direct-vfd ## +AC_SUBST([DIRECT_VFD]) + +## Default is no direct VFD +DIRECT_VFD=no + AC_CACHE_VAL([hdf5_cv_direct_io], AC_CHECK_DECL([O_DIRECT], [hdf5_cv_direct_io=yes], [hdf5_cv_direct_io=no], [[#include ]])) AC_CACHE_VAL([hdf5_cv_posix_memalign], @@ -2316,6 +2616,7 @@ else AC_MSG_RESULT([no]) fi +## Direct VFD files are not built if not required. AM_CONDITIONAL([DIRECT_VFD_CONDITIONAL], [test "X$DIRECT_VFD" = "Xyes"]) ## ---------------------------------------------------------------------- @@ -2710,7 +3011,7 @@ if test -n "$ORGANIZATION"; then CONFIG_USER="$CONFIG_USER at $ORGANIZATION" fi -## Configuration mode (production, development, profile, etc) saved above. +## Configuration mode (production, debug, etc.) saved above. AC_SUBST([CONFIG_MODE]) ## Byte sex from the AC_C_BIGENDIAN macro. @@ -2826,13 +3127,22 @@ AM_CONDITIONAL([BUILD_ALL_CONDITIONAL], [test "X$BUILD_ALL" = "Xyes"]) ## ---------------------------------------------------------------------- ## Enable deprecated public API symbols ## + +## Enabled unless the build mode is clean. +if test "X-$BUILD_MODE" = "X-clean" ; then + DEPREC_SYMBOLS=no +else + DEPREC_SYMBOLS=yes +fi + AC_SUBST([DEPRECATED_SYMBOLS]) AC_MSG_CHECKING([if deprecated public symbols are available]); AC_ARG_ENABLE([deprecated-symbols], [AS_HELP_STRING([--enable-deprecated-symbols], - [Enable deprecated public API symbols [default=yes]])], - [DEPREC_SYMBOLS=$enableval], - [DEPREC_SYMBOLS=yes]) + [Enable deprecated public API symbols. + [default=yes (unless build mode = clean)] + ])], + [DEPREC_SYMBOLS=$enableval]) case "X-$DEPREC_SYMBOLS" in X-yes) @@ -2891,29 +3201,31 @@ AC_SUBST([STRICT_FORMAT_CHECKS]) AC_MSG_CHECKING([whether to perform strict file format checks]); AC_ARG_ENABLE([strict-format-checks], [AS_HELP_STRING([--enable-strict-format-checks], - [Enable strict file format checks, default=yes if - debug flag is enabled, no otherwise])], - [STRICT_CHECKS=$enableval]) - -## Default to yes if debug is enabled -if test "X-$STRICT_CHECKS" = X- ; then - if test -z "$DEBUG_PKG" ; then - STRICT_CHECKS=no + [Enable strict file format checks. + [default=yes if debug build, otherwise no] + ])], + [STRICT_FORMAT_CHECKS=$enableval]) + +## Set the default level. This depends on the compiler mode. +if test "X-$STRICT_FORMAT_CHECKS" = X- ; then + if test "X-$BUILD_MODE" = "X-debug" ; then + STRICT_FORMAT_CHECKS=yes else - STRICT_CHECKS=yes + STRICT_FORMAT_CHECKS=no fi fi -case "X-$STRICT_CHECKS" in +case "X-$STRICT_FORMAT_CHECKS" in X-yes) AC_MSG_RESULT([yes]) - STRICT_FORMAT_CHECKS=yes AC_DEFINE([STRICT_FORMAT_CHECKS], [1], [Define if strict file format checks are enabled]) ;; - X-no|*) + X-no) AC_MSG_RESULT([no]) - STRICT_FORMAT_CHECKS=no + ;; + *) + AC_MSG_ERROR([Unrecognized value: $STRICT_FORMAT_CHECKS]) ;; esac @@ -3065,6 +3377,11 @@ else enable_static=no fi +## Expose things for *.in markup +AC_SUBST([STATIC_SHARED]) +AC_SUBST([enable_shared]) +AC_SUBST([enable_static]) + if test "X$enable_static" = "Xyes" && test "X$enable_shared" = "Xyes"; then STATIC_SHARED="static, shared" elif test "X$enable_static" = "Xyes"; then diff --git a/fortran/src/H5Sff.F90 b/fortran/src/H5Sff.F90 index aeb3314..fd4226c 100644 --- a/fortran/src/H5Sff.F90 +++ b/fortran/src/H5Sff.F90 @@ -1232,7 +1232,7 @@ CONTAINS ENDIF ! Case of optional parameters. ! - ! Find the rank of the dataspace to allocate memery for + ! Find the rank of the dataspace to allocate memory for ! default stride and block arrays. ! CALL h5sget_simple_extent_ndims_f(space_id, rank, hdferr) @@ -1378,7 +1378,7 @@ CONTAINS ! endif ! Case of optional parameters. ! - ! Find the rank of the dataspace to allocate memery for + ! Find the rank of the dataspace to allocate memory for ! default stride and block arrays. ! ! CALL h5sget_simple_extent_ndims_f(space_id, rank, hdferr) diff --git a/hl/tools/gif2h5/h52giftest.sh.in b/hl/tools/gif2h5/h52giftest.sh.in index 7aec219..90931f2 100644 --- a/hl/tools/gif2h5/h52giftest.sh.in +++ b/hl/tools/gif2h5/h52giftest.sh.in @@ -77,7 +77,7 @@ TOOLTEST ./h52gif $TESTFILE1 image1.gif -i image echo "" # Negative tests. -echo "**verify the the h52gif tool handle error conditions correctly..." +echo "**verify that the h52gif tool handles error conditions correctly..." # nonexisting dataset name TESTING "./h52gif h52giftst.h5 image.gif -i nosuch_image" TOOLTESTFAIL "./h52gif $TESTFILE1 image.gif -i nosuch_image" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0fbd32b..ca71fca 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -868,11 +868,11 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) -option (HDF5_ENABLE_DEBUG_APIS "Turn on debugging in all packages" OFF) +option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) if (HDF5_ENABLE_DEBUG_APIS) set_target_properties (${HDF5_LIB_TARGET} PROPERTIES COMPILE_DEFINITIONS - "H5Z_DEBUG;H5VM_DEBUG;H5T_DEBUG;H5S_DEBUG;H5P_DEBUG;H5O_DEBUG;H5MM_DEBUG;H5MF_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5HG_DEBUG;H5G_DEBUG;H5F_DEBUG;H5E_DEBUG;H5D_DEBUG;H5B_DEBUG;H5AC_DEBUG" + "H5Z_DEBUG;H5T_DEBUG;H5ST_DEBUG;H5S_DEBUG;H5O_DEBUG;H5I_DEBUG;H5HL_DEBUG;H5F_DEBUG;H5D_DEBUG;H5B2_DEBUG;H5B_DEBUG;H5AC_DEBUG" ) endif (HDF5_ENABLE_DEBUG_APIS) set (install_targets ${HDF5_LIB_TARGET}) diff --git a/src/H5.c b/src/H5.c index a522398..4de5731 100644 --- a/src/H5.c +++ b/src/H5.c @@ -552,30 +552,29 @@ done: /*------------------------------------------------------------------------- - * Function: H5_debug_mask + * Function: H5_debug_mask * - * Purpose: Set runtime debugging flags according to the string S. The - * string should contain file numbers and package names - * separated by other characters. A file number applies to all - * following package names up to the next file number. The - * initial file number is `2' (the standard error stream). Each - * package name can be preceded by a `+' or `-' to add or remove - * the package from the debugging list (`+' is the default). The - * special name `all' means all packages. + * Purpose: Set runtime debugging flags according to the string S. The + * string should contain file numbers and package names + * separated by other characters. A file number applies to all + * following package names up to the next file number. The + * initial file number is `2' (the standard error stream). Each + * package name can be preceded by a `+' or `-' to add or remove + * the package from the debugging list (`+' is the default). The + * special name `all' means all packages. * - * The name `trace' indicates that API tracing is to be turned - * on or off. + * The name `trace' indicates that API tracing is to be turned + * on or off. * - * Return: void + * The name 'ttop' indicates that only top-level API calls + * should be shown. This also turns on tracing as if the + * 'trace' word was shown. * - * Programmer: Robb Matzke + * Return: void + * + * Programmer: Robb Matzke * Wednesday, August 19, 1998 * - * Modifications: - * Robb Matzke, 2002-08-08 - * Accepts the `ttop' word. If enabled then show only the - * top level API calls, otherwise show all API calls. Also - * turns on tracing as if the `trace' word was present. *------------------------------------------------------------------------- */ static void @@ -587,55 +586,57 @@ H5_debug_mask(const char *s) hbool_t clear; while (s && *s) { - if (HDisalpha(*s) || '-'==*s || '+'==*s) { - /* Enable or Disable debugging? */ - if ('-'==*s) { - clear = TRUE; - s++; - } else if ('+'==*s) { - clear = FALSE; - s++; - } else { - clear = FALSE; - } - - /* Get the name */ - for (i=0; HDisalpha(*s); i++, s++) - if (i=(size_t)H5_NPKGS) - fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); - } - - } else if (HDisdigit(*s)) { - int fd = (int)HDstrtol(s, &rest, 0); - H5_debug_open_stream_t *open_stream; - - if((stream = HDfdopen(fd, "w")) != NULL) { - (void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0); - - if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) { + } else if (!HDstrcmp(pkg_name, "all")) { + for (i=0; i<(size_t)H5_NPKGS; i++) + H5_debug_g.pkg[i].stream = clear ? NULL : stream; + } else { + for (i=0; i<(size_t)H5_NPKGS; i++) { + if (!HDstrcmp(H5_debug_g.pkg[i].name, pkg_name)) { + H5_debug_g.pkg[i].stream = clear ? NULL : stream; + break; + } /* end if */ + } /* end for */ + if (i>=(size_t)H5_NPKGS) + fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name); + } /* end if-else */ + + } else if (HDisdigit(*s)) { + int fd = (int)HDstrtol(s, &rest, 0); + H5_debug_open_stream_t *open_stream; + + if((stream = HDfdopen(fd, "w")) != NULL) { + (void)HDsetvbuf(stream, NULL, _IOLBF, (size_t)0); + + if(NULL == (open_stream = (H5_debug_open_stream_t *)H5MM_malloc(sizeof(H5_debug_open_stream_t)))) { (void)HDfclose(stream); return; } /* end if */ @@ -644,11 +645,15 @@ H5_debug_mask(const char *s) open_stream->next = H5_debug_g.open_stream; H5_debug_g.open_stream = open_stream; } /* end if */ - s = rest; - } else { - s++; - } - } + + s = rest; + } else { + s++; + } /* end if-else */ + } /* end while */ + + return; + } /* end H5_debug_mask() */ #ifdef H5_HAVE_PARALLEL diff --git a/src/H5B.c b/src/H5B.c index 3b34c4d..9182d25 100644 --- a/src/H5B.c +++ b/src/H5B.c @@ -1734,14 +1734,13 @@ H5B_shared_new(const H5F_t *f, const H5B_class_t *type, size_t sizeof_rkey) (shared->two_k + 1) * shared->sizeof_rkey); /*keys */ HDassert(shared->sizeof_rnode); - /* Allocate shared buffers */ + /* Allocate and clear shared buffers */ if(NULL == (shared->page = H5FL_BLK_MALLOC(page, shared->sizeof_rnode))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page") -#ifdef H5_CLEAR_MEMORY -HDmemset(shared->page, 0, shared->sizeof_rnode); -#endif /* H5_CLEAR_MEMORY */ + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree page") + HDmemset(shared->page, 0, shared->sizeof_rnode); + if(NULL == (shared->nkey = H5FL_SEQ_MALLOC(size_t, (size_t)(shared->two_k + 1)))) - HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys") + HGOTO_ERROR(H5E_BTREE, H5E_CANTALLOC, NULL, "memory allocation failed for B-tree native keys") /* Initialize the offsets into the native key buffer */ for(u = 0; u < (shared->two_k + 1); u++) diff --git a/src/H5B2cache.c b/src/H5B2cache.c index 2c40761..928a7ee 100644 --- a/src/H5B2cache.c +++ b/src/H5B2cache.c @@ -890,10 +890,8 @@ H5B2__cache_int_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED le /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of internal node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) @@ -1300,10 +1298,8 @@ H5B2__cache_leaf_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED l /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of leaf node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5B2hdr.c b/src/H5B2hdr.c index 0676f30..578eeb9 100644 --- a/src/H5B2hdr.c +++ b/src/H5B2hdr.c @@ -153,9 +153,7 @@ H5B2__hdr_init(H5B2_hdr_t *hdr, const H5B2_create_t *cparam, void *ctx_udata, /* Allocate "page" for node I/O */ if(NULL == (hdr->page = H5FL_BLK_MALLOC(node_page, hdr->node_size))) HGOTO_ERROR(H5E_BTREE, H5E_NOSPACE, FAIL, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(hdr->page, 0, hdr->node_size); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(hdr->page, 0, hdr->node_size); /* Allocate array of node info structs */ if(NULL == (hdr->node_info = H5FL_SEQ_MALLOC(H5B2_node_info_t, (size_t)(hdr->depth + 1)))) diff --git a/src/H5B2int.c b/src/H5B2int.c index a9c9ecc..aefb189 100644 --- a/src/H5B2int.c +++ b/src/H5B2int.c @@ -2962,17 +2962,15 @@ H5B2__create_leaf(H5B2_hdr_t *hdr, hid_t dxpl_id, void *parent, H5B2_node_ptr_t /* Increment ref. count on B-tree header */ if(H5B2__hdr_incr(hdr) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINC, FAIL, "can't increment ref. count on B-tree header") /* Share B-tree header information */ leaf->hdr = hdr; /* Allocate space for the native keys in memory */ if(NULL == (leaf->leaf_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[0].nat_rec_fac))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys") -#ifdef H5_CLEAR_MEMORY -HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec); -#endif /* H5_CLEAR_MEMORY */ + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree leaf native keys") + HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec); /* Set number of records */ leaf->nrec = 0; @@ -2986,15 +2984,15 @@ HDmemset(leaf->leaf_native, 0, hdr->cls->nrec_size * hdr->node_info[0].max_nrec) /* Allocate space on disk for the leaf */ if(HADDR_UNDEF == (node_ptr->addr = H5MF_alloc(hdr->f, H5FD_MEM_BTREE, dxpl_id, (hsize_t)hdr->node_size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "file allocation failed for B-tree leaf node") /* Cache the new B-tree node */ if(H5AC_insert_entry(hdr->f, dxpl_id, H5AC_BT2_LEAF, node_ptr->addr, leaf, H5AC__NO_FLAGS_SET) < 0) - HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache") + HGOTO_ERROR(H5E_BTREE, H5E_CANTINIT, FAIL, "can't add B-tree leaf to cache") done: if(ret_value < 0) { - if(leaf) + if(leaf) if(H5B2__leaf_free(leaf) < 0) HDONE_ERROR(H5E_BTREE, H5E_CANTFREE, FAIL, "unable to release v2 B-tree leaf node") } /* end if */ @@ -3092,16 +3090,12 @@ H5B2__create_internal(H5B2_hdr_t *hdr, hid_t dxpl_id, void *parent, /* Allocate space for the native keys in memory */ if(NULL == (internal->int_native = (uint8_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].nat_rec_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal native keys") -#ifdef H5_CLEAR_MEMORY -HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(internal->int_native, 0, hdr->cls->nrec_size * hdr->node_info[depth].max_nrec); /* Allocate space for the node pointers in memory */ if(NULL == (internal->node_ptrs = (H5B2_node_ptr_t *)H5FL_FAC_MALLOC(hdr->node_info[depth].node_ptr_fac))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for B-tree internal node pointers") -#ifdef H5_CLEAR_MEMORY -HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1)); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(internal->node_ptrs, 0, sizeof(H5B2_node_ptr_t) * (hdr->node_info[depth].max_nrec + 1)); /* Set number of records & depth of the node */ internal->nrec = 0; diff --git a/src/H5Bcache.c b/src/H5Bcache.c index 73136b4..2036257 100644 --- a/src/H5Bcache.c +++ b/src/H5Bcache.c @@ -353,10 +353,8 @@ H5B__serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNUSED len, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Dcontig.c b/src/H5Dcontig.c index 6276af1..dfa18fb 100644 --- a/src/H5Dcontig.c +++ b/src/H5Dcontig.c @@ -1027,10 +1027,9 @@ H5D__contig_writevv_sieve_cb(hsize_t dst_off, hsize_t src_off, size_t len, if(NULL == (dset_contig->sieve_buf = H5FL_BLK_CALLOC(sieve_buf, dset_contig->sieve_buf_size))) HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -if(dset_contig->sieve_size > len) - HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len)); -#endif /* H5_CLEAR_MEMORY */ + /* Clear memory */ + if(dset_contig->sieve_size > len) + HDmemset(dset_contig->sieve_buf + len, 0, (dset_contig->sieve_size - len)); /* Determine the new sieve buffer size & location */ dset_contig->sieve_loc = addr; diff --git a/src/H5FDcore.c b/src/H5FDcore.c index f4aa240..778baa0 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -1295,9 +1295,7 @@ H5FD__core_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UN HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate memory block of %llu bytes", (unsigned long long)new_eof) } /* end else */ -#ifdef H5_CLEAR_MEMORY HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); -#endif /* H5_CLEAR_MEMORY */ file->mem = x; file->eof = new_eof; @@ -1469,10 +1467,8 @@ H5FD__core_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing HGOTO_ERROR(H5E_FILE, H5E_CANTALLOC, FAIL, "unable to allocate memory block") } /* end else */ -#ifdef H5_CLEAR_MEMORY if(file->eof < new_eof) HDmemset(x + file->eof, 0, (size_t)(new_eof - file->eof)); -#endif /* H5_CLEAR_MEMORY */ file->mem = x; /* Update backing store, if using it and if closing */ diff --git a/src/H5Faccum.c b/src/H5Faccum.c index d8cd614..ef7c827 100644 --- a/src/H5Faccum.c +++ b/src/H5Faccum.c @@ -164,9 +164,9 @@ H5F__accum_read(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr, /* Note the new buffer size */ accum->alloc_size = new_alloc_size; -#ifdef H5_CLEAR_MEMORY - HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size)); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - accum->size)); } /* end if */ /* Read the part before the metadata accumulator */ @@ -395,9 +395,9 @@ H5F__accum_adjust(H5F_meta_accum_t *accum, const H5F_io_info_t *fio_info, /* Update accumulator info */ accum->buf = new_buf; accum->alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size))); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + accum->size, 0, (accum->alloc_size - (accum->size + size))); } /* end if */ } /* end if */ @@ -628,9 +628,9 @@ H5F__accum_write(const H5F_io_info_t *fio_info, H5FD_mem_t type, haddr_t addr, /* Note the new buffer size */ accum->alloc_size = new_alloc_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); } /* end if */ /* Copy the new metadata to the buffer */ @@ -661,6 +661,7 @@ HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); /* Check if we need to resize the buffer */ if(size > accum->alloc_size) { size_t new_size; /* New size of accumulator */ + size_t clear_size; /* Size of memory that needs clearing */ /* Adjust the buffer size to be a power of 2 that is large enough to hold data */ new_size = (size_t)1 << (1 + H5VM_log2_gen((uint64_t)(size - 1))); @@ -671,12 +672,10 @@ HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); /* Note the new buffer size */ accum->alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -{ -size_t clear_size = MAX(accum->size, size); -HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); -} -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + clear_size = MAX(accum->size, size); + HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); } /* end if */ else { /* Check if we should shrink the accumulator buffer */ @@ -721,9 +720,9 @@ HDmemset(accum->buf + clear_size, 0, (accum->alloc_size - clear_size)); /* Note the new buffer size */ accum->alloc_size = new_size; -#ifdef H5_CLEAR_MEMORY -HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); -#endif /* H5_CLEAR_MEMORY */ + + /* Clear the memory */ + HDmemset(accum->buf + size, 0, (accum->alloc_size - size)); } /* end if */ /* Update the metadata accumulator information */ diff --git a/src/H5Gcache.c b/src/H5Gcache.c index a4f9530..ed1c4a3 100644 --- a/src/H5Gcache.c +++ b/src/H5Gcache.c @@ -328,10 +328,8 @@ H5G__cache_node_serialize(const H5F_t *f, void *_image, size_t len, if(H5G__ent_encode_vec(f, &image, sym->entry, sym->nsyms) < 0) HGOTO_ERROR(H5E_SYM, H5E_CANTENCODE, FAIL, "can't serialize") -#ifdef H5_CLEAR_MEMORY /* Clear rest of symbol table node */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5Gprivate.h b/src/H5Gprivate.h index 1ab5522..2ef99fd 100644 --- a/src/H5Gprivate.h +++ b/src/H5Gprivate.h @@ -37,13 +37,6 @@ #include "H5RSprivate.h" /* Reference-counted strings */ /* - * Define this to enable debugging. - */ -#ifdef NDEBUG -# undef H5G_DEBUG -#endif - -/* * The disk size for a symbol table entry... */ #define H5G_SIZEOF_SCRATCH 16 diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 73db840..1272ab0 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -146,9 +146,7 @@ H5HF_man_dblock_create(hid_t dxpl_id, H5HF_hdr_t *hdr, H5HF_indirect_t *par_iblo /* XXX: Change to using free-list factories */ if((dblock->blk = H5FL_BLK_MALLOC(direct_block, dblock->size)) == NULL) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(dblock->blk, 0, dblock->size); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(dblock->blk, 0, dblock->size); dblock->write_buf = NULL; dblock->write_size = 0; diff --git a/src/H5HFtiny.c b/src/H5HFtiny.c index bdfe30d..711ceb9 100644 --- a/src/H5HFtiny.c +++ b/src/H5HFtiny.c @@ -177,10 +177,9 @@ HDfprintf(stderr, "%s: obj_size = %Zu\n", FUNC, obj_size); ((enc_obj_size & H5HF_TINY_MASK_EXT_1) >> 8)); *id++ = enc_obj_size & H5HF_TINY_MASK_EXT_2; } /* end else */ + HDmemcpy(id, obj, obj_size); -#ifdef H5_CLEAR_MEMORY -HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(id + obj_size, 0, (hdr->id_len - ((size_t)1 + (size_t)hdr->tiny_len_extended + obj_size))); /* Update statistics about heap */ hdr->tiny_size += obj_size; diff --git a/src/H5HG.c b/src/H5HG.c index 41c5007..f95b607 100644 --- a/src/H5HG.c +++ b/src/H5HG.c @@ -154,22 +154,20 @@ H5HG_create(H5F_t *f, hid_t dxpl_id, size_t size) /* Create it */ H5_CHECK_OVERFLOW(size, size_t, hsize_t); if(HADDR_UNDEF == (addr = H5MF_alloc(f, H5FD_MEM_GHEAP, dxpl_id, (hsize_t)size))) - HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap") + HGOTO_ERROR(H5E_HEAP, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate file space for global heap") if(NULL == (heap = H5FL_MALLOC(H5HG_heap_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") heap->addr = addr; heap->size = size; heap->shared = H5F_SHARED(f); if(NULL == (heap->chunk = H5FL_BLK_MALLOC(gheap_chunk, size))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(heap->chunk, 0, size); -#endif /* H5_CLEAR_MEMORY */ + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HDmemset(heap->chunk, 0, size); heap->nalloc = H5HG_NOBJS(f, size); heap->nused = 1; /* account for index 0, which is used for the free object */ if(NULL == (heap->obj = H5FL_SEQ_MALLOC(H5HG_obj_t, heap->nalloc))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") + HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, HADDR_UNDEF, "memory allocation failed") /* Initialize the header */ HDmemcpy(heap->chunk, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC); @@ -452,9 +450,7 @@ H5HG_extend(H5F_t *f, hid_t dxpl_id, haddr_t addr, size_t need) /* Re-allocate the heap information in memory */ if(NULL == (new_chunk = H5FL_BLK_REALLOC(gheap_chunk, heap->chunk, (heap->size + need)))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "new heap allocation failed") -#ifdef H5_CLEAR_MEMORY -HDmemset(new_chunk + heap->size, 0, need); -#endif /* H5_CLEAR_MEMORY */ + HDmemset(new_chunk + heap->size, 0, need); /* Adjust the size of the heap */ old_size = heap->size; diff --git a/src/H5HLcache.c b/src/H5HLcache.c index 678da7f..d0dde89 100644 --- a/src/H5HLcache.c +++ b/src/H5HLcache.c @@ -630,10 +630,8 @@ H5HL__cache_prefix_serialize(const H5F_t *f, void *_image, size_t len, /* Sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= len); -#ifdef H5_CLEAR_MEMORY /* Clear rest of local heap */ HDmemset(image, 0, len - (size_t)(image - (uint8_t *)_image)); -#endif /* H5_CLEAR_MEMORY */ } /* end else */ FUNC_LEAVE_NOAPI(SUCCEED) diff --git a/src/H5MFprivate.h b/src/H5MFprivate.h index bb07f4e..22ed308 100644 --- a/src/H5MFprivate.h +++ b/src/H5MFprivate.h @@ -21,8 +21,6 @@ * * Purpose: Private header file for file memory management. * - * Modifications: - * *------------------------------------------------------------------------- */ #ifndef _H5MFprivate_H @@ -36,13 +34,6 @@ /* Library Private Macros */ /**************************/ -/* - * Feature: Define H5MF_DEBUG on the compiler command line if you want to - * see diagnostics from this layer. - */ -#ifdef NDEBUG -# undef H5MF_DEBUG -#endif /****************************/ /* Library Private Typedefs */ diff --git a/src/H5Pdcpl.c b/src/H5Pdcpl.c index 03a4668..44872ba 100644 --- a/src/H5Pdcpl.c +++ b/src/H5Pdcpl.c @@ -2517,8 +2517,8 @@ done: * * If the length of the filename, which determines the * required value of size, is unknown, a preliminary call to - * H5Pget_virtual_filename with the last two parameters set - * to NULL can be made. The return value of this call will + * H5Pget_virtual_filename with 'name' set to NULL and 'size' + * set to zero can be made. The return value of this call will * be the size in bytes of the filename. That value, plus 1 * for a NULL terminator, is then assigned to size for a * second H5Pget_virtual_filename call, which will retrieve @@ -2578,14 +2578,14 @@ done: * additional characters, if any, are not returned to the * user application. * - * If the length of the filename, which determines the + * If the length of the dataset name, which determines the * required value of size, is unknown, a preliminary call to - * H5Pget_virtual_dsetname with the last two parameters set - * to NULL can be made. The return value of this call will - * be the size in bytes of the filename. That value, plus 1 + * H5Pget_virtual_dsetname with 'name' set to NULL and 'size' + * set to zero can be made. The return value of this call will + * be the size in bytes of the dataset name. That value, plus 1 * for a NULL terminator, is then assigned to size for a * second H5Pget_virtual_dsetname call, which will retrieve - * the actual filename. + * the actual dataset name. * * Return: Returns the length of the name if successful, otherwise * returns a negative value. diff --git a/src/H5SMcache.c b/src/H5SMcache.c index 7b94743..ff2b09f 100644 --- a/src/H5SMcache.c +++ b/src/H5SMcache.c @@ -769,9 +769,8 @@ H5SM__cache_list_serialize(const H5F_t *f, void *_image, size_t len, /* sanity check */ HDassert((size_t)(image - (uint8_t *)_image) <= list->header->list_size); -#ifdef H5_CLEAR_MEMORY + /* Clear memory */ HDmemset(image, 0, (list->header->list_size - (size_t)(image - (uint8_t *)_image))); -#endif /* H5_CLEAR_MEMORY */ done: FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5STprivate.h b/src/H5STprivate.h index 892f04a..9b49b07 100644 --- a/src/H5STprivate.h +++ b/src/H5STprivate.h @@ -58,7 +58,9 @@ H5_DLL H5ST_ptr_t H5ST_findfirst(H5ST_tree_t *p); H5_DLL H5ST_ptr_t H5ST_findnext(H5ST_ptr_t p); H5_DLL void *H5ST_remove(H5ST_tree_t *root, const char *s); H5_DLL herr_t H5ST_delete(H5ST_tree_t *root, H5ST_ptr_t p); -H5_DLL herr_t H5ST_dump(H5ST_ptr_t p); +#ifdef H5ST_DEBUG +H5_DLL herr_t H5ST_dump(H5ST_tree_t *tree); +#endif /* H5ST_DEBUG */ #endif /* _H5STprivate_H */ diff --git a/src/H5Zscaleoffset.c b/src/H5Zscaleoffset.c index 0dc12a3..14ca9db 100644 --- a/src/H5Zscaleoffset.c +++ b/src/H5Zscaleoffset.c @@ -883,10 +883,8 @@ H5Z_set_local_scaleoffset(hid_t dcpl_id, hid_t type_id, hid_t space_id) if(NULL == (type = (H5T_t *)H5I_object_verify(type_id, H5I_DATATYPE))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a datatype") -#ifdef H5_CLEAR_MEMORY /* Initialize the parameters to a known state */ HDmemset(cd_values, 0, sizeof(cd_values)); -#endif /* H5_CLEAR_MEMORY */ /* Get the filter's current parameters */ if(H5P_get_filter_by_id(dcpl_plist, H5Z_FILTER_SCALEOFFSET, &flags, &cd_nelmts, cd_values, (size_t)0, NULL, NULL) < 0) @@ -1266,13 +1264,11 @@ H5Z_filter_scaleoffset(unsigned flags, size_t cd_nelmts, const unsigned cd_value for(i = 0; i < sizeof(unsigned long long); i++) ((unsigned char *)outbuf)[5+i] = (unsigned char)((minval & ((unsigned long long)0xff << i*8)) >> i*8); -#ifdef H5_CLEAR_MEMORY /* Zero out remaining, unused bytes */ /* (Looks like an error in the original determination of how many * bytes would be needed for parameters. - QAK, 2010/08/19) */ HDmemset(outbuf + 13, 0, (size_t)8); -#endif /* H5_CLEAR_MEMORY */ /* special case: minbits equal to full precision */ if(minbits == p.size * 8) { diff --git a/src/libhdf5.settings.in b/src/libhdf5.settings.in index 90224c1..3bb2936 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -3,40 +3,47 @@ General Information: ------------------- - HDF5 Version: @H5_VERSION@ - Configured on: @CONFIG_DATE@ - Configured by: @CONFIG_USER@ - Configure mode: @CONFIG_MODE@ - Host system: @host_cpu@-@host_vendor@-@host_os@ - Uname information: @UNAME_INFO@ - Byte sex: @BYTESEX@ - Libraries: @STATIC_SHARED@ - Installation point: @prefix@ + HDF5 Version: @H5_VERSION@ + Configured on: @CONFIG_DATE@ + Configured by: @CONFIG_USER@ + Host system: @host_cpu@-@host_vendor@-@host_os@ + Uname information: @UNAME_INFO@ + Byte sex: @BYTESEX@ + Installation point: @prefix@ Compiling Options: ------------------ - Compilation Mode: @CONFIG_MODE@ - C Compiler: @CC_VERSION@ - CFLAGS: @CFLAGS@ - H5_CFLAGS: @H5_CFLAGS@ - AM_CFLAGS: @AM_CFLAGS@ - CPPFLAGS: @CPPFLAGS@ - H5_CPPFLAGS: @H5_CPPFLAGS@ - AM_CPPFLAGS: @AM_CPPFLAGS@ - Shared C Library: @enable_shared@ - Static C Library: @enable_static@ + Build Mode: @BUILD_MODE@ + Debugging Symbols: @SYMBOLS@ + Asserts: @ASSERTS@ + Profiling: @PROFILING@ + Optimization Level: @OPTIMIZATION@ + +Linking Options: +---------------- + Libraries: @STATIC_SHARED@ Statically Linked Executables: @LT_STATIC_EXEC@ LDFLAGS: @LDFLAGS@ H5_LDFLAGS: @H5_LDFLAGS@ AM_LDFLAGS: @AM_LDFLAGS@ - Extra libraries: @LIBS@ - Archiver: @AR@ - Ranlib: @RANLIB@ - Debugged Packages: @DEBUG_PKG@ - API Tracing: @TRACE_API@ + Extra libraries: @LIBS@ + Archiver: @AR@ + Ranlib: @RANLIB@ Languages: ---------- + C: yes + C Compiler: @CC_VERSION@ + CPPFLAGS: @CPPFLAGS@ + H5_CPPFLAGS: @H5_CPPFLAGS@ + AM_CPPFLAGS: @AM_CPPFLAGS@ + C Flags: @CFLAGS@ + H5 C Flags: @H5_CFLAGS@ + AM C Flags: @AM_CFLAGS@ + Shared C Library: @enable_shared@ + Static C Library: @enable_static@ + + Fortran: @HDF_FORTRAN@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Compiler: @FC_VERSION@ @BUILD_FORTRAN_CONDITIONAL_TRUE@ Fortran Flags: @FCFLAGS@ @@ -56,17 +63,19 @@ Languages: Features: --------- Parallel HDF5: @PARALLEL@ - High Level library: @HDF5_HL@ + High-level library: @HDF5_HL@ Threadsafety: @THREADSAFE@ - Default API Mapping: @DEFAULT_API_VERSION@ - With Deprecated Public Symbols: @DEPRECATED_SYMBOLS@ + Default API mapping: @DEFAULT_API_VERSION@ + With deprecated public symbols: @DEPRECATED_SYMBOLS@ I/O filters (external): @EXTERNAL_FILTERS@ MPE: @MPE@ Direct VFD: @DIRECT_VFD@ dmalloc: @HAVE_DMALLOC@ -Clear file buffers before write: @CLEARFILEBUF@ + Packages w/ extra debug output: @INTERNAL_DEBUG_OUTPUT@ + API tracing: @TRACE_API@ Using memory checker: @USINGMEMCHECKER@ Memory allocation sanity checks: @MEMORYALLOCSANITYCHECK@ - Function Stack Tracing: @CODESTACK@ - Strict File Format Checks: @STRICT_FORMAT_CHECKS@ - Optimization Instrumentation: @INSTRUMENT@ + Metadata trace file: @METADATATRACEFILE@ + Function stack tracing: @CODESTACK@ + Strict file format checks: @STRICT_FORMAT_CHECKS@ + Optimization instrumentation: @INSTRUMENT_LIBRARY@ diff --git a/test/objcopy.c b/test/objcopy.c index 241f30b..7ee6196 100644 --- a/test/objcopy.c +++ b/test/objcopy.c @@ -2390,9 +2390,7 @@ test_copy_dataset_compound(hid_t fcpl_src, hid_t fcpl_dst, hid_t src_fapl, hid_t TESTING("H5Ocopy(): compound dataset"); -#ifdef H5_CLEAR_MEMORY HDmemset(buf, 0, sizeof(buf)); -#endif /* H5_CLEAR_MEMORY */ for(i = 0; i < DIM_SIZE_1; i++) { buf[i].a = i; buf[i].d = (double)1.0F / (double)(i + 1); -- cgit v0.12