From 1ccbdfee589d9f56d71983506313879fa47c4e90 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 21 Jun 2019 10:05:34 -0500 Subject: Add support for GCC 7.x warnings, update warnhist script to account for them, clean up warnings. --- bin/warnhist | 38 +++++++++++++++++++++++--- config/gnu-flags | 50 ++++++++++++++++++++++++++++++++--- fortran/src/H5Fff.F90 | 1 - fortran/src/H5VLff.F90 | 1 - fortran/test/tH5O_F03.F90 | 2 -- hl/fortran/src/H5TBff.F90 | 4 +-- hl/fortran/test/tstimage.F90 | 2 +- hl/fortran/test/tsttable.F90 | 2 +- hl/src/H5LT.c | 19 ++++++------- hl/test/test_ds.c | 2 +- src/H5Clog_trace.c | 2 +- src/H5Dint.c | 1 - src/H5Fint.c | 2 ++ src/H5Fprivate.h | 16 +++++------ src/H5Fsuper.c | 11 +++----- src/H5Gloc.c | 5 +++- src/H5Gname.c | 1 + src/H5Gtest.c | 1 + src/H5I.c | 2 +- src/H5O.c | 1 + src/H5Oflush.c | 1 + src/H5Oint.c | 1 + src/H5Opkg.h | 4 +-- src/H5SM.c | 1 + src/H5Shyper.c | 8 ++++++ src/H5T.c | 1 + src/H5Tnative.c | 12 +++++++++ src/H5VLint.c | 1 + src/H5Zshuffle.c | 14 ++++++++++ src/H5checksum.c | 11 ++++++++ src/H5private.h | 3 +++ src/H5trace.c | 2 +- test/cache_logging.c | 6 ++--- test/cache_tagging.c | 2 +- test/cmpd_dset.c | 2 +- test/direct_chunk.c | 10 +++---- test/dsets.c | 16 ++++++----- test/evict_on_close.c | 6 ++--- test/external_common.h | 5 ---- test/external_env.c | 5 ++++ test/fheap.c | 11 ++++---- test/file_image.c | 2 +- test/flush1.c | 2 +- test/flush2.c | 2 +- test/hyperslab.c | 8 ++---- test/links.c | 2 ++ test/page_buffer.c | 4 +-- test/tattr.c | 2 +- test/tfile.c | 1 + test/th5s.c | 1 + test/tselect.c | 6 ++--- tools/lib/h5diff.c | 1 - tools/lib/h5diff_array.c | 11 ++++---- tools/src/h5repack/h5repack.c | 14 +++++----- tools/src/h5repack/h5repack_copy.c | 30 +++------------------ tools/src/h5repack/h5repack_filters.c | 10 +++---- tools/src/h5stat/h5stat.c | 3 +-- tools/test/h5dump/h5dumpgentest.c | 24 +++++------------ tools/test/h5repack/h5repacktst.c | 12 ++++----- tools/test/perform/chunk_cache.c | 24 ++++++++--------- 60 files changed, 271 insertions(+), 173 deletions(-) diff --git a/bin/warnhist b/bin/warnhist index 6b7ef73..5750c77 100755 --- a/bin/warnhist +++ b/bin/warnhist @@ -155,6 +155,7 @@ while (<>) { my $toss; my $offset; my $warning; + my $extra; # Retain last FORTRAN compile line, which comes a few lines before warning if($_ =~ /.*\.[fF]90:.*/) { @@ -176,12 +177,12 @@ while (<>) { if($_ =~ /^cc1: warning:.*/) { $name = $last_c_name; $line = "??"; - ($toss, $toss, $warning) = split /\:/, $_; + ($toss, $toss, $warning, $extra) = split /\:/, $_; # Check for FORTRAN warning output } elsif($_ =~ /^Warning:.*/) { $name = $last_fort_name; $line = $last_fort_line; - ($toss, $warning) = split /\:/, $_; + ($toss, $warning, $extra) = split /\:/, $_; #print "1:",$.,":",$_; # $_ = <>; #print "2:",$.,":",$_; @@ -203,12 +204,19 @@ while (<>) { } else { # Check for 'character offset' field if($_ =~ /^.*[0-9]+\:[0-9]+\:/) { - ($name, $line, $offset, $toss, $warning) = split /\:/, $_; + ($name, $line, $offset, $toss, $warning, $extra) = split /\:/, $_; } else { - ($name, $line, $toss, $warning) = split /\:/, $_; + ($name, $line, $toss, $warning, $extra) = split /\:/, $_; } } + # Check for extra ':' followed by more text in original warning string, + # and append the ':' and text back onto the parsed warning + # (Use 'length $extra' idiom to avoid warning when $extra is undefined) + if(length $extra ) { + $warning = join ':', $warning, $extra; + } + # Trim leading '..' paths from filename while($name =~ /^\.\.\//) { $name =~ s/^\.\.\///g; @@ -401,6 +409,28 @@ while (<>) { } elsif($warning =~ /function might be candidate for attribute '[A-Za-z_0-9]*' \[-Wsuggest-attribute=[A-Za-z_0-9]*\].*/) { $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; $warning =~ s/=[A-Za-z_0-9]*\]/=-\]/g; + } elsif($warning =~ /passing argument [0-9]+ of '[A-Za-z_0-9]*' makes integer from pointer without a cast \[-Wint-conversion\].*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /function '[A-Za-z_0-9]*' might be a candidate for '[A-Za-z_0-9]*' format attribute \[-Wsuggest-attribute=format\].*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /inlining failed in call to '[A-Za-z_0-9]*': call is unlikely and code size would grow \[-Winline\].*/) { + $warning =~ s/'[A-Za-z_0-9]*'/'-'/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive writing between [0-9]+ and [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-overflow=\].*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive writing between [0-9]+ and [0-9]+ bytes into a region of size between [0-9]+ and [0-9]+ \[-Wformat-overflow=\].*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing between [0-9]+ and [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-truncation=\].*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing up to [0-9]+ bytes into a region of size [0-9]+ \[-Wformat-truncation=\].*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + $warning =~ s/[0-9]+/-/g; + } elsif($warning =~ /'%[0-9]*[\.\*]*[0-9]*[dfsu]' directive output may be truncated writing between [0-9]+ and [0-9]+ bytes into a region of size between [0-9]+ and [0-9]+ \[-Wformat-truncation=\].*/) { + $warning =~ s/'%[0-9]*[\.\*]*[0-9]*[dfsu]'/'-'/g; + $warning =~ s/[0-9]+/-/g; } # Increment count for [generic] warning diff --git a/config/gnu-flags b/config/gnu-flags index 7df72c7..9cdd2bd 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -117,7 +117,7 @@ case "$cc_vendor-$cc_version" in H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wdeclaration-after-statement -Wdisabled-optimization -Wfloat-equal" H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Winit-self -Winvalid-pch -Wmissing-declarations -Wmissing-include-dirs" H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked -Wpointer-arith" - H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-default -Wswitch-enum" + H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wshadow -Wstrict-prototypes -Wswitch-enum -Wswitch-default" H5_CFLAGS="$H5_CFLAGS -Wundef -Wunused-macros -Wunsafe-loop-optimizations -Wwrite-strings" # Production @@ -187,10 +187,54 @@ esac # the information from the previous version and adding modifications to that. case "$cc_vendor-$cc_version" in -# When the gcc 7.x release is out, we should check for additional flags to +# When the gcc 8.x release is out, we should check for additional flags to # include and break it out into it's own section, like the other versions # below. -QAK - gcc-[6789].*) + gcc-[789].*) + # Append warning flags that only gcc 4.2+ knows about + # (none, or incorporated in -Wall / -Wextra now) + + # Append warning flags that only gcc 4.3+ knows about + # + # Technically, variable-length arrays are part of the C99 standard, but + # we should approach them a bit cautiously... -QAK + H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2048 -Wvla" + + # Append warning flags that only gcc 4.4+ knows about + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + + # Append warning flags that only gcc 4.5+ knows about + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" + + # Append warning flags that only gcc 4.6+ knows about + H5_CFLAGS="$H5_CFLAGS -Wdouble-promotion -Wtrampolines" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=const" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=const" + + # Append warning flags that only gcc 4.7+ knows about + H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=pure -Wsuggest-attribute=noreturn" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=pure -Wno-suggest-attribute=noreturn" + + # Append warning flags that only gcc 4.8+ knows about + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" + + # Append warning flags that only gcc 4.9+ knows about + H5_CFLAGS="$H5_CFLAGS -Wdate-time" + + # Append warning flags that only gcc 5.x+ knows about + H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" + + # Append warning flags that only gcc 6.x+ knows about + H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa" + + # Append warning flags that only gcc 7.x+ knows about + 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 -Wnormalized -Wrestrict" + ;; + + gcc-6*) # Append warning flags that only gcc 4.2+ knows about # (none, or incorporated in -Wall / -Wextra now) diff --git a/fortran/src/H5Fff.F90 b/fortran/src/H5Fff.F90 index ac3a1c0..8574c06 100644 --- a/fortran/src/H5Fff.F90 +++ b/fortran/src/H5Fff.F90 @@ -591,7 +591,6 @@ CONTAINS ! is an HDF5 file INTEGER, INTENT(OUT) :: hdferr ! Error code !***** - INTEGER(HID_T) :: access_prp_default CHARACTER(LEN=LEN_TRIM(name)+1,KIND=C_CHAR) :: c_name INTEGER(C_INT) :: flag ! "TRUE/FALSE/ERROR" flag from C routine ! to define status value. diff --git a/fortran/src/H5VLff.F90 b/fortran/src/H5VLff.F90 index 9abc157..e21f38f 100644 --- a/fortran/src/H5VLff.F90 +++ b/fortran/src/H5VLff.F90 @@ -217,7 +217,6 @@ CONTAINS !***** CHARACTER(LEN=1,KIND=C_CHAR), DIMENSION(1:LEN(name)+1), TARGET :: c_name INTEGER(SIZE_T) :: l - TYPE(C_PTR) :: f_ptr INTERFACE INTEGER(SIZE_T) FUNCTION H5VLget_connector_name(obj_id, name, size) BIND(C,NAME='H5VLget_connector_name') diff --git a/fortran/test/tH5O_F03.F90 b/fortran/test/tH5O_F03.F90 index d1a9ddb..78b6453 100644 --- a/fortran/test/tH5O_F03.F90 +++ b/fortran/test/tH5O_F03.F90 @@ -270,8 +270,6 @@ CONTAINS ! A(8) = tm_yday int days since January 1 0-365 ! A(9) = tm_isdst int Daylight Saving Time flag ! - INTEGER(C_INT), DIMENSION(:), POINTER :: c_atime, c_btime, c_ctime, c_mtime - INTEGER(C_INT), DIMENSION(1:8) :: atime, btime, ctime, mtime INTEGER :: len, i INTEGER :: idx INTEGER :: ierr diff --git a/hl/fortran/src/H5TBff.F90 b/hl/fortran/src/H5TBff.F90 index d18d023..40adf95 100644 --- a/hl/fortran/src/H5TBff.F90 +++ b/hl/fortran/src/H5TBff.F90 @@ -939,10 +939,10 @@ CONTAINS INTEGER(size_t), DIMENSION(nfields), INTENT(inout) :: field_offsets ! field offsets INTEGER(size_t), INTENT(inout):: type_size ! type size INTEGER :: errcode ! error code - INTEGER, OPTIONAL :: maxlen_out ! maximum character len of the field names + INTEGER(size_t), OPTIONAL :: maxlen_out ! maximum character len of the field names INTEGER(size_t) :: namelen ! name length INTEGER(size_t), DIMENSION(nfields) :: namelen2 ! name lengths - INTEGER(hsize_t) :: i ! general purpose integer + INTEGER(hsize_t) :: i ! general purpose integer INTEGER(size_t) :: maxlen INTEGER(size_t) :: c_maxlen_out diff --git a/hl/fortran/test/tstimage.F90 b/hl/fortran/test/tstimage.F90 index d6bd1e2..8586e68 100644 --- a/hl/fortran/test/tstimage.F90 +++ b/hl/fortran/test/tstimage.F90 @@ -62,7 +62,7 @@ character(len=4), parameter :: dsetname2 = "img2" ! dataset name character(len=15), parameter :: il ="INTERLACE_PIXEL"! dataset name integer(hid_t) :: file_id ! file identifier integer(hsize_t), parameter :: width = 500 ! width of image -integer(hsize_t), parameter :: height = 200 ! height of image +integer(hsize_t), parameter :: height = 270 ! height of image integer, parameter :: pal_entries = 9 ! palette number of entries integer, dimension(width*height) :: buf1 ! data buffer integer, dimension(width*height) :: bufr1 ! data buffer diff --git a/hl/fortran/test/tsttable.F90 b/hl/fortran/test/tsttable.F90 index 38cfa86..840d33d 100644 --- a/hl/fortran/test/tsttable.F90 +++ b/hl/fortran/test/tsttable.F90 @@ -93,7 +93,7 @@ SUBROUTINE test_table1() INTEGER(SIZE_T), DIMENSION(1:nfields) :: field_offsetr ! field offset INTEGER(SIZE_T), DIMENSION(1:nfields) :: field_sizesr ! field sizes INTEGER(SIZE_T) :: type_sizeout = 0 ! size of the datatype - INTEGER :: maxlen = 0 ! max chararter length of a field name + INTEGER(SIZE_T) :: maxlen = 0 ! max character length of a field name INTEGER :: Cs_sizeof_double = H5_SIZEOF_DOUBLE ! C's sizeof double INTEGER :: SIZEOF_X LOGICAL :: Exclude_double diff --git a/hl/src/H5LT.c b/hl/src/H5LT.c index 0074d02..3ebca95 100644 --- a/hl/src/H5LT.c +++ b/hl/src/H5LT.c @@ -2264,7 +2264,7 @@ out: *------------------------------------------------------------------------- */ static char* -realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, char *str_to_add) +realloc_and_append(hbool_t _no_user_buf, size_t *len, char *buf, const char *str_to_add) { size_t size_str_to_add, size_str; @@ -2360,7 +2360,6 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) { char **name = NULL; /*member names */ unsigned char *value = NULL; /*value array */ - unsigned char *copy = NULL; /*a pointer to value array */ int nmembs; /*number of members */ char tmp_str[TMP_LEN]; int nchars; /*number of output characters */ @@ -2418,17 +2417,15 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) nchars = HDsnprintf(tmp_str, TMP_LEN, "\"%s\"", name[i]); if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; - HDsnprintf(tmp_str, TMP_LEN, "%*s ", MAX(0, 16 - nchars), ""); + HDmemset(tmp_str, ' ', (size_t)MAX(3, 19 - nchars) + 1); + tmp_str[MAX(3, 19 - nchars)] = '\0'; if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; - /*On SGI Altix(cobalt), wrong values were printed out with "value+i*dst_size" - *strangely, unless use another pointer "copy".*/ - copy = value + (size_t)i * dst_size; if (H5T_SGN_NONE == H5Tget_sign(native)) - HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)((void *)copy))); + HDsnprintf(tmp_str, TMP_LEN, "%u", *((unsigned int*)(value + (size_t)i * dst_size))); else - HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)((void *)copy))); + HDsnprintf(tmp_str, TMP_LEN, "%d", *((int*)(value + (size_t)i * dst_size))); if(!(str = realloc_and_append(no_ubuf, str_len, str, tmp_str))) goto out; @@ -2450,8 +2447,12 @@ print_enum(hid_t type, char* str, size_t *str_len, hbool_t no_ubuf, size_t indt) out: if(0 == nmembs) { - HDsnprintf(tmp_str, TMP_LEN, "\n%*s ", (int)(indt + 4), ""); + str = realloc_and_append(no_ubuf, str_len, str, "\n"); + HDassert((indt + 4) < TMP_LEN); + HDmemset(tmp_str, ' ', (indt + 4) + 1); + tmp_str[(indt + 4)] = '\0'; str = realloc_and_append(no_ubuf, str_len, str, tmp_str); + str = realloc_and_append(no_ubuf, str_len, str, " "); } /* end if */ /* Release resources */ diff --git a/hl/test/test_ds.c b/hl/test/test_ds.c index 95178fc..d7af9e9 100644 --- a/hl/test/test_ds.c +++ b/hl/test/test_ds.c @@ -1138,7 +1138,7 @@ static int test_detachscales(void) int rank3 = 3; hsize_t dims[] = {1,2,3}; /*some bogus numbers, not important for the test*/ int *buf = NULL; - char dname[10]; + char dname[16]; int i; /* This tests creates two three dimensional datasets; then it creates diff --git a/src/H5Clog_trace.c b/src/H5Clog_trace.c index 7c1305c..713f333 100644 --- a/src/H5Clog_trace.c +++ b/src/H5Clog_trace.c @@ -41,7 +41,7 @@ /****************/ /* Max log message size */ -#define H5C_MAX_TRACE_LOG_MSG_SIZE 2048 +#define H5C_MAX_TRACE_LOG_MSG_SIZE 4096 /******************/ diff --git a/src/H5Dint.c b/src/H5Dint.c index 220f026..63d1160 100644 --- a/src/H5Dint.c +++ b/src/H5Dint.c @@ -1095,7 +1095,6 @@ H5D__build_file_prefix(const H5D_t *dset, H5F_prefix_open_t prefix_type, char ** size_t filepath_len; /* length of file path */ size_t prefix_len; /* length of prefix */ size_t file_prefix_len; /* length of expanded prefix */ - H5P_genplist_t *plist = NULL; /* Property list pointer */ herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_STATIC diff --git a/src/H5Fint.c b/src/H5Fint.c index ee9afed..030fda8 100644 --- a/src/H5Fint.c +++ b/src/H5Fint.c @@ -509,6 +509,7 @@ H5F__get_objects_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5_ITER_ERROR, "unknown or invalid data object") @@ -3610,6 +3611,7 @@ H5F__get_file(void *obj, H5I_type_t type) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "not a file or file object") diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h index 0fa2214..e9b6c32 100644 --- a/src/H5Fprivate.h +++ b/src/H5Fprivate.h @@ -160,16 +160,16 @@ typedef struct H5F_t H5F_t; (i) |= (uint16_t)((*(p) & 0xff) << 8); (p)++; \ } -# define INT32DECODE(p, i) { \ - (i) = ((int32_t)(*(p) & (unsigned)0xff)); (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 8); (p)++; \ - (i) |= ((int32_t)(*(p) & (unsigned)0xff) << 16); (p)++; \ - (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \ - ((*(p) & (unsigned)0x80) ? (unsigned)(~0xffffffff) : (unsigned)0x0))); (p)++; \ +# define INT32DECODE(p, i) { \ + (i) = ((int32_t)(*(p) & 0xff)); (p)++; \ + (i) |= ((int32_t)(*(p) & 0xff) << 8); (p)++; \ + (i) |= ((int32_t)(*(p) & 0xff) << 16); (p)++; \ + (i) |= ((int32_t)(((*(p) & (unsigned)0xff) << 24) | \ + ((*(p) & 0x80) ? ~0xffffffffULL : 0x0ULL))); (p)++; \ } -# define UINT32DECODE(p, i) { \ - (i) = (uint32_t)(*(p) & 0xff); (p)++; \ +# define UINT32DECODE(p, i) { \ + (i) = (uint32_t)(*(p) & 0xff); (p)++; \ (i) |= ((uint32_t)(*(p) & 0xff) << 8); (p)++; \ (i) |= ((uint32_t)(*(p) & 0xff) << 16); (p)++; \ (i) |= ((uint32_t)(*(p) & 0xff) << 24); (p)++; \ diff --git a/src/H5Fsuper.c b/src/H5Fsuper.c index aa5a85d..ef52844 100644 --- a/src/H5Fsuper.c +++ b/src/H5Fsuper.c @@ -513,15 +513,12 @@ H5F__super_read(H5F_t *f, H5P_genplist_t *fa_plist, hbool_t initial_read) #endif /* H5_HAVE_PARALLEL */ /* Check if superblock address is different from base address and adjust - * base address and "end of address" address if so. + * base address and "end of file" address if so. */ if(!H5F_addr_eq(super_addr, sblock->base_addr)) { - /* Check if the superblock moved earlier in the file */ - if(H5F_addr_lt(super_addr, sblock->base_addr)) - udata.stored_eof -= (sblock->base_addr - super_addr); - else - /* The superblock moved later in the file */ - udata.stored_eof += (super_addr - sblock->base_addr); + /* If the superblock moved in the file, adjust the EOF */ + /* (Handles moving earlier & later) */ + udata.stored_eof -= (sblock->base_addr - super_addr); /* Adjust base address for offsets of the HDF5 data in the file */ sblock->base_addr = super_addr; diff --git a/src/H5Gloc.c b/src/H5Gloc.c index 5724031..e47d3be 100644 --- a/src/H5Gloc.c +++ b/src/H5Gloc.c @@ -226,7 +226,10 @@ H5G_loc_real(void *obj, H5I_type_t type, H5G_loc_t *loc) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual file driver (VFD)") case H5I_VOL: - HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual object layer (VOL) driver") + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a virtual object layer (VOL) connector") + + case H5I_SPACE_SEL_ITER: + HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "unable to get group location of a dataspace selection iterator") case H5I_UNINIT: case H5I_BADID: diff --git a/src/H5Gname.c b/src/H5Gname.c index fa0a925..16c1ca7 100644 --- a/src/H5Gname.c +++ b/src/H5Gname.c @@ -828,6 +828,7 @@ H5G_name_replace_cb(void *obj_ptr, hid_t obj_id, void *key) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object") diff --git a/src/H5Gtest.c b/src/H5Gtest.c index af6acb3..0b431b1 100644 --- a/src/H5Gtest.c +++ b/src/H5Gtest.c @@ -616,6 +616,7 @@ H5G__user_path_test(hid_t obj_id, char *user_path, size_t *user_path_len, unsign case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "unknown data object type") diff --git a/src/H5I.c b/src/H5I.c index 87ff04a..cdc849b 100644 --- a/src/H5I.c +++ b/src/H5I.c @@ -2171,7 +2171,6 @@ H5Iget_name(hid_t id, char *name/*out*/, size_t size) { H5VL_object_t *vol_obj; /* Object token of loc_id */ H5VL_loc_params_t loc_params; - H5G_loc_t loc; /* Object location */ ssize_t ret_value; /* Return value */ FUNC_ENTER_API((-1)) @@ -2384,6 +2383,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: break; /* Other types of IDs are not stored in files */ diff --git a/src/H5O.c b/src/H5O.c index 0fdb9be..093d429 100644 --- a/src/H5O.c +++ b/src/H5O.c @@ -1102,6 +1102,7 @@ H5Oclose(hid_t object_id) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_CANTRELEASE, FAIL, "not a valid file object ID (dataset, group, or datatype)") diff --git a/src/H5Oflush.c b/src/H5Oflush.c index da9d1d0..f5ede4a 100644 --- a/src/H5Oflush.c +++ b/src/H5Oflush.c @@ -491,6 +491,7 @@ H5O_refresh_metadata_reopen(hid_t oid, H5G_loc_t *obj_loc, H5VL_t *vol_connector case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, FAIL, "not a valid file object ID (dataset, group, or datatype)") diff --git a/src/H5Oint.c b/src/H5Oint.c index 60aae45..45a8046 100644 --- a/src/H5Oint.c +++ b/src/H5Oint.c @@ -1848,6 +1848,7 @@ H5O_get_loc(hid_t object_id) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_OHDR, H5E_BADTYPE, NULL, "invalid object type") diff --git a/src/H5Opkg.h b/src/H5Opkg.h index 668f4f0..4afa452 100644 --- a/src/H5Opkg.h +++ b/src/H5Opkg.h @@ -134,9 +134,9 @@ ) : 0)) \ ) #define H5O_SIZEOF_MSGHDR_OH(O) \ - H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) + (unsigned)H5O_SIZEOF_MSGHDR_VERS((O)->version, (O)->flags & H5O_HDR_ATTR_CRT_ORDER_TRACKED) #define H5O_SIZEOF_MSGHDR_F(F, C) \ - H5O_SIZEOF_MSGHDR_VERS(MAX((H5F_STORE_MSG_CRT_IDX(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), (C)) + (unsigned)H5O_SIZEOF_MSGHDR_VERS(MAX((H5F_STORE_MSG_CRT_IDX(F) ? H5O_VERSION_LATEST : H5O_VERSION_1), (uint8_t)H5O_obj_ver_bounds[H5F_LOW_BOUND(F)]), (C)) /* * Size of chunk "header" for each chunk diff --git a/src/H5SM.c b/src/H5SM.c index 3946f51..290e575 100644 --- a/src/H5SM.c +++ b/src/H5SM.c @@ -274,6 +274,7 @@ H5SM__type_to_flag(unsigned type_id, unsigned *type_flag) case H5O_FILL_ID: type_id = H5O_FILL_NEW_ID; /* Fall through... */ + H5_ATTR_FALLTHROUGH case H5O_SDSPACE_ID: case H5O_DTYPE_ID: diff --git a/src/H5Shyper.c b/src/H5Shyper.c index 4c8e458..2acc135 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -2142,18 +2142,25 @@ loc += fast_dim_buf_off; do { DUFF_GUTS + H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS } while (--duffs_index > 0); @@ -10013,6 +10020,7 @@ H5S_select_hyperslab(H5S_t *space, H5S_seloper_t op, const hsize_t start[], if(op == H5S_SELECT_SET) /* Allow only "set" operation to proceed */ break; /* Else fall through to error */ + H5_ATTR_FALLTHROUGH case H5S_SEL_ERROR: case H5S_SEL_N: diff --git a/src/H5T.c b/src/H5T.c index 8c8a9b7..3098325 100644 --- a/src/H5T.c +++ b/src/H5T.c @@ -1738,6 +1738,7 @@ H5Tcopy(hid_t type_id) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, H5I_INVALID_HID, "not a datatype or dataset") diff --git a/src/H5Tnative.c b/src/H5Tnative.c index 3554f75..f40d81b 100644 --- a/src/H5Tnative.c +++ b/src/H5Tnative.c @@ -551,6 +551,9 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, FUNC_ENTER_STATIC if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" if(prec <= H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_SCHAR_g))) { match = H5T_NATIVE_INT_MATCH_CHAR; native_size = sizeof(char); @@ -570,6 +573,7 @@ H5T__get_native_integer(size_t prec, H5T_sign_t sign, H5T_direction_t direction, match = H5T_NATIVE_INT_MATCH_LLONG; native_size = sizeof(long long); } +#pragma GCC diagnostic pop } else if(direction == H5T_DIR_DESCEND) { if(prec > H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_LONG_g))) { match = H5T_NATIVE_INT_MATCH_LLONG; @@ -694,6 +698,9 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali HDassert(size>0); if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" if(size<=sizeof(float)) { match=H5T_NATIVE_FLOAT_MATCH_FLOAT; native_size = sizeof(float); @@ -717,6 +724,7 @@ H5T__get_native_float(size_t size, H5T_direction_t direction, size_t *struct_ali native_size = sizeof(double); #endif } +#pragma GCC diagnostic pop } else { #if H5_SIZEOF_LONG_DOUBLE !=0 if(size>sizeof(double)) { @@ -810,6 +818,9 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, FUNC_ENTER_STATIC if(direction == H5T_DIR_DEFAULT || direction == H5T_DIR_ASCEND) { +/* Disable warning for intentional identical branches here -QAK */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wduplicated-branches" if(prec<=H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B8_g))) { tid = H5T_NATIVE_B8; native_size = 1; @@ -831,6 +842,7 @@ H5T__get_native_bitfield(size_t prec, H5T_direction_t direction, native_size = 8; align = H5T_NATIVE_UINT64_ALIGN_g; } +#pragma GCC diagnostic pop } else if(direction == H5T_DIR_DESCEND) { if(prec>H5T_get_precision((H5T_t *)H5I_object(H5T_NATIVE_B32_g))) { tid = H5T_NATIVE_B64; diff --git a/src/H5VLint.c b/src/H5VLint.c index 1b735f5..884b2f6 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -1437,6 +1437,7 @@ H5VL__object(hid_t id, H5I_type_t obj_type) case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "unknown data object type") diff --git a/src/H5Zshuffle.c b/src/H5Zshuffle.c index e70ef33..b1d0722 100644 --- a/src/H5Zshuffle.c +++ b/src/H5Zshuffle.c @@ -185,18 +185,25 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], do { DUFF_GUTS + H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS } while (--duffs_index > 0); @@ -243,18 +250,25 @@ H5Z_filter_shuffle(unsigned flags, size_t cd_nelmts, const unsigned cd_values[], do { DUFF_GUTS + H5_ATTR_FALLTHROUGH case 7: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 6: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 5: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 4: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 3: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 2: DUFF_GUTS + H5_ATTR_FALLTHROUGH case 1: DUFF_GUTS } while (--duffs_index > 0); diff --git a/src/H5checksum.c b/src/H5checksum.c index 64d527e..4e98976 100644 --- a/src/H5checksum.c +++ b/src/H5checksum.c @@ -407,16 +407,27 @@ H5_checksum_lookup3(const void *key, size_t length, uint32_t initval) switch(length) /* all the case statements fall through */ { case 12: c+=((uint32_t)k[11])<<24; + H5_ATTR_FALLTHROUGH case 11: c+=((uint32_t)k[10])<<16; + H5_ATTR_FALLTHROUGH case 10: c+=((uint32_t)k[9])<<8; + H5_ATTR_FALLTHROUGH case 9 : c+=k[8]; + H5_ATTR_FALLTHROUGH case 8 : b+=((uint32_t)k[7])<<24; + H5_ATTR_FALLTHROUGH case 7 : b+=((uint32_t)k[6])<<16; + H5_ATTR_FALLTHROUGH case 6 : b+=((uint32_t)k[5])<<8; + H5_ATTR_FALLTHROUGH case 5 : b+=k[4]; + H5_ATTR_FALLTHROUGH case 4 : a+=((uint32_t)k[3])<<24; + H5_ATTR_FALLTHROUGH case 3 : a+=((uint32_t)k[2])<<16; + H5_ATTR_FALLTHROUGH case 2 : a+=((uint32_t)k[1])<<8; + H5_ATTR_FALLTHROUGH case 1 : a+=k[0]; break; case 0 : goto done; diff --git a/src/H5private.h b/src/H5private.h index dad2d94..86cd615 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -309,6 +309,7 @@ # define H5_ATTR_NORETURN /*void*/ # define H5_ATTR_CONST /*void*/ # define H5_ATTR_PURE /*void*/ +# define H5_ATTR_FALLTHROUGH /*void*/ #else /* __cplusplus */ #if defined(H5_HAVE_ATTRIBUTE) && !defined(__SUNPRO_C) # define H5_ATTR_FORMAT(X,Y,Z) __attribute__((format(X, Y, Z))) @@ -316,12 +317,14 @@ # define H5_ATTR_NORETURN __attribute__((noreturn)) # define H5_ATTR_CONST __attribute__((const)) # define H5_ATTR_PURE __attribute__((pure)) +# define H5_ATTR_FALLTHROUGH __attribute__((fallthrough)); #else # define H5_ATTR_FORMAT(X,Y,Z) /*void*/ # define H5_ATTR_UNUSED /*void*/ # define H5_ATTR_NORETURN /*void*/ # define H5_ATTR_CONST /*void*/ # define H5_ATTR_PURE /*void*/ +# define H5_ATTR_FALLTHROUGH /*void*/ #endif #endif /* __cplusplus */ diff --git a/src/H5trace.c b/src/H5trace.c index 9c858fc..c5d14f5 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -173,7 +173,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) if(current_depth < last_call_depth) { /* We are at the beginning of a line */ if(H5_debug_g.ttimes) { - char tmp[128]; + char tmp[320]; HDsprintf(tmp, "%.6f", event_time.etime-first_time.etime); HDfprintf(out, " %*s ", (int)HDstrlen(tmp), ""); diff --git a/test/cache_logging.c b/test/cache_logging.c index 6fd48d8..c43609b 100644 --- a/test/cache_logging.c +++ b/test/cache_logging.c @@ -43,7 +43,7 @@ test_logging_api(void) hid_t fid = -1; hid_t gid = -1; hbool_t is_currently_logging; - char group_name[8]; + char group_name[12]; char filename[1024]; int i; @@ -111,8 +111,8 @@ test_logging_api(void) /* Perform some manipulations */ for(i = 0; i < N_GROUPS; i++) { - HDmemset(group_name, 0, 8); - HDsnprintf(group_name, 8, "%d", i); + HDmemset(group_name, 0, sizeof(group_name)); + HDsnprintf(group_name, sizeof(group_name), "%d", i); if((gid = H5Gcreate2(fid, group_name, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT)) < 0) TEST_ERROR; if(H5Gclose(gid) < 0) diff --git a/test/cache_tagging.c b/test/cache_tagging.c index e03defa..734c760 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -741,7 +741,7 @@ check_multi_group_creation_tags(void) hid_t fid = -1; /* File Identifier */ hid_t gid = -1; /* Group Identifier */ int verbose = FALSE; /* verbose file outout */ - char gname[10]; /* group name buffer */ + char gname[16]; /* group name buffer */ int i = 0; /* iterator */ hid_t fapl = -1; /* File access prop list */ haddr_t g_tag = 0; /* Group tag value */ diff --git a/test/cmpd_dset.c b/test/cmpd_dset.c index a8baeac..1944ce1 100644 --- a/test/cmpd_dset.c +++ b/test/cmpd_dset.c @@ -1808,7 +1808,7 @@ test_pack_ooo(void) unsigned free_order[PACK_NMEMBS]; /* Index of remaining free slots in order */ unsigned num_free; /* Number of free slots in order */ unsigned sub_cmpd_order; /* Order to insert the inner compound */ - char name[6]; /* Member name */ + char name[16]; /* Member name */ unsigned extra_space; /* Whether to add extra space to the end of * the compound */ unsigned i, j; /* Indices */ diff --git a/test/direct_chunk.c b/test/direct_chunk.c index 8de923e..9ea814c 100644 --- a/test/direct_chunk.c +++ b/test/direct_chunk.c @@ -2008,11 +2008,11 @@ error: static int test_single_chunk(unsigned config) { - hid_t fid; /* File ID */ - hid_t fapl; /* File access property list ID */ - hid_t sid; /* Dataspace ID */ - hid_t did; /* Dataset ID */ - hid_t dcpl; /* Dataset creation property list */ + hid_t fid = H5I_INVALID_HID; /* File ID */ + hid_t fapl = H5I_INVALID_HID; /* File access property list ID */ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hid_t did = H5I_INVALID_HID; /* Dataset ID */ + hid_t dcpl = H5I_INVALID_HID; /* Dataset creation property list */ hsize_t dims[2] = {DIM0, DIM1}; /* Dimension sizes */ hsize_t chunk[2] = {CHUNK0, CHUNK1}; /* Chunk dimension sizes */ hsize_t offset[2] = {0,0}; /* Offset for writing */ diff --git a/test/dsets.c b/test/dsets.c index a317f14..603f785 100644 --- a/test/dsets.c +++ b/test/dsets.c @@ -1233,14 +1233,19 @@ test_conv_buffer(hid_t fid) CmpField *cf = NULL; CmpFieldR *cfrR = NULL; - hid_t dataset = -1; /* dataset ID */ - hid_t space = -1; /* data space ID */ - hid_t ctype1, ctype2; /* data type ID */ - hid_t arr_type1, arr_type2, arr_type3, arr_type4, arr_type5; + hid_t dataset = H5I_INVALID_HID; /* dataset ID */ + hid_t space = H5I_INVALID_HID; /* data space ID */ + hid_t ctype1 = H5I_INVALID_HID, + ctype2 = H5I_INVALID_HID; /* data type ID */ + hid_t arr_type1 = H5I_INVALID_HID, + arr_type2 = H5I_INVALID_HID, + arr_type3 = H5I_INVALID_HID, + arr_type4 = H5I_INVALID_HID, + arr_type5 = H5I_INVALID_HID; hsize_t dimsa[3]; hsize_t dimsb[1]; hsize_t dimsc[1]; - hid_t xfer_list; + hid_t xfer_list = H5I_INVALID_HID; size_t size; TESTING("data type conversion buffer size"); @@ -12920,7 +12925,6 @@ test_versionbounds(void) hid_t vspace = -1; /* Virtual dset dataspaces */ hid_t srcdset = -1; /* Source datset */ hid_t vdset = -1; /* Virtual dataset */ - hid_t null_dspace = -1; /* Data space of H5S_NULL */ hsize_t dims[1] = {3}; /* Data space current size */ char srcfilename[FILENAME_BUF_SIZE]; char vfilename1[FILENAME_BUF_SIZE]; diff --git a/test/evict_on_close.c b/test/evict_on_close.c index 9918829..b7d30a9 100644 --- a/test/evict_on_close.c +++ b/test/evict_on_close.c @@ -73,7 +73,7 @@ const char *FILENAMES[] = { #define SUBGROUP_NAME_SIZE 16 /* Prototypes */ -static hbool_t verify_tag_not_in_cache(H5F_t *f, haddr_t tag); +static hbool_t verify_tag_not_in_cache(const H5F_t *f, haddr_t tag); static herr_t check_evict_on_close_api(void); static hid_t generate_eoc_test_file(hid_t fapl_id); static herr_t check_dset_scheme(hid_t fid, const char *dset_name); @@ -90,8 +90,8 @@ static herr_t check_group_layout(hid_t fid, const char *group_name); * *------------------------------------------------------------------------- */ -static hbool_t -verify_tag_not_in_cache(H5F_t *f, haddr_t tag) +static H5_ATTR_PURE hbool_t +verify_tag_not_in_cache(const H5F_t *f, haddr_t tag) { H5C_t *cache_ptr = NULL; /* cache pointer */ int i = 0; /* iterator */ diff --git a/test/external_common.h b/test/external_common.h index cc2b5fb..1e4fe7a 100644 --- a/test/external_common.h +++ b/test/external_common.h @@ -33,11 +33,6 @@ static const char *EXT_FNAME[] = { NULL }; -static const char *EXT_ENV_FNAME[] = { - "extern_env_dir/env_file_1", - NULL -}; - /* A similar collection of files is used for the tests that * perform file I/O. */ diff --git a/test/external_env.c b/test/external_env.c index 55f68be..1bf0cf0 100644 --- a/test/external_env.c +++ b/test/external_env.c @@ -16,6 +16,11 @@ */ #include "external_common.h" +static const char *EXT_ENV_FNAME[] = { + "extern_env_dir/env_file_1", + NULL +}; + /*------------------------------------------------------------------------- * Function: test_path_env diff --git a/test/fheap.c b/test/fheap.c index c7f6ff0..846f03e 100644 --- a/test/fheap.c +++ b/test/fheap.c @@ -7599,7 +7599,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ unsigned char heap_id[100][MAX_HEAP_ID_LEN]; /* Heap ID for object inserted */ struct a_type_t1 { char a[10]; - char b[29]; + char b[40]; } obj1, obj2; /* Objects to insert/remove */ size_t id_len; /* Size of fractal heap IDs */ fheap_heap_state_t state; /* State of fractal heap */ @@ -7640,14 +7640,14 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ */ TESTING("incremental object insertion and removal") + HDmemset(&obj1, 0, sizeof(obj1)); + HDmemset(&obj2, 0, sizeof(obj2)); for(i = 0; i < 100; i++) { - HDsprintf(obj1.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i); - for(j = 0; j < i; j++) { - HDsprintf(obj2.b, "%s%d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j); - if(H5HF_remove(fh, heap_id[j]) < 0) FAIL_STACK_ERROR + + HDsprintf(obj2.b, "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", j); if(H5HF_insert(fh, (sizeof(obj2)), &obj2, heap_id[j]) < 0) FAIL_STACK_ERROR } /* end for */ @@ -7658,6 +7658,7 @@ test_man_incr_insert_remove(hid_t fapl, H5HF_create_t *cparam, fheap_test_param_ /* Insert object */ HDmemset(heap_id[i], 0, id_len); + HDsprintf(obj1.b, "%s%2d", "ABCDEFGHIJKLMNOPQRSTUVWXYZ", i); if(H5HF_insert(fh, (sizeof(obj1)), &obj1, heap_id[i]) < 0) FAIL_STACK_ERROR } /* end for */ diff --git a/test/file_image.c b/test/file_image.c index 0dba236..86dd13e 100644 --- a/test/file_image.c +++ b/test/file_image.c @@ -580,7 +580,7 @@ test_core(void) file = H5Fopen(copied_filename, H5F_ACC_RDONLY, fapl); VERIFY(file >= 0, "H5Fopen failed"); VERIFY((udata->used_callbacks == MALLOC) || - (udata->used_callbacks == MALLOC | UDATA_COPY | UDATA_FREE), "opening a core file used the wrong callbacks"); + (udata->used_callbacks == (MALLOC | UDATA_COPY | UDATA_FREE)), "opening a core file used the wrong callbacks"); VERIFY(udata->malloc_src == H5FD_FILE_IMAGE_OP_FILE_OPEN, "Malloc callback came from wrong sourc in core open"); /* Close file */ diff --git a/test/flush1.c b/test/flush1.c index fefa8d0..ac5f9ef 100644 --- a/test/flush1.c +++ b/test/flush1.c @@ -73,7 +73,7 @@ create_file(const char *filename, hid_t fapl_id, hbool_t swmr) hid_t fid = -1; /* file ID */ hid_t top_gid = -1; /* containing group ID */ hid_t gid = -1; /* subgroup ID */ - char group_name[16]; /* group name */ + char group_name[32]; /* group name */ unsigned flags; /* file open flags */ int i; /* iterator */ diff --git a/test/flush2.c b/test/flush2.c index 6e8aee7..8ebfb75 100644 --- a/test/flush2.c +++ b/test/flush2.c @@ -135,7 +135,7 @@ file_ok(const char *filename, hid_t fapl_id, hbool_t check_second_dset) hid_t fid = -1; /* file ID */ hid_t top_gid = -1; /* containing group ID */ hid_t gid = -1; /* subgroup ID */ - char group_name[16]; /* group name */ + char group_name[32]; /* group name */ int i; /* iterator */ /* open file */ diff --git a/test/hyperslab.c b/test/hyperslab.c index feb96bd..d8c00c9 100644 --- a/test/hyperslab.c +++ b/test/hyperslab.c @@ -819,12 +819,8 @@ test_transpose(size_t nx, size_t ny) dst_stride[1] = (hsize_t)(nx * sizeof(*src)); /* Copy and transpose */ - if(nx == ny) - H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst, - src_stride, src); - else - H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst, - src_stride, src); + H5VM_stride_copy(2, (hsize_t)sizeof(*src), size, dst_stride, dst, + src_stride, src); /* Check */ for(i = 0; i < nx; i++) { diff --git a/test/links.c b/test/links.c index 520f784..3166954 100644 --- a/test/links.c +++ b/test/links.c @@ -7759,6 +7759,7 @@ done: case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: return -1; @@ -7847,6 +7848,7 @@ done: case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: return -1; diff --git a/test/page_buffer.c b/test/page_buffer.c index b9b31f8..e11a6d6 100644 --- a/test/page_buffer.c +++ b/test/page_buffer.c @@ -98,7 +98,7 @@ create_file(char *filename, hid_t fcpl, hid_t fapl) int i; int num_elements; int j; - char dset_name[10]; + char dset_name[32]; if((file_id = H5Fcreate(filename, H5F_ACC_TRUNC, fcpl, fapl)) < 0) FAIL_STACK_ERROR; @@ -235,7 +235,7 @@ open_file(char *filename, hid_t fapl, hsize_t page_size, int i; int j; int num_elements; - char dset_name[10]; + char dset_name[32]; H5F_t *f = NULL; if((file_id = H5Fopen(filename, H5F_ACC_RDONLY, fapl)) < 0) diff --git a/test/tattr.c b/test/tattr.c index b83ed9f..c7a2c23 100644 --- a/test/tattr.c +++ b/test/tattr.c @@ -10065,7 +10065,7 @@ test_attr_bug2(hid_t fcpl, hid_t fapl) hid_t tid; /* Datatype ID */ hid_t gcpl; /* Group creation property list */ hsize_t dims[2] = {10, 100}; /* Attribute dimensions */ - char aname[4]; /* Attribute name */ + char aname[16]; /* Attribute name */ unsigned i; /* index */ herr_t ret; /* Generic return status */ htri_t tri_ret; /* htri_t return status */ diff --git a/test/tfile.c b/test/tfile.c index 140bd14..c15064a 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1446,6 +1446,7 @@ test_obj_count_and_id(hid_t fid1, hid_t fid2, hid_t did, hid_t gid1, case H5I_ERROR_CLASS: case H5I_ERROR_MSG: case H5I_ERROR_STACK: + case H5I_SPACE_SEL_ITER: case H5I_NTYPES: default: ERROR("H5Fget_obj_ids"); diff --git a/test/th5s.c b/test/th5s.c index 6632a4c..c5dfa97 100644 --- a/test/th5s.c +++ b/test/th5s.c @@ -30,6 +30,7 @@ * This file also needs to access the dataspace testing code. */ #define H5S_FRIEND /*suppress error about including H5Spkg */ +#define H5S_TESTING /*suppress warning about H5S testing funcs*/ #include "H5Spkg.h" /* Dataspaces */ /* diff --git a/test/tselect.c b/test/tselect.c index d912df5..ad435cb 100644 --- a/test/tselect.c +++ b/test/tselect.c @@ -10546,7 +10546,7 @@ test_shape_same_dr__full_space_vs_slice(int test_num, hbool_t expected_result) { char test_desc_0[128]; - char test_desc_1[128]; + char test_desc_1[256]; int i; hid_t n_cube_0_sid; /* the fully selected hyper cube */ hid_t n_cube_1_sid; /* the hyper cube in which a slice is selected */ @@ -10831,7 +10831,7 @@ test_shape_same_dr__checkerboard(int test_num, hbool_t expected_result) { char test_desc_0[128]; - char test_desc_1[128]; + char test_desc_1[256]; int i; int dims_selected = 0; hid_t n_cube_0_sid; /* the checker board selected @@ -11443,7 +11443,7 @@ test_shape_same_dr__irregular(int test_num, hbool_t expected_result) { char test_desc_0[128]; - char test_desc_1[128]; + char test_desc_1[256]; int edge_size = 10; int i; int j; diff --git a/tools/lib/h5diff.c b/tools/lib/h5diff.c index 594bf51..3ee5393 100644 --- a/tools/lib/h5diff.c +++ b/tools/lib/h5diff.c @@ -1344,7 +1344,6 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1, } #endif /* H5_HAVE_PARALLEL */ -out: opts->err_stat = opts->err_stat | ret_value; /* free table */ diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c index 9d5f062..0169131 100644 --- a/tools/lib/h5diff_array.c +++ b/tools/lib/h5diff_array.c @@ -783,12 +783,11 @@ static hsize_t diff_datum( } /* check object type */ - if (ret_value >= 0) - if (obj1_type != obj2_type) { - parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); - opts->not_cmp = 1; - HGOTO_DONE (opts->err_stat); - } + if (obj1_type != obj2_type) { + parallel_print("Different object types referenced: <%s> and <%s>", obj1, obj2); + opts->not_cmp = 1; + HGOTO_DONE (opts->err_stat); + } if ((obj1_id = H5Rdereference2(container1_id, H5P_DEFAULT, H5R_OBJECT, _mem1)) < 0) { opts->err_stat = 1; diff --git a/tools/src/h5repack/h5repack.c b/tools/src/h5repack/h5repack.c index a63e56f..e96dea5 100644 --- a/tools/src/h5repack/h5repack.c +++ b/tools/src/h5repack/h5repack.c @@ -713,7 +713,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { hid_t did = -1; hid_t sid = -1; unsigned int i; - unsigned int uf; + int ifil; trav_table_t *travt = NULL; /* nothing to do */ @@ -747,7 +747,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { */ if (options->verbose) - printf("Opening file. Searching %d objects to modify ...\n", travt->nobjs); + printf("Opening file. Searching %zu objects to modify ...\n", travt->nobjs); for (i = 0; i < options->op_tbl->nelems; i++) { char* name = options->op_tbl->objs[i].path; @@ -761,17 +761,17 @@ static int check_objects(const char* fname, pack_opt_t *options) { if (options->verbose) printf("...Found\n"); - for (uf = 0; uf < options->op_tbl->objs[i].nfilters; uf++) { - if (options->op_tbl->objs[i].filter[uf].filtn < 0) + for (ifil = 0; ifil < options->op_tbl->objs[i].nfilters; ifil++) { + if (options->op_tbl->objs[i].filter[ifil].filtn < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "invalid filter"); /* check for extra filter conditions */ - switch (options->op_tbl->objs[i].filter[uf].filtn) { + switch (options->op_tbl->objs[i].filter[ifil].filtn) { /* chunk size must be smaller than pixels per block */ case H5Z_FILTER_SZIP: { int j; hsize_t csize = 1; - unsigned ppb = options->op_tbl->objs[i].filter[uf].cd_values[0]; + unsigned ppb = options->op_tbl->objs[i].filter[ifil].cd_values[0]; hsize_t dims[H5S_MAX_RANK]; int rank; @@ -807,7 +807,7 @@ static int check_objects(const char* fname, pack_opt_t *options) { default: break; } - } /* for uf */ + } /* for ifil */ } /* for i */ done: diff --git a/tools/src/h5repack/h5repack_copy.c b/tools/src/h5repack/h5repack_copy.c index 0567269..8122d6d 100644 --- a/tools/src/h5repack/h5repack_copy.c +++ b/tools/src/h5repack/h5repack_copy.c @@ -33,20 +33,6 @@ /* size of buffer/# of bytes to xfer at a time when copying userblock */ #define USERBLOCK_XFER_SIZE 512 -/* check H5Dread()/H5Dwrite() error, e.g. memory allocation error inside the library. */ -#define CHECK_H5DRW_ERROR(_fun, _fail, _did, _mtid, _msid, _fsid, _pid, _buf) { \ - H5E_BEGIN_TRY { \ - if(_fun(_did, _mtid, _msid, _fsid, _pid, _buf) < 0) { \ - hid_t _err_num = 0; \ - char _msg[80]; \ - H5Ewalk2(H5E_DEFAULT, H5E_WALK_DOWNWARD, walk_error_callback, &_err_num); \ - H5Eget_msg(_err_num, NULL, _msg, (size_t)80); \ - error_msg("%s %s -- %s\n", #_fun, "failed", _msg); \ - HGOTO_DONE(_fail) \ - } \ - } H5E_END_TRY; \ -} - /*------------------------------------------------------------------------- * local functions *------------------------------------------------------------------------- @@ -61,15 +47,7 @@ static int copy_user_block(const char *infile, const char *outfile, #if defined (H5REPACK_DEBUG_USER_BLOCK) static void print_user_block(const char *filename, hid_t fid); #endif -static herr_t walk_error_callback(unsigned n, const H5E_error2_t *err_desc, void *udata); -/* get the major number from the error stack. */ -static herr_t walk_error_callback(H5_ATTR_UNUSED unsigned n, const H5E_error2_t *err_desc, void *udata) { - if (err_desc) - *((hid_t *) udata) = err_desc->maj_num; - - return 0; -} /*------------------------------------------------------------------------- * Function: copy_objects @@ -634,7 +612,7 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, unsigned crt_order_flags; /* group creation order flag */ unsigned i; unsigned u; - unsigned uf; + int ifil; int is_ref = 0; htri_t is_named; hbool_t limit_maxdims; @@ -740,8 +718,8 @@ int do_copy_objects(hid_t fidin, hid_t fidout, trav_table_t *travt, if (options->op_tbl->objs) { for (u = 0; u < options->op_tbl->nelems; u++) { if (HDstrcmp(travt->objs[i].name, options->op_tbl->objs[u].path) == 0) - for (uf = 0; uf < options->op_tbl->objs[uf].nfilters; uf++) { - if (options->op_tbl->objs[u].filter[uf].filtn > 0) + for (ifil = 0; ifil < options->op_tbl->objs[ifil].nfilters; ifil++) { + if (options->op_tbl->objs[u].filter[ifil].filtn > 0) req_filter = 1; } } @@ -1350,7 +1328,7 @@ print_dataset_info(hid_t dcpl_id, char *objname, double ratio, int pr) if (!pr) printf(FORMAT_OBJ, "dset", objname); else { - char str[255], temp[28]; + char str[512], temp[512]; HDstrcpy(str, "dset "); HDstrcat(str, strfilter); diff --git a/tools/src/h5repack/h5repack_filters.c b/tools/src/h5repack/h5repack_filters.c index 3d9472a..7e32def 100644 --- a/tools/src/h5repack/h5repack_filters.c +++ b/tools/src/h5repack/h5repack_filters.c @@ -42,7 +42,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */ H5D_layout_t layout; int rank; /* rank of dataset */ hsize_t chsize[64]; /* chunk size in elements */ - unsigned int i; + int i; + unsigned u; /* get information about input filters */ if ((nfilters = H5Pget_nfilters(dcpl_id)) < 0) @@ -65,8 +66,8 @@ static int aux_copy_obj(hid_t dcpl_id, /* dataset creation property list */ if ((rank = H5Pget_chunk(dcpl_id, NELMTS(chsize), chsize/*out*/)) < 0) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Pget_chunk failed"); objout->chunk.rank = rank; - for (i = 0; i < rank; i++) - objout->chunk.chunk_lengths[i] = chsize[i]; + for (u = 0; u < (unsigned)rank; u++) + objout->chunk.chunk_lengths[u] = chsize[u]; } done: @@ -85,8 +86,7 @@ static int aux_find_obj(const char* name, /* object name from traverse list */ pack_info_t *obj /*OUT*/) /* info about object to filter */ { char *pdest = NULL; - char *pname = NULL; - int result; + const char *pname = NULL; unsigned int i; for (i = 0; i < options->op_tbl->nelems; i++) { diff --git a/tools/src/h5stat/h5stat.c b/tools/src/h5stat/h5stat.c index 8109b93..450f731 100644 --- a/tools/src/h5stat/h5stat.c +++ b/tools/src/h5stat/h5stat.c @@ -509,8 +509,7 @@ dataset_stats(iter_t *iter, const char *name, const H5O_info_t *oi) HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "attribute_stats() failed"); /* Get storage info */ - if((storage = H5Dget_storage_size(did)) < 0) - HGOTO_ERROR(FAIL, H5E_tools_min_id_g, "H5Dget_storage_size() failed"); + storage = H5Dget_storage_size(did); /* Gather layout statistics */ if((dcpl = H5Dget_create_plist(did)) < 0) diff --git a/tools/test/h5dump/h5dumpgentest.c b/tools/test/h5dump/h5dumpgentest.c index 946ca04..3a414d1 100644 --- a/tools/test/h5dump/h5dumpgentest.c +++ b/tools/test/h5dump/h5dumpgentest.c @@ -1889,7 +1889,7 @@ static void gent_str2(void) int i; - char buf[LENSTR+10]; + char buf[LENSTR+20]; char buf2[3*LENSTR2]; hsize_t sdim; @@ -1941,7 +1941,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of", i); + sprintf(buf, "This is row %d of type H5T_STR_NULLTERM of", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1954,7 +1954,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLTERM of string array", i); + sprintf(buf, "This is row %d of type H5T_STR_NULLTERM of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1974,7 +1974,7 @@ static void gent_str2(void) for(i = 0;(hsize_t) i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of", i); + sprintf(buf, "This is row %d of type H5T_STR_NULLPAD of", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -1988,7 +1988,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_NULLPAD of string array", i); + sprintf(buf, "This is row %d of type H5T_STR_NULLPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf)+1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2007,7 +2007,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of", i); + sprintf(buf, "This is row %d of type H5T_STR_SPACEPAD of", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -2021,7 +2021,7 @@ static void gent_str2(void) for(i = 0; (hsize_t)i < sdim; i++) { start[0] = (hsize_t)i; - sprintf(buf, "This is row %1d of type H5T_STR_SPACEPAD of string array", i); + sprintf(buf, "This is row %d of type H5T_STR_SPACEPAD of string array", i); H5Tset_size(memtype, HDstrlen(buf) + 1); H5Sselect_hyperslab(hyper_space, H5S_SELECT_SET, start, stride, count, block); H5Dwrite(dataset, memtype, mem_space, hyper_space, H5P_DEFAULT, buf); @@ -7532,16 +7532,6 @@ gent_nodata(void) { hid_t fid, dataset, space; hsize_t dims[2]; - uint8_t dsetu8[F66_XDIM][F66_YDIM8], valu8bits; - uint16_t dsetu16[F66_XDIM][F66_YDIM16], valu16bits; - uint32_t dsetu32[F66_XDIM][F66_YDIM32], valu32bits; - uint64_t dsetu64[F66_XDIM][F66_YDIM64], valu64bits; - int8_t dset8[F66_XDIM][F66_YDIM8], val8bits; - int16_t dset16[F66_XDIM][F66_YDIM16], val16bits; - int32_t dset32[F66_XDIM][F66_YDIM32], val32bits; - int64_t dset64[F66_XDIM][F66_YDIM64], val64bits; - double dsetdbl[F66_XDIM][F66_YDIM8]; - unsigned int i, j; fid = H5Fcreate(FILE87, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); diff --git a/tools/test/h5repack/h5repacktst.c b/tools/test/h5repack/h5repacktst.c index 0ae570b..a89bf10 100644 --- a/tools/test/h5repack/h5repacktst.c +++ b/tools/test/h5repack/h5repacktst.c @@ -2907,10 +2907,10 @@ out: static int make_all_filters(hid_t loc_id) { - hid_t dcpl; /* dataset creation property list */ - hid_t sid; /* dataspace ID */ - hid_t dtid; - hid_t dsid; + hid_t dcpl = H5I_INVALID_HID; /* dataset creation property list */ + hid_t sid = H5I_INVALID_HID; /* dataspace ID */ + hid_t dtid = H5I_INVALID_HID; + hid_t dsid = H5I_INVALID_HID; #if defined (H5_HAVE_FILTER_SZIP) unsigned szip_options_mask=H5_SZIP_ALLOW_K13_OPTION_MASK|H5_SZIP_NN_OPTION_MASK; unsigned szip_pixels_per_block=8; @@ -3083,7 +3083,7 @@ int make_early(void) hid_t tid=-1; hid_t dcpl=-1; int i; - char name[10]; + char name[16]; int iter=100; if ((fid = H5Fcreate(FNAME5, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT)) < 0) @@ -3178,7 +3178,7 @@ int make_layout(hid_t loc_id) hsize_t chunk_dims[RANK]={CDIM1,CDIM2}; int buf[DIM1][DIM2]; int i, j, n; - char name[6]; + char name[16]; for (i=n=0; i