From 1c207c035f284c6264446d204b886df6ab4ad88d Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 6 Jan 2020 07:30:02 -0600 Subject: Do not exit on DT chkmanifest --- bin/bbrelease | 176 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 88 insertions(+), 88 deletions(-) diff --git a/bin/bbrelease b/bin/bbrelease index 395b23c..ef1e373 100755 --- a/bin/bbrelease +++ b/bin/bbrelease @@ -33,9 +33,9 @@ # Added the md5 method. # # Larry Knox, 2016-08-30 -# Added the --revision option to create private releases with the +# Added the --revision option to create private releases with the # code revision hash in the version strings. Currently the version -# of this script with the --revision option is named bbrelease. It +# of this script with the --revision option is named bbrelease. It # can probably be merged into the original release script in the # future. # Commands to get the revision hash have now been converted to git @@ -48,25 +48,25 @@ USAGE() { cat << EOF Usage: $0 -d [--docver BRANCHNAME] [-h] [--nocheck] [--private] ... - -d DIR The name of the directory where the releas(es) should be + -d DIR The name of the directory where the releas(es) should be placed. --docver BRANCHNAME This is added for 1.8 and beyond to get the correct version of documentation files from the hdf5docs repository. BRANCHNAME for v1.8 should be hdf5_1_8. -h print the help page. - --nocheck Ignore errors in MANIFEST file. - --private Make a private release with today's date in version information. - --revision Make a private release with the code revision number in version information. - + --nocheck Ignore errors in MANIFEST file. + --private Make a private release with today's date in version information. + --revision Make a private release with the code revision number in version information. + This must be run at the top level of the source directory. The other command-line options are the names of the programs to use for compressing the resulting tar archive (if none are given then "tar" is assumed): - tar -- use tar and don't do any compressing. - gzip -- use gzip with "-9" and append ".gz" to the output name. + tar -- use tar and don't do any compressing. + gzip -- use gzip with "-9" and append ".gz" to the output name. bzip2 -- use bzip2 with "-9" and append ".bz2" to the output name. - zip -- convert all text files to DOS style and form a zip file for Windows use. + zip -- convert all text files to DOS style and form a zip file for Windows use. doc -- produce the latest doc tree in addition to the archive. An md5 checksum is produced for each archive created and stored in the md5 file. @@ -119,8 +119,8 @@ EOF tar2zip() { if [ $# -ne 3 ]; then - echo "usage: tar2zip " - return 1 + echo "usage: tar2zip " + return 1 fi ztmpdir=/tmp/tmpdir$$ mkdir -p $ztmpdir @@ -132,23 +132,23 @@ tar2zip() (cd $ztmpdir; tar xf -) < $tarfile # sanity check if [ ! -d $ztmpdir/$version ]; then - echo "untar did not create $ztmpdir/$version source dir" - # cleanup - rm -rf $ztmpdir - return 1 + echo "untar did not create $ztmpdir/$version source dir" + # cleanup + rm -rf $ztmpdir + return 1 fi # step 2: convert text files # There maybe a simpler way to do this. # options used in unix2dos: - # -k Keep the date stamp + # -k Keep the date stamp # -q quiet mode # grep redirect output to /dev/null because -q or -s are not portable. find $ztmpdir/$version | \ - while read inf; do \ - if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \ - unix2dos -q -k $inf; \ - fi\ - done + while read inf; do \ + if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \ + unix2dos -q -k $inf; \ + fi\ + done # step 3: make zipball # -9 maximum compression # -y Store symbolic links as such in the zip archive @@ -167,9 +167,9 @@ tar2zip() # testing with source that is not for release, there is not a file named # "configure" but there will be one named "configure.ac". The "configure" # file will be created when autogen.sh runs. There probably will always -# be a bin/release file, but just in case it is removed, we can check for +# be a bin/release file, but just in case it is removed, we can check for # this script, bbrelease, in the bin directory. The bin/release script should -# continue to check for "configure" because it should be present in release +# continue to check for "configure" because it should be present in release # source. if [ ! \( -f configure.ac -a -f bin/bbrelease \) ]; then echo "$0 must be run at the top level of the hdf5 source directory" @@ -187,7 +187,7 @@ release_date=`date +%F` today=`date +%Y%m%d` pmode='no' revmode='no' -tmpdir="../#release_tmp.$$" # tmp work directory +tmpdir="../#release_tmp.$$" # tmp work directory DOC_URL=https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5doc.git CPPLUS_RM_NAME=cpplus_RM @@ -195,11 +195,11 @@ CPPLUS_RM_NAME=cpplus_RM RESTORE_VERSION() { if [ X-${VERS_OLD} != X- ]; then - echo restoring version information back to $VERS_OLD - rm -f config/lt_vers.am - cp $tmpdir/lt_vers.am config/lt_vers.am - bin/h5vers -s $VERS_OLD - VERS_OLD= + echo restoring version information back to $VERS_OLD + rm -f config/lt_vers.am + cp $tmpdir/lt_vers.am config/lt_vers.am + bin/h5vers -s $VERS_OLD + VERS_OLD= fi } @@ -209,20 +209,20 @@ while [ -n "$1" ]; do arg=$1 shift case "$arg" in - -d) - DEST=$1 - shift - ;; - --nocheck) - check=no - ;; - -h) - USAGE - exit 0 - ;; - --private) - pmode=yes - ;; + -d) + DEST=$1 + shift + ;; + --nocheck) + check=no + ;; + -h) + USAGE + exit 0 + ;; + --private) + pmode=yes + ;; --revision) revmode=yes ;; @@ -230,14 +230,14 @@ while [ -n "$1" ]; do DOCVERSION=$1 shift ;; - -*) - echo "Unknown switch: $arg" 1>&2 - USAGE - exit 1 - ;; - *) - methods="$methods $arg" - ;; + -*) + echo "Unknown switch: $arg" 1>&2 + USAGE + exit 1 + ;; + *) + methods="$methods $arg" + ;; esac done @@ -300,12 +300,12 @@ if [ ! -d $DEST ]; then fi # Check the validity of the MANIFEST file. -bin/chkmanifest || fail=yes +bin/chkmanifest || fail=no if [ "X$fail" = "Xyes" ]; then if [ $check = yes ]; then exit 1 else - echo "Continuing anyway..." + echo "Continuing anyway..." fi fi @@ -340,7 +340,7 @@ test "$verbose" && echo " Running tar..." 1>&2 ( \ cd $tmpdir; \ tar cf $HDF5_VERS.tar $HDF5_IN_VERS/Makefile \ - `sed 's/^\.\//'$HDF5_IN_VERS'\//' $MANIFEST` || exit 1 \ + `sed 's/^\.\//'$HDF5_IN_VERS'\//' $MANIFEST` || exit 1 \ ) # Compress @@ -348,46 +348,46 @@ MD5file=$HDF5_VERS.md5 cp /dev/null $DEST/$MD5file for comp in $methods; do case $comp in - tar) - cp -p $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.tar - (cd $DEST; md5sum $HDF5_VERS.tar >> $MD5file) - ;; - gzip) - test "$verbose" && echo " Running gzip..." 1>&2 - gzip -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz - (cd $DEST; md5sum $HDF5_VERS.tar.gz >> $MD5file) - ;; - bzip2) - test "$verbose" && echo " Running bzip2..." 1>&2 - bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2 - (cd $DEST; md5sum $HDF5_VERS.tar.bz2 >> $MD5file) - ;; - zip) - test "$verbose" && echo " Creating zip ball..." 1>&2 - tar2zip $HDF5_IN_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2 - (cd $DEST; md5sum $HDF5_VERS.zip >> $MD5file) - ;; - doc) + tar) + cp -p $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.tar + (cd $DEST; md5sum $HDF5_VERS.tar >> $MD5file) + ;; + gzip) + test "$verbose" && echo " Running gzip..." 1>&2 + gzip -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz + (cd $DEST; md5sum $HDF5_VERS.tar.gz >> $MD5file) + ;; + bzip2) + test "$verbose" && echo " Running bzip2..." 1>&2 + bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2 + (cd $DEST; md5sum $HDF5_VERS.tar.bz2 >> $MD5file) + ;; + zip) + test "$verbose" && echo " Creating zip ball..." 1>&2 + tar2zip $HDF5_IN_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2 + (cd $DEST; md5sum $HDF5_VERS.zip >> $MD5file) + ;; + doc) if [ "${DOCVERSION}" = "" ]; then DOCVERSION=master fi - test "$verbose" && echo " Creating docs..." 1>&2 - # Check out docs from git repo - (cd $tmpdir; git clone $DOC_URL > /dev/null) || exit 1 - # Create doxygen C++ RM - (cd c++/src && doxygen cpp_doc_config > /dev/null ) || exit 1 - # Replace version of C++ RM with just-created version + test "$verbose" && echo " Creating docs..." 1>&2 + # Check out docs from git repo + (cd $tmpdir; git clone $DOC_URL > /dev/null) || exit 1 + # Create doxygen C++ RM + (cd c++/src && doxygen cpp_doc_config > /dev/null ) || exit 1 + # Replace version of C++ RM with just-created version rm -rf $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME mv c++/src/$CPPLUS_RM_NAME $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME # Compress the docs and move them to the release area mv $tmpdir/$DOCVERSION $tmpdir/${HDF5_VERS}_docs - (cd $tmpdir && tar cf ${HDF5_VERS}_docs.tar ${HDF5_VERS}_docs) - mv $tmpdir/${HDF5_VERS}_docs.tar $DEST - ;; - *) - echo "***Error*** Unknown method $comp" - exit 1 - ;; + (cd $tmpdir && tar cf ${HDF5_VERS}_docs.tar ${HDF5_VERS}_docs) + mv $tmpdir/${HDF5_VERS}_docs.tar $DEST + ;; + *) + echo "***Error*** Unknown method $comp" + exit 1 + ;; esac done -- cgit v0.12 From fb2a31ee5839305521c7374096c1715c94cf31ce Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Mon, 6 Jan 2020 07:45:04 -0600 Subject: restore and use --nocheck option --- bin/bbrelease | 176 +++++++++++++++++++++++++++++----------------------------- 1 file changed, 88 insertions(+), 88 deletions(-) diff --git a/bin/bbrelease b/bin/bbrelease index ef1e373..395b23c 100755 --- a/bin/bbrelease +++ b/bin/bbrelease @@ -33,9 +33,9 @@ # Added the md5 method. # # Larry Knox, 2016-08-30 -# Added the --revision option to create private releases with the +# Added the --revision option to create private releases with the # code revision hash in the version strings. Currently the version -# of this script with the --revision option is named bbrelease. It +# of this script with the --revision option is named bbrelease. It # can probably be merged into the original release script in the # future. # Commands to get the revision hash have now been converted to git @@ -48,25 +48,25 @@ USAGE() { cat << EOF Usage: $0 -d [--docver BRANCHNAME] [-h] [--nocheck] [--private] ... - -d DIR The name of the directory where the releas(es) should be + -d DIR The name of the directory where the releas(es) should be placed. --docver BRANCHNAME This is added for 1.8 and beyond to get the correct version of documentation files from the hdf5docs repository. BRANCHNAME for v1.8 should be hdf5_1_8. -h print the help page. - --nocheck Ignore errors in MANIFEST file. - --private Make a private release with today's date in version information. - --revision Make a private release with the code revision number in version information. - + --nocheck Ignore errors in MANIFEST file. + --private Make a private release with today's date in version information. + --revision Make a private release with the code revision number in version information. + This must be run at the top level of the source directory. The other command-line options are the names of the programs to use for compressing the resulting tar archive (if none are given then "tar" is assumed): - tar -- use tar and don't do any compressing. - gzip -- use gzip with "-9" and append ".gz" to the output name. + tar -- use tar and don't do any compressing. + gzip -- use gzip with "-9" and append ".gz" to the output name. bzip2 -- use bzip2 with "-9" and append ".bz2" to the output name. - zip -- convert all text files to DOS style and form a zip file for Windows use. + zip -- convert all text files to DOS style and form a zip file for Windows use. doc -- produce the latest doc tree in addition to the archive. An md5 checksum is produced for each archive created and stored in the md5 file. @@ -119,8 +119,8 @@ EOF tar2zip() { if [ $# -ne 3 ]; then - echo "usage: tar2zip " - return 1 + echo "usage: tar2zip " + return 1 fi ztmpdir=/tmp/tmpdir$$ mkdir -p $ztmpdir @@ -132,23 +132,23 @@ tar2zip() (cd $ztmpdir; tar xf -) < $tarfile # sanity check if [ ! -d $ztmpdir/$version ]; then - echo "untar did not create $ztmpdir/$version source dir" - # cleanup - rm -rf $ztmpdir - return 1 + echo "untar did not create $ztmpdir/$version source dir" + # cleanup + rm -rf $ztmpdir + return 1 fi # step 2: convert text files # There maybe a simpler way to do this. # options used in unix2dos: - # -k Keep the date stamp + # -k Keep the date stamp # -q quiet mode # grep redirect output to /dev/null because -q or -s are not portable. find $ztmpdir/$version | \ - while read inf; do \ - if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \ - unix2dos -q -k $inf; \ - fi\ - done + while read inf; do \ + if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \ + unix2dos -q -k $inf; \ + fi\ + done # step 3: make zipball # -9 maximum compression # -y Store symbolic links as such in the zip archive @@ -167,9 +167,9 @@ tar2zip() # testing with source that is not for release, there is not a file named # "configure" but there will be one named "configure.ac". The "configure" # file will be created when autogen.sh runs. There probably will always -# be a bin/release file, but just in case it is removed, we can check for +# be a bin/release file, but just in case it is removed, we can check for # this script, bbrelease, in the bin directory. The bin/release script should -# continue to check for "configure" because it should be present in release +# continue to check for "configure" because it should be present in release # source. if [ ! \( -f configure.ac -a -f bin/bbrelease \) ]; then echo "$0 must be run at the top level of the hdf5 source directory" @@ -187,7 +187,7 @@ release_date=`date +%F` today=`date +%Y%m%d` pmode='no' revmode='no' -tmpdir="../#release_tmp.$$" # tmp work directory +tmpdir="../#release_tmp.$$" # tmp work directory DOC_URL=https://git@bitbucket.hdfgroup.org/scm/hdffv/hdf5doc.git CPPLUS_RM_NAME=cpplus_RM @@ -195,11 +195,11 @@ CPPLUS_RM_NAME=cpplus_RM RESTORE_VERSION() { if [ X-${VERS_OLD} != X- ]; then - echo restoring version information back to $VERS_OLD - rm -f config/lt_vers.am - cp $tmpdir/lt_vers.am config/lt_vers.am - bin/h5vers -s $VERS_OLD - VERS_OLD= + echo restoring version information back to $VERS_OLD + rm -f config/lt_vers.am + cp $tmpdir/lt_vers.am config/lt_vers.am + bin/h5vers -s $VERS_OLD + VERS_OLD= fi } @@ -209,20 +209,20 @@ while [ -n "$1" ]; do arg=$1 shift case "$arg" in - -d) - DEST=$1 - shift - ;; - --nocheck) - check=no - ;; - -h) - USAGE - exit 0 - ;; - --private) - pmode=yes - ;; + -d) + DEST=$1 + shift + ;; + --nocheck) + check=no + ;; + -h) + USAGE + exit 0 + ;; + --private) + pmode=yes + ;; --revision) revmode=yes ;; @@ -230,14 +230,14 @@ while [ -n "$1" ]; do DOCVERSION=$1 shift ;; - -*) - echo "Unknown switch: $arg" 1>&2 - USAGE - exit 1 - ;; - *) - methods="$methods $arg" - ;; + -*) + echo "Unknown switch: $arg" 1>&2 + USAGE + exit 1 + ;; + *) + methods="$methods $arg" + ;; esac done @@ -300,12 +300,12 @@ if [ ! -d $DEST ]; then fi # Check the validity of the MANIFEST file. -bin/chkmanifest || fail=no +bin/chkmanifest || fail=yes if [ "X$fail" = "Xyes" ]; then if [ $check = yes ]; then exit 1 else - echo "Continuing anyway..." + echo "Continuing anyway..." fi fi @@ -340,7 +340,7 @@ test "$verbose" && echo " Running tar..." 1>&2 ( \ cd $tmpdir; \ tar cf $HDF5_VERS.tar $HDF5_IN_VERS/Makefile \ - `sed 's/^\.\//'$HDF5_IN_VERS'\//' $MANIFEST` || exit 1 \ + `sed 's/^\.\//'$HDF5_IN_VERS'\//' $MANIFEST` || exit 1 \ ) # Compress @@ -348,46 +348,46 @@ MD5file=$HDF5_VERS.md5 cp /dev/null $DEST/$MD5file for comp in $methods; do case $comp in - tar) - cp -p $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.tar - (cd $DEST; md5sum $HDF5_VERS.tar >> $MD5file) - ;; - gzip) - test "$verbose" && echo " Running gzip..." 1>&2 - gzip -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz - (cd $DEST; md5sum $HDF5_VERS.tar.gz >> $MD5file) - ;; - bzip2) - test "$verbose" && echo " Running bzip2..." 1>&2 - bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2 - (cd $DEST; md5sum $HDF5_VERS.tar.bz2 >> $MD5file) - ;; - zip) - test "$verbose" && echo " Creating zip ball..." 1>&2 - tar2zip $HDF5_IN_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2 - (cd $DEST; md5sum $HDF5_VERS.zip >> $MD5file) - ;; - doc) + tar) + cp -p $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.tar + (cd $DEST; md5sum $HDF5_VERS.tar >> $MD5file) + ;; + gzip) + test "$verbose" && echo " Running gzip..." 1>&2 + gzip -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz + (cd $DEST; md5sum $HDF5_VERS.tar.gz >> $MD5file) + ;; + bzip2) + test "$verbose" && echo " Running bzip2..." 1>&2 + bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2 + (cd $DEST; md5sum $HDF5_VERS.tar.bz2 >> $MD5file) + ;; + zip) + test "$verbose" && echo " Creating zip ball..." 1>&2 + tar2zip $HDF5_IN_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2 + (cd $DEST; md5sum $HDF5_VERS.zip >> $MD5file) + ;; + doc) if [ "${DOCVERSION}" = "" ]; then DOCVERSION=master fi - test "$verbose" && echo " Creating docs..." 1>&2 - # Check out docs from git repo - (cd $tmpdir; git clone $DOC_URL > /dev/null) || exit 1 - # Create doxygen C++ RM - (cd c++/src && doxygen cpp_doc_config > /dev/null ) || exit 1 - # Replace version of C++ RM with just-created version + test "$verbose" && echo " Creating docs..." 1>&2 + # Check out docs from git repo + (cd $tmpdir; git clone $DOC_URL > /dev/null) || exit 1 + # Create doxygen C++ RM + (cd c++/src && doxygen cpp_doc_config > /dev/null ) || exit 1 + # Replace version of C++ RM with just-created version rm -rf $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME mv c++/src/$CPPLUS_RM_NAME $tmpdir/${DOCVERSION}/html/$CPPLUS_RM_NAME # Compress the docs and move them to the release area mv $tmpdir/$DOCVERSION $tmpdir/${HDF5_VERS}_docs - (cd $tmpdir && tar cf ${HDF5_VERS}_docs.tar ${HDF5_VERS}_docs) - mv $tmpdir/${HDF5_VERS}_docs.tar $DEST - ;; - *) - echo "***Error*** Unknown method $comp" - exit 1 - ;; + (cd $tmpdir && tar cf ${HDF5_VERS}_docs.tar ${HDF5_VERS}_docs) + mv $tmpdir/${HDF5_VERS}_docs.tar $DEST + ;; + *) + echo "***Error*** Unknown method $comp" + exit 1 + ;; esac done -- cgit v0.12 From 23c2f0211e17cb15ce8d0ae1e5d69ad8c0eff9f7 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 1 Jan 2020 10:12:52 -0800 Subject: Changed -Wformat-truncation's level from 2 to 1. --- config/gnu-flags | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/gnu-flags b/config/gnu-flags index 6355ccf..8242945 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -273,7 +273,7 @@ if test "X-gcc" = "X-$cc_vendor"; then # gcc 7 if test $cc_vers_major -ge 7; then DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=2" - H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict" + H5_CFLAGS="$H5_CFLAGS -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wimplicit-fallthrough=5 -Wrestrict" fi # gcc 8 -- cgit v0.12 From 78f0ecc3b98c77b4293c02e78d158a8385513d37 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 1 Jan 2020 10:18:56 -0800 Subject: Changed -Wformat-truncation to level 2 in CMake w/ gcc. --- config/cmake/HDFCompilerFlags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index adace89..1e94ca9 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -200,7 +200,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) # Append more extra warning flags that only gcc 7.x+ know about if (CMAKE_C_COMPILER_ID STREQUAL "GNU" AND NOT CMAKE_C_COMPILER_VERSION VERSION_LESS 7.0) - set (H5_CFLAGS4 "${H5_CFLAGS4} -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=2 -Wimplicit-fallthrough=5 -Wrestrict") + set (H5_CFLAGS4 "${H5_CFLAGS4} -Walloc-zero -Walloca -Wduplicated-branches -Wformat-overflow=2 -Wformat-truncation=1 -Wimplicit-fallthrough=5 -Wrestrict") endif () # Append more extra warning flags that only gcc 8.x+ know about -- cgit v0.12 From 887aa3d05d0a64e1c8198138334c0fe761d0ab2f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 8 Jan 2020 19:40:32 -0800 Subject: Merge of --Wc++-compat changes from develop --- config/cmake/HDFCompilerFlags.cmake | 2 +- config/gnu-flags | 5 +++- src/H5FD.c | 4 ++-- src/H5Fsuper.c | 2 +- src/H5I.c | 6 ++--- src/H5MF.c | 48 ++++++++++++++++++------------------- src/H5MFdbg.c | 6 ++--- src/H5Ofsinfo.c | 10 ++++---- src/H5private.h | 14 ----------- src/hdf5-lin.lnt | 3 --- src/hdf5.lnt | 5 ---- test/dsets.c | 12 +++++----- test/earray.c | 4 ++-- test/farray.c | 4 ++-- test/fheap.c | 12 +++++----- test/gen_filespace.c | 3 +-- test/h5test.c | 8 +++---- test/links.c | 32 ++++++++++++------------- test/mf.c | 20 ++++++++-------- test/page_buffer.c | 4 ++-- test/set_extent.c | 2 +- test/tattr.c | 12 +++++----- test/tfile.c | 12 +++++----- test/th5s.c | 2 +- test/tvltypes.c | 6 ++--- test/vfd.c | 4 ++-- tools/test/h5dump/h5dumpgentest.c | 2 +- tools/test/perform/sio_engine.c | 4 ++-- tools/test/perform/sio_standalone.h | 7 ------ 29 files changed, 114 insertions(+), 141 deletions(-) diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 1e94ca9..c803384 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -107,7 +107,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) endif() elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -pedantic -Wall -Wextra") - set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wc++-compat -Wcast-align") + set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wno-c++-compat -Wcast-align") set (H5_CFLAGS0 "${H5_CFLAGS0} -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal") set (H5_CFLAGS0 "${H5_CFLAGS0} -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs") set (H5_CFLAGS0 "${H5_CFLAGS0} -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith") diff --git a/config/gnu-flags b/config/gnu-flags index 8242945..a5f3258 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -168,7 +168,10 @@ if test "X-gcc" = "X-$cc_vendor"; then # NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add # it to the developer flags. # - H5_CFLAGS="$H5_CFLAGS -pedantic -Wall -Wextra -Wbad-function-cast -Wc++-compat -Wcast-align" + # NOTE: Due to the divergence in the C and C++, we're dropping support for + # compiling the C library with a C++ compiler and dropping the -Wc++-compat + # warning. + H5_CFLAGS="$H5_CFLAGS -pedantic -Wall -Wextra -Wbad-function-cast -Wno-c++-compat -Wcast-align" H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal" H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked" diff --git a/src/H5FD.c b/src/H5FD.c index d74ea31..ccdec66 100644 --- a/src/H5FD.c +++ b/src/H5FD.c @@ -243,7 +243,7 @@ H5FDregister(const H5FD_class_t *cls) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`get_eof' method is not defined") if(!cls->read || !cls->write) HGOTO_ERROR(H5E_ARGS, H5E_UNINITIALIZED, FAIL, "`read' and/or `write' method is not defined") - for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,type)) + for (type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) if(cls->fl_map[type] < H5FD_MEM_NOLIST || cls->fl_map[type] >= H5FD_MEM_NTYPES) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid free-list mapping") @@ -288,7 +288,7 @@ H5FD_register(const void *_cls, size_t size, hbool_t app_ref) HDassert(cls->get_eoa && cls->set_eoa); HDassert(cls->get_eof); HDassert(cls->read && cls->write); - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) HDassert(cls->fl_map[type] >= H5FD_MEM_NOLIST && cls->fl_map[type] < H5FD_MEM_NTYPES); /* Copy the class structure so the caller can reuse or free it */ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index 4999565..a1b29d5 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -1398,7 +1398,7 @@ H5F__super_init(H5F_t *f) HGOTO_ERROR(H5E_FILE, H5E_CANTSET, FAIL, "can't set version of fsinfo") f->shared->fs_version = fsinfo.version; - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; if(H5O_msg_create(&ext_loc, H5O_FSINFO_ID, H5O_MSG_FLAG_DONTSHARE | H5O_MSG_FLAG_MARK_IF_UNKNOWN, H5O_UPDATE_TIME, &fsinfo) < 0) diff --git a/src/H5I.c b/src/H5I.c index 6c24d5a..bde8989 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -152,13 +152,13 @@ H5I_term_package(void) H5I_type_t type; /* Type of ID */ /* How many types are still being used? */ - for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t, type)) + for(type = (H5I_type_t)0; type < H5I_next_type; type++) if((type_ptr = H5I_id_type_list_g[type]) && type_ptr->ids) n++; /* If no types are used then clean up */ if(0 == n) { - for(type = (H5I_type_t)0; type < H5I_next_type; H5_INC_ENUM(H5I_type_t,type)) { + for(type = (H5I_type_t)0; type < H5I_next_type; type++) { type_ptr = H5I_id_type_list_g[type]; if(type_ptr) { HDassert(NULL == type_ptr->ids); @@ -210,7 +210,7 @@ H5Iregister_type(size_t hash_size, unsigned reserved, H5I_free_t free_func) /* Increment the number of types*/ if(H5I_next_type < H5I_MAX_NUM_TYPES) { new_type = H5I_next_type; - H5_INC_ENUM(H5I_type_t, H5I_next_type); + H5I_next_type++; } /* end if */ else { hbool_t done; /* Indicate that search was successful */ diff --git a/src/H5MF.c b/src/H5MF.c index 065a5c6..6d28ee8 100644 --- a/src/H5MF.c +++ b/src/H5MF.c @@ -152,7 +152,7 @@ H5MF_init_merge_flags(H5F_t *f) * can merge with the metadata or small 'raw' data aggregator */ all_same = TRUE; - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) /* Check for any different type mappings */ if(f->shared->fs_type_map[type] != f->shared->fs_type_map[H5FD_MEM_DEFAULT]) { all_same = FALSE; @@ -176,7 +176,7 @@ H5MF_init_merge_flags(H5F_t *f) /* One or more allocation type don't map to the same free list type */ /* Check if all the metadata allocation types map to the same type */ all_metadata_same = TRUE; - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) /* Skip checking raw data free list mapping */ /* (global heap is treated as raw data) */ if(type != H5FD_MEM_DRAW && type != H5FD_MEM_GHEAP) { @@ -1704,7 +1704,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Iterate over all the free space types that have managers and * get each free list's space */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f, ptype)) needed_ring = H5AC_RING_MDFSM; @@ -1726,7 +1726,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Iterate over all the free space types that have managers and * get each free list's space */ - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; @@ -1825,9 +1825,9 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); * * In passing, verify that all the free space managers are closed. */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) fsinfo.fs_addr[type-1] = f->shared->fs_addr[type]; fsinfo.strategy = f->shared->fs_strategy; fsinfo.persist = f->shared->fs_persist; @@ -1842,7 +1842,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); HGOTO_ERROR(H5E_RESOURCE, H5E_WRITEERROR, FAIL, "error in writing message to superblock extension") /* Close the free space managers */ - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) { if(f->shared->fs_man[type]) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) @@ -1895,7 +1895,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); HDassert((f->shared->first_alloc_dealloc) || (final_eoa == f->shared->eoa_post_fsm_fsalloc)); } /* end if */ else { /* super_vers can be 0, 1, 2 */ - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) if(H5MF__close_delete_fstype(f, (H5F_mem_page_t)type) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, FAIL, "can't initialize file free space") } /* end else */ @@ -1976,7 +1976,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); fsinfo.eoa_pre_fsm_fsalloc = HADDR_UNDEF; fsinfo.version = f->shared->fs_version; - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo.fs_addr[ptype - 1] = HADDR_UNDEF; if(f->shared->fs_persist) { @@ -1998,7 +1998,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); * file space for the self referential free space managers. Other * data was gathered above. */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo.fs_addr[ptype-1] = f->shared->fs_addr[ptype]; fsinfo.eoa_pre_fsm_fsalloc = f->shared->eoa_pre_fsm_fsalloc; @@ -2008,7 +2008,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Close the free space managers */ /* use H5MF__close_fstype() for this? */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { if(f->shared->fs_man[ptype]) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f, ptype)) @@ -2070,7 +2070,7 @@ HDfprintf(stderr, "%s: Entering\n", FUNC); /* Iterate over all the free space types that have managers * and get each free list's space */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) if(H5MF__close_delete_fstype(f, ptype) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager") @@ -2143,7 +2143,7 @@ H5MF__close_shrink_eoa(H5F_t *f) if(H5F_PAGED_AGGR(f)) { /* Check the last section of each free-space manager */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { if(f->shared->fs_man[ptype]) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f, ptype)) @@ -2167,7 +2167,7 @@ H5MF__close_shrink_eoa(H5F_t *f) } /* end if */ else { /* Check the last section of each free-space manager */ - for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_DEFAULT; type < H5FD_MEM_NTYPES; type++) { if(f->shared->fs_man[type]) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) @@ -2263,7 +2263,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) end_type = (H5F_mem_page_t)H5FD_MEM_NTYPES; } /* end else */ - for(tt = H5FD_MEM_SUPER; tt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, tt)) + for(tt = H5FD_MEM_SUPER; tt < H5FD_MEM_NTYPES; tt++) if(HADDR_UNDEF == (fs_eoa[tt] = H5F_get_eoa(f, tt))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") @@ -2278,7 +2278,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) } /* end if */ /* Iterate over all the free space types that have managers and get each free list's space */ - for(type = start_type; type < end_type; H5_INC_ENUM(H5F_mem_page_t, type)) { + for(type = start_type; type < end_type; type++) { fs_started[type] = FALSE; /* Check if the free space for the file has been initialized */ @@ -2317,7 +2317,7 @@ H5MF_get_freespace(H5F_t *f, hsize_t *tot_space, hsize_t *meta_size) } /* end for */ /* Close the free-space managers if they were opened earlier in this routine */ - for(type = start_type; type < end_type; H5_INC_ENUM(H5F_mem_page_t, type)) { + for(type = start_type; type < end_type; type++) { /* Test to see if we need to switch rings -- do so if required */ if(H5MF__fsm_type_is_self_referential(f, (H5F_mem_page_t)type)) needed_ring = H5AC_RING_MDFSM; @@ -2413,7 +2413,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t if(H5F_PAGED_AGGR(f)) /* set to the corresponding LARGE free-space manager */ end_type = (H5F_mem_page_t)(end_type + H5FD_MEM_NTYPES); else - H5_INC_ENUM(H5F_mem_page_t, end_type); + end_type++; } /* end else */ /* Set up user data for section iteration */ @@ -2429,7 +2429,7 @@ H5MF_get_free_sections(H5F_t *f, H5FD_mem_t type, size_t nsects, H5F_sect_info_t curr_ring = H5AC_RING_RDFSM; /* Iterate over memory types, retrieving the number of sections of each type */ - for(ty = start_type; ty < end_type; H5_INC_ENUM(H5F_mem_page_t, ty)) { + for(ty = start_type; ty < end_type; ty++) { hbool_t fs_started = FALSE; /* The free-space manager is opened or not */ size_t nums = 0; /* The number of free-space sections */ @@ -2757,7 +2757,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) else /* no need for a second pass */ break; - for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { + for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; mem_type++) { H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ @@ -2858,7 +2858,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) * those addresses are unknown. This is OK -- we will write the correct * values to the message at free space manager shutdown. */ - for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, fsm_type)) + for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++) fsinfo.fs_addr[fsm_type - 1] = HADDR_UNDEF; fsinfo.strategy = f->shared->fs_strategy; fsinfo.persist = f->shared->fs_persist; @@ -2891,7 +2891,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) */ /* Reinitialize fsm_visited */ - for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, fsm_type)) + for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++) fsm_visited[fsm_type] = FALSE; for(pass_count = 0; pass_count <= 1; pass_count++) { @@ -2902,7 +2902,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) else /* no need for a second pass */ break; - for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5F_mem_t, mem_type)) { + for(mem_type = H5FD_MEM_SUPER; mem_type < H5FD_MEM_NTYPES; mem_type++) { H5MF__alloc_to_fs_type(f, mem_type, alloc_size, &fsm_type); if(pass_count == 0) { /* this is the first pass */ @@ -2999,7 +2999,7 @@ H5MF_settle_raw_data_fsm(H5F_t *f, hbool_t *fsm_settled) } /* end for */ /* verify that all opened FSMs were closed */ - for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, fsm_type)) + for(fsm_type = H5F_MEM_PAGE_SUPER; fsm_type < H5F_MEM_PAGE_NTYPES; fsm_type++) HDassert(!fsm_opened[fsm_type]); /* Indicate that the FSM was settled successfully */ diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index eedb72e..46f66e9 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -169,7 +169,7 @@ H5MF_sects_debug(H5F_t *f, haddr_t fs_addr, FILE *stream, int indent, int fwidth HDassert(indent >= 0); HDassert(fwidth >= 0); - for(type = H5F_MEM_PAGE_DEFAULT; type < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, type)) + for(type = H5F_MEM_PAGE_DEFAULT; type < H5F_MEM_PAGE_NTYPES; type++) if(H5F_addr_eq(f->shared->fs_addr[type], fs_addr)) { if(!f->shared->fs_man[type]) if(H5MF__open_fstype(f, type) < 0) @@ -243,7 +243,7 @@ HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %a\n", FUNC, eoa); if(H5F_PAGED_AGGR(f)) { /* File space paging */ H5F_mem_page_t ptype; /* Memory type for iteration -- page fs */ - for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) { + for(ptype = H5F_MEM_PAGE_META; ptype < H5F_MEM_PAGE_NTYPES; ptype++) { /* Print header for type */ HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)ptype); @@ -289,7 +289,7 @@ HDfprintf(stderr, "%s: sda_addr = %a, sda_size = %Hu, end of sda = %a\n", FUNC, #endif /* H5MF_ALLOC_DEBUG */ /* Iterate over all the free space types that have managers and dump each free list's space */ - for(atype = H5FD_MEM_DEFAULT; atype < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, atype)) { + for(atype = H5FD_MEM_DEFAULT; atype < H5FD_MEM_NTYPES; atype++) { /* Print header for type */ HDfprintf(stream, "%*sFile Free Space Info for type = %u:\n", indent, "", (unsigned)atype); diff --git a/src/H5Ofsinfo.c b/src/H5Ofsinfo.c index 8c42f46..3c5f94d 100644 --- a/src/H5Ofsinfo.c +++ b/src/H5Ofsinfo.c @@ -101,7 +101,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, if(NULL == (fsinfo = H5FL_CALLOC(H5O_fsinfo_t))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) fsinfo->fs_addr[ptype - 1] = HADDR_UNDEF; /* Version of message */ @@ -130,7 +130,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, fsinfo->threshold = threshold; if(HADDR_UNDEF == (fsinfo->eoa_pre_fsm_fsalloc = H5F_get_eoa(f, H5FD_MEM_DEFAULT)) ) HGOTO_ERROR(H5E_FILE, H5E_CANTGET, NULL, "unable to get file size") - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) H5F_addr_decode(f, &p, &(fsinfo->fs_addr[type-1])); break; @@ -170,7 +170,7 @@ H5O_fsinfo_decode(H5F_t *f, H5O_t H5_ATTR_UNUSED *open_oh, /* Decode addresses of free space managers, if persisting */ if(fsinfo->persist) { - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) H5F_addr_decode(f, &p, &(fsinfo->fs_addr[ptype - 1])); } /* end if */ @@ -224,7 +224,7 @@ H5O_fsinfo_encode(H5F_t *f, hbool_t H5_ATTR_UNUSED disable_shared, uint8_t *p, c /* Store addresses of free-space managers, if persisting */ if(fsinfo->persist) { /* Addresses of free-space managers */ - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) H5F_addr_encode(f, &p, fsinfo->fs_addr[ptype - 1]); } /* end if */ @@ -396,7 +396,7 @@ H5O__fsinfo_debug(H5F_t H5_ATTR_UNUSED *f, const void *_mesg, FILE * stream, "eoa_pre_fsm_fsalloc:", fsinfo->eoa_pre_fsm_fsalloc); if(fsinfo->persist) { - for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; H5_INC_ENUM(H5F_mem_page_t, ptype)) + for(ptype = H5F_MEM_PAGE_SUPER; ptype < H5F_MEM_PAGE_NTYPES; ptype++) HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, "Free space manager address:", fsinfo->fs_addr[ptype-1]); } /* end if */ diff --git a/src/H5private.h b/src/H5private.h index 0eb0b0c..eff4d9f 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -508,20 +508,6 @@ # define H5_POSIX_CREATE_MODE_RW 0666 #endif -/* - * A macro to portably increment enumerated types. - */ -#ifndef H5_INC_ENUM -# define H5_INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1)) -#endif - -/* - * A macro to portably decrement enumerated types. - */ -#ifndef H5_DEC_ENUM -# define H5_DEC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)-1)) -#endif - /* Double constant wrapper * * Quiets gcc warnings from -Wunsuffixed-float-constants. diff --git a/src/hdf5-lin.lnt b/src/hdf5-lin.lnt index da20937..23ceed2 100644 --- a/src/hdf5-lin.lnt +++ b/src/hdf5-lin.lnt @@ -13,9 +13,6 @@ // Turn off warnings about not using the return value from these functions: -emacro(534,HDfflush,HDgetrusage,HDgettimeofday,HDputc) -// Turn off warnings about converting an enum to an int --emacro(641,H5_INC_ENUM,H5_DEC_ENUM) - // Suppress message about "Expression with side effects passed to repeated parameter 1 in macro 'assert'" -esym(666,assert) diff --git a/src/hdf5.lnt b/src/hdf5.lnt index 642698a..3d7d5b2 100644 --- a/src/hdf5.lnt +++ b/src/hdf5.lnt @@ -30,11 +30,6 @@ -esym(534, H5UC_decr) -esym(534, H5VM_array_fill) - -// Turn off warnings about "Expression-like macro not parenthesized" for -// enumerated type increment & decrement macros: --esym(773, H5_INC_ENUM, H5_DEC_ENUM) - /* So far, the following files have been linted with these options: H5.c H5A.c diff --git a/test/dsets.c b/test/dsets.c index 66313a5..6a9d701 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -8349,7 +8349,7 @@ test_chunk_fast(const char *env_h5_driver, hid_t fapl) H5D_alloc_time_t alloc_time; /* Storage allocation time */ /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { unsigned ndims; /* Current # of dims to test */ /* Loop over dataspace ranks to test */ @@ -8649,7 +8649,7 @@ test_reopen_chunk_fast(hid_t fapl) h5_fixname(FILENAME[10], fapl, filename, sizeof filename); /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -8780,7 +8780,7 @@ test_chunk_fast_bug1(hid_t fapl) if((sid = H5Screate_simple(2, dim, max_dim)) < 0) FAIL_STACK_ERROR /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -8958,7 +8958,7 @@ test_chunk_expand(hid_t fapl) if(TRUE != H5Zfilter_avail(H5Z_FILTER_EXPAND)) FAIL_STACK_ERROR /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -9412,7 +9412,7 @@ test_fixed_array(hid_t fapl) #endif /* H5_HAVE_FILTER_DEFLATE */ /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR @@ -9813,7 +9813,7 @@ test_single_chunk(hid_t fapl) #endif /* H5_HAVE_FILTER_DEFLATE */ /* Loop over storage allocation time */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { /* Create file */ if((fid = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) FAIL_STACK_ERROR diff --git a/test/earray.c b/test/earray.c index bace4b7..4087648 100644 --- a/test/earray.c +++ b/test/earray.c @@ -2470,7 +2470,7 @@ main(void) init_cparam(&cparam); /* Iterate over the testing parameters */ - for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; H5_INC_ENUM(earray_test_type_t, curr_test)) { + for(curr_test = EARRAY_TEST_NORMAL; curr_test < EARRAY_TEST_NTESTS; curr_test++) { /* Initialize the testing parameters */ init_tparam(&tparam, &cparam); @@ -2502,7 +2502,7 @@ main(void) nerrors += test_delete_open(fapl, &cparam, &tparam); /* Iterate over the type of capacity tests */ - for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; H5_INC_ENUM(earray_iter_type_t, curr_iter)) { + for(curr_iter = EARRAY_ITER_FW; curr_iter < EARRAY_ITER_NITERS; curr_iter++) { hsize_t sblk; /* Super block index */ hsize_t dblk; /* Data block index */ hsize_t nelmts; /* # of elements to test */ diff --git a/test/farray.c b/test/farray.c index e1bc5bc..eb9ac42 100644 --- a/test/farray.c +++ b/test/farray.c @@ -1686,7 +1686,7 @@ main(void) } /* Iterate over the testing parameters */ - for(curr_test = FARRAY_TEST_NORMAL; curr_test < FARRAY_TEST_NTESTS; H5_INC_ENUM(farray_test_type_t, curr_test)) { + for(curr_test = FARRAY_TEST_NORMAL; curr_test < FARRAY_TEST_NTESTS; curr_test++) { /* Initialize the testing parameters */ HDmemset(&tparam, 0, sizeof(tparam)); @@ -1722,7 +1722,7 @@ main(void) nerrors += test_delete_open(fapl, &cparam, &tparam); /* Iterate over the type of capacity tests */ - for(curr_iter = FARRAY_ITER_FW; curr_iter < FARRAY_ITER_NITERS; H5_INC_ENUM(farray_iter_type_t, curr_iter)) { + for(curr_iter = FARRAY_ITER_FW; curr_iter < FARRAY_ITER_NITERS; curr_iter++) { /* Set appropriate parameters for each type of iteration */ switch(curr_iter) { diff --git a/test/fheap.c b/test/fheap.c index 3ef6206..7968f50 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -16449,7 +16449,7 @@ main(void) } /* Iterate over the testing parameters */ - for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; H5_INC_ENUM(fheap_test_type_t, curr_test)) { + for(curr_test = FHEAP_TEST_NORMAL; curr_test < FHEAP_TEST_NTESTS; curr_test++) { /* Clear the testing parameters */ HDmemset(&tparam, 0, sizeof(fheap_test_param_t)); tparam.actual_id_len = HEAP_ID_LEN; @@ -16491,7 +16491,7 @@ main(void) fheap_test_fill_t fill; /* Size of objects to fill heap blocks with */ /* Filling with different sized objects */ - for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; H5_INC_ENUM(fheap_test_fill_t, fill)) { + for(fill = FHEAP_TEST_FILL_LARGE; fill < FHEAP_TEST_FILL_N; fill++) { tparam.fill = fill; /* Set appropriate testing parameters for each test */ @@ -16584,9 +16584,9 @@ main(void) fheap_test_del_drain_t drain_half; /* Deletion draining */ /* More complex removal patterns */ - for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) { + for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) { tparam.del_dir = del_dir; - for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; H5_INC_ENUM(fheap_test_del_drain_t, drain_half)) { + for(drain_half = FHEAP_DEL_DRAIN_ALL; drain_half < FHEAP_DEL_DRAIN_N; drain_half++) { tparam.drain_half = drain_half; /* Don't need to test deletion directions when deleting entire heap */ if(tparam.del_dir == FHEAP_DEL_HEAP && tparam.drain_half > FHEAP_DEL_DRAIN_ALL) @@ -16694,7 +16694,7 @@ main(void) } /* end switch */ /* Try several different methods of deleting objects */ - for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) { + for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) { tparam.del_dir = del_dir; /* Test 'huge' object insert & delete */ @@ -16722,7 +16722,7 @@ main(void) { fheap_test_del_dir_t del_dir; /* Deletion direction */ - for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; H5_INC_ENUM(fheap_test_del_dir_t, del_dir)) { + for(del_dir = FHEAP_DEL_FORWARD; del_dir < FHEAP_DEL_NDIRS; del_dir++) { tparam.del_dir = del_dir; /* Controlled tests */ diff --git a/test/gen_filespace.c b/test/gen_filespace.c index 4397836..f4a4f3f 100644 --- a/test/gen_filespace.c +++ b/test/gen_filespace.c @@ -29,7 +29,6 @@ const char *FILENAMES[] = { #define NUM_ELMTS 100 #define FALSE 0 #define TRUE 1 -#define INC_ENUM(TYPE,VAR) (VAR)=((TYPE)((VAR)+1)) /* * Compile and run this program in the trunk to generate @@ -58,7 +57,7 @@ int main(void) unsigned fs_persist; /* Persisting free-space or not */ j = 0; - for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; INC_ENUM(H5F_fspace_strategy_t, fs_strategy)) { + for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; fs_strategy++) { for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) { if(fs_persist && fs_strategy >= H5F_FSPACE_STRATEGY_AGGR) diff --git a/test/h5test.c b/test/h5test.c index 3cc2c35..25a4e6c 100644 --- a/test/h5test.c +++ b/test/h5test.c @@ -231,7 +231,7 @@ h5_delete_test_file(const char *base_name, hid_t fapl) HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t,mt)) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { HDsnprintf(sub_filename, sizeof(sub_filename), "%s-%c.h5", filename, multi_letters[mt]); HDremove(sub_filename); } @@ -941,7 +941,7 @@ h5_get_vfd_fapl(hid_t fapl) HDmemset(memb_addr, 0, sizeof(memb_addr)); HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { memb_fapl[mt] = H5P_DEFAULT; sv[mt] = (char *)HDmalloc(H5TEST_MULTI_FILENAME_LEN); HDassert(sv[mt]); @@ -953,7 +953,7 @@ h5_get_vfd_fapl(hid_t fapl) if(H5Pset_fapl_multi(fapl, memb_map, memb_fapl, memb_name, memb_addr, FALSE) < 0) goto error; - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) HDfree(sv[mt]); } else if(!HDstrcmp(tok, "family")) { /* Family of files, each 1MB and using the default driver */ @@ -1286,7 +1286,7 @@ h5_get_file_size(const char *filename, hid_t fapl) h5_stat_size_t tot_size = 0; HDassert(HDstrlen(multi_letters) == H5FD_MEM_NTYPES); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { /* Create the filename to query */ HDsnprintf(temp, sizeof temp, "%s-%c.h5", filename, multi_letters[mt]); diff --git a/test/links.c b/test/links.c index 0bdb3f0..db894af 100644 --- a/test/links.c +++ b/test/links.c @@ -3306,7 +3306,7 @@ external_set_elink_fapl1(hid_t fapl, hbool_t new_format) HDmemset(memb_addr, 0, sizeof memb_addr); HDmemset(sv, 0, sizeof sv); - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { memb_map[mt] = H5FD_MEM_SUPER; memb_fapl[mt] = H5P_DEFAULT; } /* end for */ @@ -10895,9 +10895,9 @@ delete_by_idx(hid_t fapl) herr_t ret; /* Generic return value */ /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -11207,7 +11207,7 @@ delete_by_idx_old(hid_t fapl) herr_t ret; /* Generic return value */ /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_DEC; order++) { /* Print test banner */ if(order == H5_ITER_INC) TESTING("deleting links by index in increasing order in old-style group") @@ -11704,9 +11704,9 @@ link_iterate(hid_t fapl) iter_info.visited = visited; /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -12130,7 +12130,7 @@ link_iterate_old(hid_t fapl) iter_info.visited = visited; /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { /* Print appropriate test message */ if(order == H5_ITER_INC) { TESTING("iterating over links by name index in increasing order in old-style group") @@ -12351,9 +12351,9 @@ open_by_idx(hid_t fapl) if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -12559,7 +12559,7 @@ open_by_idx_old(hid_t fapl) if((mount_file_id = H5Fcreate(filename, H5F_ACC_TRUNC, H5P_DEFAULT, fapl)) < 0) TEST_ERROR /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { /* Print appropriate test message */ if(order == H5_ITER_INC) { TESTING("open object by name index in increasing order in old-style group") @@ -12769,9 +12769,9 @@ object_info(hid_t fapl) if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <= H5_ITER_NATIVE; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -13001,7 +13001,7 @@ object_info_old(hid_t fapl) if((space_id = H5Screate(H5S_SCALAR)) < 0) TEST_ERROR /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { /* Print appropriate test message */ if(order == H5_ITER_INC) { TESTING("query object info by name index in increasing order in old-style group") @@ -13148,9 +13148,9 @@ group_info(hid_t fapl) if(H5Pget_link_phase_change(gcpl_id, &max_compact, &min_dense) < 0) TEST_ERROR /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -13540,7 +13540,7 @@ group_info_old(hid_t fapl) unsigned u, v; /* Local index variables */ /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <=H5_ITER_NATIVE; order++) { if(order == H5_ITER_INC) { TESTING("query group info by name index in increasing order in old-style group") } /* end if */ diff --git a/test/mf.c b/test/mf.c index 99975c0..8cc9464 100644 --- a/test/mf.c +++ b/test/mf.c @@ -6004,7 +6004,7 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) /* Populate memb_fapl_arr, patch memb_addr so member file addresses * are aligned */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { memb_fapl_arr[mt] = memb_fapl; memb_addr[mt] = ((memb_addr[mt] + align - 1) / align) * align; } /* end for */ @@ -6014,7 +6014,7 @@ test_mf_bug1(const char *env_h5_drvr, hid_t fapl) TEST_ERROR /* Free memb_name */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) free(memb_name[mt]); } /* end else */ @@ -6377,7 +6377,7 @@ error: HDmemset(memb_name, 0, sizeof memb_name); \ HDmemset(memb_addr, 0, sizeof memb_addr); \ HDmemset(sv, 0, sizeof sv); \ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { \ + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { \ memb_map[mt] = H5FD_MEM_SUPER; \ memb_fapl[mt] = H5P_DEFAULT; \ } \ @@ -7151,7 +7151,7 @@ test_mf_strat_thres_persist(const char *env_h5_drvr, hid_t fapl, hbool_t new_for for(fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) { /* Testing for H5F_FSPACE_STRATEGY_FSM_AGGR and H5F_FSPACE_STRATEGY_PAGE strategies only */ - for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; H5_INC_ENUM(H5F_fspace_strategy_t, fs_type)) { + for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; fs_type++) { if(!contig_addr_vfd && (fs_persist || fs_type == H5F_FSPACE_STRATEGY_PAGE)) continue; @@ -7319,7 +7319,7 @@ test_mf_strat_thres_gone(const char *env_h5_drvr, hid_t fapl, hbool_t new_format /* Test with TRUE or FALSE for persisting free-space */ for(fs_persist = FALSE; fs_persist <= TRUE; fs_persist++) { /* Testing for H5F_FSPACE_STRATEGY_FSM_AGGR and H5F_FSPACE_STRATEGY_PAGE strategies only */ - for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; H5_INC_ENUM(H5F_fspace_strategy_t, fs_type)) { + for(fs_type = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_type < H5F_FSPACE_STRATEGY_AGGR; fs_type++) { /* Skip for multi/split driver: persisting free-space or paged aggregation strategy */ if(!contig_addr_vfd && (fs_persist || fs_type == H5F_FSPACE_STRATEGY_PAGE)) @@ -7575,7 +7575,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize; } else { /* Set memb_addr aligned */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize; } /* end else */ @@ -7584,7 +7584,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) TEST_ERROR /* Free memb_name */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) free(memb_name[mt]); return 0; @@ -8652,7 +8652,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) /* Populate memb_fapl_arr */ /* Set memb_addr aligned */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) { + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) { memb_fapl_arr[mt] = memb_fapl; memb_addr[mt] = ((memb_addr[mt] + TBLOCK_SIZE4096 - 1) / TBLOCK_SIZE4096) * TBLOCK_SIZE4096; } @@ -8664,7 +8664,7 @@ test_page_alignment(const char *env_h5_drvr, hid_t fapl) } /* end else */ /* Free memb_name */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) free(memb_name[mt]); /* Close memb_fapl */ @@ -8911,7 +8911,7 @@ main(void) nerrors += test_mf_aggr_absorb(env_h5_drvr, fapl); /* For old library format--tests for alignment */ - for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; H5_INC_ENUM(test_type_t, curr_test)) { + for(curr_test = TEST_NORMAL; curr_test < TEST_NTESTS; curr_test++) { switch(curr_test) { case TEST_NORMAL: /* set alignment = 1024 */ diff --git a/test/page_buffer.c b/test/page_buffer.c index 93749a2..73088de 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -335,7 +335,7 @@ set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize) memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize; } else { /* Set memb_addr aligned */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize; } /* end else */ @@ -344,7 +344,7 @@ set_multi_split(const char *env_h5_drvr, hid_t fapl, hsize_t pagesize) TEST_ERROR /* Free memb_name */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) free(memb_name[mt]); } /* end if */ diff --git a/test/set_extent.c b/test/set_extent.c index b8ce3df..6c582ef 100644 --- a/test/set_extent.c +++ b/test/set_extent.c @@ -358,7 +358,7 @@ static int do_ranks( hid_t fapl, hbool_t new_format ) /* Iterate over different index types, but only if using the new format */ - for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; H5_INC_ENUM(rank4_index_t, index_type)) { + for(index_type = RANK4_INDEX_BTREE; index_type < RANK4_NINDICES; index_type++) { /* Standard test */ if(test_random_rank4(fapl, dcpl, do_fillvalue, disable_edge_filters, FALSE, index_type) < 0) { DO_RANKS_PRINT_CONFIG("Randomized rank 4") diff --git a/test/tattr.c b/test/tattr.c index 5d35e41..4521c96 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -6060,9 +6060,9 @@ test_attr_delete_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -7014,9 +7014,9 @@ test_attr_iterate2(hbool_t new_format, hid_t fcpl, hid_t fapl) iter_info.visited = visited; /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ @@ -7374,9 +7374,9 @@ test_attr_open_by_idx(hbool_t new_format, hid_t fcpl, hid_t fapl) CHECK(ret, FAIL, "H5Pget_attr_phase_change"); /* Loop over operating on different indices on link fields */ - for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; H5_INC_ENUM(H5_index_t, idx_type)) { + for(idx_type = H5_INDEX_NAME; idx_type <= H5_INDEX_CRT_ORDER; idx_type++) { /* Loop over operating in different orders */ - for(order = H5_ITER_INC; order <= H5_ITER_DEC; H5_INC_ENUM(H5_iter_order_t, order)) { + for(order = H5_ITER_INC; order <= H5_ITER_DEC; order++) { /* Loop over using index for creation order value */ for(use_index = FALSE; use_index <= TRUE; use_index++) { /* Print appropriate test message */ diff --git a/test/tfile.c b/test/tfile.c index a3bcfb7..0172dd1 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -3777,7 +3777,7 @@ test_filespace_info(const char *env_h5_drvr) for(fs_threshold = 0; fs_threshold <= TEST_THRESHOLD10; fs_threshold++) { /* Test with 4 file space strategies */ - for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; H5_INC_ENUM(H5F_fspace_strategy_t, fs_strategy)) { + for(fs_strategy = H5F_FSPACE_STRATEGY_FSM_AGGR; fs_strategy < H5F_FSPACE_STRATEGY_NTYPES; fs_strategy++) { if(!contig_addr_vfd && (fs_strategy == H5F_FSPACE_STRATEGY_PAGE || fs_persist)) continue; @@ -3925,7 +3925,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) memb_addr[H5FD_MEM_DRAW] = ((memb_addr[H5FD_MEM_DRAW] + pagesize - 1) / pagesize) * pagesize; } else { /* Set memb_addr aligned */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) memb_addr[mt] = ((memb_addr[mt] + pagesize - 1) / pagesize) * pagesize; } /* end else */ @@ -3934,7 +3934,7 @@ set_multi_split(hid_t fapl, hsize_t pagesize, hbool_t multi, hbool_t split) TEST_ERROR /* Free memb_name */ - for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, mt)) + for(mt = H5FD_MEM_DEFAULT; mt < H5FD_MEM_NTYPES; mt++) free(memb_name[mt]); return 0; @@ -4301,7 +4301,7 @@ test_sects_freespace(const char *env_h5_drvr, hbool_t new_format) if(multi_vfd) { hssize_t ntmp; - for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; H5_INC_ENUM(H5FD_mem_t, type)) { + for(type = H5FD_MEM_SUPER; type < H5FD_MEM_NTYPES; type++) { if(type == H5FD_MEM_DRAW || type == H5FD_MEM_GHEAP) continue; /* Get the # of free-space sections in the file for metadata */ @@ -5611,8 +5611,8 @@ test_libver_bounds_super_open(hid_t fapl, hid_t fcpl, htri_t is_swmr, htri_t non CHECK(new_fapl, FAIL, "H5Pcreate"); /* Loop through all the combinations of low/high bounds in new_fapl */ - for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, low)) { - for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; H5_INC_ENUM(H5F_libver_t, high)) { + for(low = H5F_LIBVER_EARLIEST; low < H5F_LIBVER_NBOUNDS; low++) { + for(high = H5F_LIBVER_EARLIEST; high < H5F_LIBVER_NBOUNDS; high++) { H5E_BEGIN_TRY { ret = H5Pset_libver_bounds(new_fapl, low, high); } H5E_END_TRY; diff --git a/test/th5s.c b/test/th5s.c index 4d4eb82..65c0eed 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -591,7 +591,7 @@ test_h5s_zero_dim(void) wdata_real[i][j][k] = (int)(i + j + k); /* Test with different space allocation times */ - for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; H5_INC_ENUM(H5D_alloc_time_t, alloc_time)) { + for(alloc_time = H5D_ALLOC_TIME_EARLY; alloc_time <= H5D_ALLOC_TIME_INCR; alloc_time++) { /* Make sure we can create the space with the dimension size 0 (starting from v1.8.7). * The dimension doesn't need to be unlimited. */ diff --git a/test/tvltypes.c b/test/tvltypes.c index ffa2aff..02291e2 100644 --- a/test/tvltypes.c +++ b/test/tvltypes.c @@ -2543,7 +2543,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fcreate"); /* Create datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -2659,7 +2659,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fopen"); /* Read empty datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ @@ -2860,7 +2860,7 @@ test_vltypes_fill_value(void) CHECK(file_id, FAIL, "H5Fopen"); /* Write one element & fill values to datasets with different storage layouts */ - for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; H5_INC_ENUM(H5D_layout_t, layout)) { + for(layout = H5D_COMPACT; layout <= H5D_CHUNKED; layout++) { unsigned compress_loop; /* # of times to run loop, for testing compressed chunked dataset */ unsigned test_loop; /* Loop over datasets */ diff --git a/test/vfd.c b/test/vfd.c index 68fe0bd..76e5f5b 100644 --- a/test/vfd.c +++ b/test/vfd.c @@ -1219,7 +1219,7 @@ test_multi(void) HDmemset(memb_addr, 0, sizeof(memb_addr)); HDmemset(sv, 0, sizeof(sv)); - for(mt=H5FD_MEM_DEFAULT; mt Date: Thu, 9 Jan 2020 03:00:11 -0800 Subject: Fixed bugs in pread/pwrite I/O in VFDs. Fixes HDFFV-10945. --- src/H5FDcore.c | 12 +++++++----- src/H5FDlog.c | 10 ++++++---- src/H5FDsec2.c | 14 ++++++++------ 3 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/H5FDcore.c b/src/H5FDcore.c index 395107e..8403287 100644 --- a/src/H5FDcore.c +++ b/src/H5FDcore.c @@ -337,6 +337,7 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) unsigned char *ptr = file->mem + addr; /* mutable pointer into the * buffer (can't change mem) */ + HDoff_t offset = (HDoff_t)addr; /* Offset to write at */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -353,7 +354,6 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ - HDoff_t offset = (HDoff_t)addr; /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -366,7 +366,8 @@ H5FD__core_write_to_bstore(H5FD_core_t *file, haddr_t addr, size_t size) do { #ifdef H5_HAVE_PREADWRITE bytes_wrote = HDpwrite(file->fd, ptr, bytes_in, offset); - offset += bytes_wrote; + if(bytes_wrote > 0) + offset += bytes_wrote; #else bytes_wrote = HDwrite(file->fd, ptr, bytes_in); #endif /* H5_HAVE_PREADWRITE */ @@ -749,12 +750,12 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr * partial results, and the end of the file. */ - uint8_t *mem = file->mem; /* memory pointer for writes */ + uint8_t *mem = file->mem; /* memory pointer for writes */ + HDoff_t offset = (HDoff_t)0; /* offset for reading */ while(size > 0) { h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ - HDoff_t offset = (HDoff_t)0; /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -767,7 +768,8 @@ H5FD__core_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxaddr do { #ifdef H5_HAVE_PREADWRITE bytes_read = HDpread(file->fd, mem, bytes_in, offset); - offset += bytes_read; + if(bytes_read > 0) + offset += bytes_read; #else bytes_read = HDread(file->fd, mem, bytes_in); #endif /* H5_HAVE_PREADWRITE */ diff --git a/src/H5FDlog.c b/src/H5FDlog.c index 74df95c..75d3d78 100644 --- a/src/H5FDlog.c +++ b/src/H5FDlog.c @@ -1163,6 +1163,7 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd #ifdef H5_HAVE_GETTIMEOFDAY struct timeval timeval_start, timeval_stop; #endif /* H5_HAVE_GETTIMEOFDAY */ + HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1247,7 +1248,6 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ - HDoff_t offset = (HDoff_t)addr; /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -1260,7 +1260,8 @@ H5FD_log_read(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, hadd do { #ifdef H5_HAVE_PREADWRITE bytes_read = HDpread(file->fd, buf, bytes_in, offset); - offset += bytes_read; + if(bytes_read > 0) + offset += bytes_read; #else bytes_read = HDread(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ @@ -1374,6 +1375,7 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had #ifdef H5_HAVE_GETTIMEOFDAY struct timeval timeval_start, timeval_stop; #endif /* H5_HAVE_GETTIMEOFDAY */ + HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -1463,7 +1465,6 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ - HDoff_t offset = (HDoff_t)addr; /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -1476,7 +1477,8 @@ H5FD_log_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, had do { #ifdef H5_HAVE_PREADWRITE bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset); - offset += bytes_wrote; + if(bytes_wrote > 0) + offset += bytes_wrote; #else bytes_wrote = HDwrite(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ diff --git a/src/H5FDsec2.c b/src/H5FDsec2.c index 54f5a95..974a775 100644 --- a/src/H5FDsec2.c +++ b/src/H5FDsec2.c @@ -669,6 +669,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS haddr_t addr, size_t size, void *buf /*out*/) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; + HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -687,7 +688,7 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS if(addr != file->pos || OP_READ != file->op) { if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - } /* end if */ + } #endif /* H5_HAVE_PREADWRITE */ /* Read data, being careful of interrupted system calls, partial results, @@ -697,7 +698,6 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS h5_posix_io_t bytes_in = 0; /* # of bytes to read */ h5_posix_io_ret_t bytes_read = -1; /* # of bytes actually read */ - HDoff_t offset = (HDoff_t)addr; /* Trying to read more bytes than the return type can handle is * undefined behavior in POSIX. @@ -710,7 +710,8 @@ H5FD_sec2_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNUS do { #ifdef H5_HAVE_PREADWRITE bytes_read = HDpread(file->fd, buf, bytes_in, offset); - offset += bytes_read; + if(bytes_read > 0) + offset += bytes_read; #else bytes_read = HDread(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ @@ -773,6 +774,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU haddr_t addr, size_t size, const void *buf) { H5FD_sec2_t *file = (H5FD_sec2_t *)_file; + HDoff_t offset = (HDoff_t)addr; herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_NOAPI_NOINIT @@ -791,7 +793,7 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if(addr != file->pos || OP_WRITE != file->op) { if(HDlseek(file->fd, (HDoff_t)addr, SEEK_SET) < 0) HSYS_GOTO_ERROR(H5E_IO, H5E_SEEKERROR, FAIL, "unable to seek to proper position") - } /* end if */ + } #endif /* H5_HAVE_PREADWRITE */ /* Write the data, being careful of interrupted system calls and partial @@ -801,7 +803,6 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU h5_posix_io_t bytes_in = 0; /* # of bytes to write */ h5_posix_io_ret_t bytes_wrote = -1; /* # of bytes written */ - HDoff_t offset = (HDoff_t)addr; /* Trying to write more bytes than the return type can handle is * undefined behavior in POSIX. @@ -814,7 +815,8 @@ H5FD_sec2_write(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU do { #ifdef H5_HAVE_PREADWRITE bytes_wrote = HDpwrite(file->fd, buf, bytes_in, offset); - offset += bytes_wrote; + if(bytes_wrote > 0) + offset += bytes_wrote; #else bytes_wrote = HDwrite(file->fd, buf, bytes_in); #endif /* H5_HAVE_PREADWRITE */ -- cgit v0.12