diff options
-rw-r--r-- | config/commence.am | 2 | ||||
-rw-r--r-- | config/gnu-flags | 86 | ||||
-rw-r--r-- | configure.ac | 4 | ||||
-rw-r--r-- | src/H5Cpkg.h | 2 | ||||
-rw-r--r-- | src/H5Dchunk.c | 13 | ||||
-rw-r--r-- | src/H5FSsection.c | 10 | ||||
-rw-r--r-- | src/H5Fsuper_cache.c | 14 | ||||
-rw-r--r-- | src/H5Pmapl.c | 3 | ||||
-rw-r--r-- | src/H5private.h | 14 | ||||
-rw-r--r-- | test/Makefile.am | 2 | ||||
-rw-r--r-- | test/cache.c | 2 | ||||
-rw-r--r-- | test/cache_tagging.c | 2 | ||||
-rw-r--r-- | test/null_vol_connector.c | 6 | ||||
-rw-r--r-- | test/tfile.c | 1 | ||||
-rw-r--r-- | test/tid.c | 25 | ||||
-rw-r--r-- | test/tvlstr.c | 4 | ||||
-rw-r--r-- | tools/src/h5import/h5import.c | 2 | ||||
-rw-r--r-- | tools/src/h5repack/h5repack_main.c | 14 |
18 files changed, 149 insertions, 57 deletions
diff --git a/config/commence.am b/config/commence.am index a16eee5..830c494 100644 --- a/config/commence.am +++ b/config/commence.am @@ -70,7 +70,7 @@ H5CPP=${DESTDIR}$(bindir)/h5c++ # instead of CFLAGS, as CFLAGS is reserved solely for the user to define. # This applies to FCFLAGS, CXXFLAGS, CPPFLAGS, and LDFLAGS as well. -AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@ +AM_CFLAGS=@AM_CFLAGS@ @H5_CFLAGS@ @H5_ECFLAGS@ AM_FCFLAGS=@AM_FCFLAGS@ @H5_FCFLAGS@ AM_CXXFLAGS=@AM_CXXFLAGS@ @H5_CXXFLAGS@ AM_CPPFLAGS=@AM_CPPFLAGS@ @H5_CPPFLAGS@ diff --git a/config/gnu-flags b/config/gnu-flags index 6355ccf..eddd169 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -168,12 +168,41 @@ 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" - 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" - 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" + H5_CFLAGS="$H5_CFLAGS -pedantic -Wall -Wextra -Wcast-align" + H5_CFLAGS="$H5_CFLAGS -Wcast-qual -Wconversion -Wfloat-equal" + H5_CFLAGS="$H5_CFLAGS -Wformat=2 -Wno-format-nonliteral -Winit-self -Winvalid-pch -Wmissing-include-dirs" + H5_CFLAGS="$H5_CFLAGS" + H5_CFLAGS="$H5_CFLAGS -Wshadow" + H5_CFLAGS="$H5_CFLAGS -Wundef -Wwrite-strings" + + # + # Lots of noise, questionable benefit: + # + #H5_CFLAGS="$H5_CFLAGS -Wunused-macros -Wunsafe-loop-optimizations" + + # + # HDF5 code should not trigger the following warnings under any + # circumstances, so ask the compiler to treat them as errors: + # + H5_ECFLAGS="$H5_ECFLAGS -Werror=bad-function-cast" + H5_ECFLAGS="$H5_ECFLAGS -Werror=missing-declarations" + H5_ECFLAGS="$H5_ECFLAGS -Werror=missing-prototypes -Werror=nested-externs" + H5_ECFLAGS="$H5_ECFLAGS -Werror=old-style-definition -Werror=packed" + H5_ECFLAGS="$H5_ECFLAGS -Werror=redundant-decls -Werror=strict-prototypes" + H5_ECFLAGS="$H5_ECFLAGS -Werror=incompatible-pointer-types" + H5_ECFLAGS="$H5_ECFLAGS -Werror=switch" + H5_ECFLAGS="$H5_ECFLAGS -Werror=implicit-function-declaration" + H5_ECFLAGS="$H5_ECFLAGS -Werror=cast-function-type" + +# +# Should be enabled only with discussion: +# +# H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wdisabled-optimization" +# +# -Wswitch is helpful, but these seem a step too far: +# +# H5_CFLAGS="$H5_CFLAGS -Wswitch-enum -Wswitch-default" +# ###################### # Developer warnings # @@ -222,17 +251,34 @@ if test "X-gcc" = "X-$cc_vendor"; then # gcc 4.3 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 3; then - H5_CFLAGS="$H5_CFLAGS -Wlogical-op -Wlarger-than=2560" + H5_CFLAGS="$H5_CFLAGS -Wlogical-op" + # + # Lots of noise, questionable benefit: + # + #H5_CFLAGS="$H5_CFLAGS -Wlarger-than=2560" + # fi # gcc 4.4 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 4; then - H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wframe-larger-than=16384 -Wpacked-bitfield-compat" + H5_CFLAGS="$H5_CFLAGS -Wsync-nand -Wpacked-bitfield-compat" + # + # Lots of noise, questionable benefit: + # + #H5_CFLAGS="$H5_CFLAGS -Wframe-larger-than=16384" + # fi # gcc 4.5 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5; then - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wjump-misses-init -Wunsuffixed-float-constants" + H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow=5 -Wunsuffixed-float-constants" + # + # -Wjump-misses-init makes lots of noise for a questionable benefit. + # Can jumping over an initialization in C cause any harm, if + # the variable is never *used* before it has been initialized? + # + #H5_CFLAGS="$H5_CFLAGS -Wjump-misses-init" + # fi # gcc 4.6 @@ -244,7 +290,16 @@ if test "X-gcc" = "X-$cc_vendor"; then # gcc 4.7 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 7; then - H5_CFLAGS="$H5_CFLAGS -Wstack-usage=8192 -Wvector-operation-performance" + # + # It's not clear that -Wvector-operation-performance warnigns are + # actionable. + # + # -Wstack-usage=8192 warnings need better justification; + # if justifiable, should be enabled on a branch and swept up there + # before burdening the whole development team. + # + #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" fi @@ -267,7 +322,16 @@ if test "X-gcc" = "X-$cc_vendor"; then # gcc 6 if test $cc_vers_major -ge 6; then - H5_CFLAGS="$H5_CFLAGS -Wnull-dereference -Wunused-const-variable -Wduplicated-cond -Whsa -Wnormalized" + H5_CFLAGS="$H5_CFLAGS -Wunused-const-variable -Whsa -Wnormalized" + # + # Unacceptably noisy on HDF5 right now. + # + #H5_CFLAGS="$H5_CFLAGS -Wnull-dereference" + # + # Careful! -Wduplicated-cond, combined with HDF5's heavy use of + # macros, can make a lot of noise. + # + H5_CFLAGS="$H5_CFLAGS -Wduplicated-cond" fi # gcc 7 diff --git a/configure.ac b/configure.ac index 0eada60..5851b32 100644 --- a/configure.ac +++ b/configure.ac @@ -103,7 +103,11 @@ AC_SUBST([AR_FLAGS]) ## H5_CFLAGS (and company) are for CFLAGS that should be used on HDF5, but ## not exported to h5cc (or h5fc, etc.) +## +## H5_ECFLAGS is for warnings that should be treated as errors. +## AC_SUBST([H5_CFLAGS]) +AC_SUBST([H5_ECFLAGS]) AC_SUBST([H5_CPPFLAGS]) AC_SUBST([H5_FCFLAGS]) AC_SUBST([H5_CXXFLAGS]) diff --git a/src/H5Cpkg.h b/src/H5Cpkg.h index 9156c0d..b8648f0 100644 --- a/src/H5Cpkg.h +++ b/src/H5Cpkg.h @@ -4694,7 +4694,7 @@ struct H5C_t { uint32_t num_last_entries; #if H5C_DO_SANITY_CHECKS int32_t slist_len_increase; - ssize_t slist_size_increase; + int64_t slist_size_increase; #endif /* H5C_DO_SANITY_CHECKS */ /* Fields for maintaining list of tagged entries */ diff --git a/src/H5Dchunk.c b/src/H5Dchunk.c index 53ca7d1..a6b22f8 100644 --- a/src/H5Dchunk.c +++ b/src/H5Dchunk.c @@ -284,7 +284,8 @@ static int H5D__chunk_format_convert_cb(const H5D_chunk_rec_t *chunk_rec, void * static herr_t H5D__chunk_set_info_real(H5O_layout_chunk_t *layout, unsigned ndims, const hsize_t *curr_dims, const hsize_t *max_dims); static void *H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline); -static void *H5D__chunk_mem_xfree(void *chk, const void *pline); +static void *H5D__chunk_mem_xfree(void *chk, void *pline); +static void H5D__chunk_mem_xfree_wrapper(void *chk, void *pline); static void *H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline); static herr_t H5D__chunk_cinfo_cache_reset(H5D_chunk_cached_t *last); @@ -1431,7 +1432,7 @@ H5D__chunk_mem_alloc(size_t size, const H5O_pline_t *pline) *------------------------------------------------------------------------- */ static void * -H5D__chunk_mem_xfree(void *chk, const void *_pline) +H5D__chunk_mem_xfree(void *chk, void *_pline) { const H5O_pline_t *pline = (const H5O_pline_t *)_pline; @@ -1447,6 +1448,12 @@ H5D__chunk_mem_xfree(void *chk, const void *_pline) FUNC_LEAVE_NOAPI(NULL) } /* H5D__chunk_mem_xfree() */ +static void +H5D__chunk_mem_xfree_wrapper(void *chk, void *_pline) +{ + (void)H5D__chunk_mem_xfree(chk, _pline); +} + /*------------------------------------------------------------------------- * Function: H5D__chunk_mem_realloc @@ -4451,7 +4458,7 @@ H5D__chunk_allocate(const H5D_io_info_t *io_info, hbool_t full_overwrite, hsize_ /* (delay allocating fill buffer for VL datatypes until refilling) */ /* (casting away const OK - QAK) */ if(H5D__fill_init(&fb_info, NULL, (H5MM_allocate_t)H5D__chunk_mem_alloc, - (void *)pline, (H5MM_free_t)H5D__chunk_mem_xfree, (void *)pline, + (void *)pline, H5D__chunk_mem_xfree_wrapper, (void *)pline, &dset->shared->dcpl_cache.fill, dset->shared->type, dset->shared->type_id, (size_t)0, orig_chunk_size) < 0) HGOTO_ERROR(H5E_DATASET, H5E_CANTINIT, FAIL, "can't initialize fill buffer info") diff --git a/src/H5FSsection.c b/src/H5FSsection.c index df67bd9..cf4a587 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -371,10 +371,10 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" /* Check if section info lock count dropped to zero */ if(fspace->sinfo_lock_count == 0) { hbool_t release_sinfo_space = FALSE; /* Flag to indicate section info space in file should be released */ - hbool_t flush_in_progress = FALSE; /* Is flushing in progress */ + hbool_t closing_or_flushing = f->shared->closing; /* Is closing or flushing in progress */ - /* Check whether cache is flush_in_progress */ - if(H5AC_get_cache_flush_in_progress(f->shared->cache, &flush_in_progress) < 0) + /* Check whether cache-flush is in progress if closing is not. */ + if(!closing_or_flushing && H5AC_get_cache_flush_in_progress(f->shared->cache, &closing_or_flushing) < 0) HGOTO_ERROR(H5E_CACHE, H5E_SYSTEM, FAIL, "Can't get flush_in_progress") /* Check if we actually protected the section info */ @@ -390,7 +390,7 @@ HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n" cache_flags |= H5AC__DIRTIED_FLAG; /* On file close or flushing, does not allow section info to shrink in size */ - if(f->shared->closing || flush_in_progress) { + if(closing_or_flushing) { if(fspace->sect_size > fspace->alloc_sect_size) cache_flags |= H5AC__DELETED_FLAG | H5AC__TAKE_OWNERSHIP_FLAG; else @@ -441,7 +441,7 @@ HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC); /* Set flag to release section info space in file */ /* On file close or flushing, only need to release section info with size bigger than previous section */ - if(f->shared->closing || flush_in_progress) { + if(closing_or_flushing) { if(fspace->sect_size > fspace->alloc_sect_size) release_sinfo_space = TRUE; else diff --git a/src/H5Fsuper_cache.c b/src/H5Fsuper_cache.c index 125d6cf..ebf4a39 100644 --- a/src/H5Fsuper_cache.c +++ b/src/H5Fsuper_cache.c @@ -347,7 +347,7 @@ static herr_t H5F__cache_superblock_get_final_load_size(const void *_image, size_t image_len, void *_udata, size_t *actual_len) { - const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + const uint8_t *image = _image; /* Pointer into raw data buffer */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ H5F_super_t sblock; /* Temporary file superblock */ htri_t ret_value = SUCCEED; /* Return value */ @@ -393,7 +393,7 @@ done: static htri_t H5F__cache_superblock_verify_chksum(const void *_image, size_t len, void *_udata) { - const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + const uint8_t *image = _image; /* Pointer into raw data buffer */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ uint32_t stored_chksum; /* Stored metadata checksum value */ uint32_t computed_chksum; /* Computed metadata checksum value */ @@ -439,7 +439,7 @@ H5F__cache_superblock_deserialize(const void *_image, size_t len, void *_udata, { H5F_super_t *sblock = NULL; /* File's superblock */ H5F_superblock_cache_ud_t *udata = (H5F_superblock_cache_ud_t *)_udata; /* User data */ - const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + const uint8_t *image = _image; /* Pointer into raw data buffer */ H5F_super_t *ret_value = NULL; /* Return value */ FUNC_ENTER_STATIC @@ -664,7 +664,7 @@ H5F__cache_superblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_UNU void *_thing) { H5F_super_t *sblock = (H5F_super_t *)_thing; /* Pointer to the object */ - uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint8_t *image = _image; /* Pointer into raw data buffer */ haddr_t rel_eof; /* Relative EOF for file */ herr_t ret_value = SUCCEED; /* Return value */ @@ -870,7 +870,7 @@ static herr_t H5F__cache_drvrinfo_get_final_load_size(const void *_image, size_t image_len, void *_udata, size_t *actual_len) { - const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + const uint8_t *image = _image; /* Pointer into raw data buffer */ H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */ H5O_drvinfo_t drvrinfo; /* Driver info */ herr_t ret_value = SUCCEED; /* Return value */ @@ -916,7 +916,7 @@ H5F__cache_drvrinfo_deserialize(const void *_image, size_t len, void *_udata, { H5O_drvinfo_t *drvinfo = NULL; /* Driver info */ H5F_drvrinfo_cache_ud_t *udata = (H5F_drvrinfo_cache_ud_t *)_udata; /* User data */ - const uint8_t *image = (const uint8_t *)_image; /* Pointer into raw data buffer */ + const uint8_t *image = _image; /* Pointer into raw data buffer */ char drv_name[9]; /* Name of driver */ H5O_drvinfo_t *ret_value = NULL; /* Return value */ @@ -1010,7 +1010,7 @@ H5F__cache_drvrinfo_serialize(const H5F_t *f, void *_image, size_t len, void *_thing) { H5O_drvinfo_t *drvinfo = (H5O_drvinfo_t *)_thing; /* Pointer to the object */ - uint8_t *image = (uint8_t *)_image; /* Pointer into raw data buffer */ + uint8_t *image = _image; /* Pointer into raw data buffer */ uint8_t *dbuf; /* Pointer to beginning of driver info */ herr_t ret_value = SUCCEED; /* Return value */ diff --git a/src/H5Pmapl.c b/src/H5Pmapl.c index fe5be0f..59da91a 100644 --- a/src/H5Pmapl.c +++ b/src/H5Pmapl.c @@ -138,6 +138,7 @@ done: } /* end H5P__macc_reg_prop() */ +#ifdef H5_HAVE_MAP_API /*------------------------------------------------------------------------- * Function: H5Pset_map_iterate_hints * @@ -214,4 +215,4 @@ H5Pget_map_iterate_hints(hid_t mapl_id, size_t *key_prefetch_size, size_t *key_a done: FUNC_LEAVE_API(ret_value) } /* end H5Pget_map_iterate_hints() */ - +#endif /* H5_HAVE_MAP_API */ diff --git a/src/H5private.h b/src/H5private.h index b5ee984..8cc6b30 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -1373,25 +1373,25 @@ typedef off_t h5_stat_size_t; #define HDstrcpy(X,Y) strcpy(X,Y) #endif /* HDstrcpy */ #ifndef HDstrcspn - #define HDstrcspn(X,Y) strcspn(X,Y) + #define HDstrcspn strcspn #endif /* HDstrcspn */ #ifndef HDstrerror - #define HDstrerror(N) strerror(N) + #define HDstrerror strerror #endif /* HDstrerror */ #ifndef HDstrftime - #define HDstrftime(S,Z,F,T) strftime(S,Z,F,T) + #define HDstrftime strftime #endif /* HDstrftime */ #ifndef HDstrlen - #define HDstrlen(S) strlen(S) + #define HDstrlen strlen #endif /* HDstrlen */ #ifndef HDstrncat - #define HDstrncat(X,Y,Z) strncat(X,Y,Z) + #define HDstrncat strncat #endif /* HDstrncat */ #ifndef HDstrncmp - #define HDstrncmp(X,Y,Z) strncmp(X,Y,Z) + #define HDstrncmp strncmp #endif /* HDstrncmp */ #ifndef HDstrncpy - #define HDstrncpy(X,Y,Z) strncpy(X,Y,Z) + #define HDstrncpy strncpy #endif /* HDstrncpy */ #ifndef HDstrpbrk #define HDstrpbrk(X,Y) strpbrk(X,Y) diff --git a/test/Makefile.am b/test/Makefile.am index 57080aa..3a8a8a8 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -61,7 +61,7 @@ TEST_PROG= testhdf5 \ dtypes dsets chunk_info cmpd_dset filter_fail extend direct_chunk \ external efc objcopy objcopy_ref links unlink twriteorder big mtime fillval mount \ flush1 flush2 app_ref enum set_extent ttsafe enc_dec_plist \ - enc_dec_plist_cross_platform getname vfd ros3 s3comms hdfs ntypes \ + getname vfd ros3 s3comms hdfs ntypes \ dangle dtransform reserved cross_read freespace mf vds file_image \ unregister cache_logging cork swmr vol diff --git a/test/cache.c b/test/cache.c index 1a726fa..e59dc3e 100644 --- a/test/cache.c +++ b/test/cache.c @@ -16926,7 +16926,7 @@ check_move_entry_errs(unsigned paged) { herr_t result; H5F_t * file_ptr = NULL; - H5C_t * cache_ptr = NULL; + H5C_t * cache_ptr; test_entry_t * entry_ptr = NULL; test_entry_t * entry_0_0_ptr; test_entry_t * entry_0_1_ptr; diff --git a/test/cache_tagging.c b/test/cache_tagging.c index 7ce4e88..c3921ea 100644 --- a/test/cache_tagging.c +++ b/test/cache_tagging.c @@ -528,7 +528,7 @@ check_file_open_tags(hid_t fcpl, int type) hid_t fid = -1; /* File Identifier */ int verbose = FALSE; /* verbose file outout */ hid_t fapl = -1; /* File access prop list */ - haddr_t root_tag; /* Root Group Tag */ + haddr_t root_tag = HADDR_UNDEF; /* Root Group Tag */ haddr_t sbe_tag; /* Sblock Extension Tag */ /* Testing Macro */ diff --git a/test/null_vol_connector.c b/test/null_vol_connector.c index 5ed8545..64f62c4 100644 --- a/test/null_vol_connector.c +++ b/test/null_vol_connector.c @@ -116,6 +116,12 @@ static const H5VL_class_t null_vol_g = { NULL, /* optional */ NULL /* free */ }, + { /* blob_cls */ + NULL, /* put */ + NULL, /* get */ + NULL, /* specific */ + NULL /* optional */ + }, NULL /* optional */ }; diff --git a/test/tfile.c b/test/tfile.c index 4fb2bc9..3525ec0 100644 --- a/test/tfile.c +++ b/test/tfile.c @@ -1057,6 +1057,7 @@ create_objects(hid_t fid1, hid_t fid2, hid_t *ret_did, hid_t *ret_gid1, oid_count = H5Fget_obj_count(fid1, H5F_OBJ_DATASET|H5F_OBJ_GROUP|H5F_OBJ_DATATYPE|H5F_OBJ_ATTR); CHECK(oid_count, FAIL, "H5Fget_obj_count"); VERIFY(oid_count, OBJ_ID_COUNT_4, "H5Fget_obj_count"); + fprintf(stderr, "fid1: %zd datasets, %zd groups, %zd datatypes, %zd attributes\n", H5Fget_obj_count(fid1, H5F_OBJ_DATASET), H5Fget_obj_count(fid1, H5F_OBJ_GROUP), H5Fget_obj_count(fid1, H5F_OBJ_DATATYPE), H5Fget_obj_count(fid1, H5F_OBJ_ATTR)); oid_count = H5Fget_obj_count(fid2, H5F_OBJ_ALL); CHECK(oid_count, FAIL, "H5Fget_obj_count"); @@ -19,6 +19,13 @@ #define H5I_FRIEND /*suppress error about including H5Ipkg */ #include "H5Ipkg.h" +static herr_t +free_wrapper(void *p) +{ + free(p); + return SUCCEED; +} + /* Test basic functionality of registering and deleting types and IDs */ static int basic_id_test(void) { @@ -69,7 +76,7 @@ static int basic_id_test(void) goto out; /* Register a type */ - myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free ); + myType = H5Iregister_type((size_t)64, 0, free_wrapper); CHECK(myType, H5I_BADID, "H5Iregister_type"); if(myType == H5I_BADID) @@ -163,7 +170,7 @@ static int basic_id_test(void) H5E_END_TRY /* Register another type and another object in that type */ - myType = H5Iregister_type((size_t)64, 0, (H5I_free_t) free ); + myType = H5Iregister_type((size_t)64, 0, free_wrapper); CHECK(myType, H5I_BADID, "H5Iregister_type"); if(myType == H5I_BADID) @@ -238,7 +245,7 @@ out: /* A dummy search function for the next test */ -static int test_search_func(void H5_ATTR_UNUSED * ptr1, void H5_ATTR_UNUSED * ptr2) { return 0; } +static int test_search_func(void H5_ATTR_UNUSED * ptr1, hid_t H5_ATTR_UNUSED id, void H5_ATTR_UNUSED * ptr2) { return 0; } /* Ensure that public functions cannot access "predefined" ID types */ static int id_predefined_test(void ) @@ -264,7 +271,7 @@ static int id_predefined_test(void ) goto out; H5E_BEGIN_TRY - testPtr = H5Isearch(H5I_GENPROP_LST, (H5I_search_func_t) test_search_func, testObj); + testPtr = H5Isearch(H5I_GENPROP_LST, test_search_func, testObj); H5E_END_TRY CHECK_PTR_NULL(testPtr, "H5Isearch"); @@ -492,7 +499,7 @@ static int test_id_type_list(void) H5I_type_t testType; int i; /* Just a counter variable */ - startType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); + startType = H5Iregister_type((size_t)8, 0, free_wrapper); CHECK(startType, H5I_BADID, "H5Iregister_type"); if(startType == H5I_BADID) goto out; @@ -507,7 +514,7 @@ static int test_id_type_list(void) /* Create types up to H5I_MAX_NUM_TYPES */ for(i = startType + 1; i < H5I_MAX_NUM_TYPES; i++) { - currentType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); + currentType = H5Iregister_type((size_t)8, 0, free_wrapper); CHECK(currentType, H5I_BADID, "H5Iregister_type"); if(currentType == H5I_BADID) goto out; @@ -516,7 +523,7 @@ static int test_id_type_list(void) /* Wrap around to low type ID numbers */ for(i = H5I_NTYPES; i < startType; i++) { - currentType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); + currentType = H5Iregister_type((size_t)8, 0, free_wrapper); CHECK(currentType, H5I_BADID, "H5Iregister_type"); if(currentType == H5I_BADID) goto out; @@ -524,7 +531,7 @@ static int test_id_type_list(void) /* There should be no room at the inn for a new ID type*/ H5E_BEGIN_TRY - testType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); + testType = H5Iregister_type((size_t)8, 0, free_wrapper); H5E_END_TRY VERIFY(testType, H5I_BADID, "H5Iregister_type"); @@ -533,7 +540,7 @@ static int test_id_type_list(void) /* Now delete a type and try to insert again */ H5Idestroy_type(H5I_NTYPES); - testType = H5Iregister_type((size_t)8, 0, (H5I_free_t) free ); + testType = H5Iregister_type((size_t)8, 0, free_wrapper); VERIFY(testType, H5I_NTYPES, "H5Iregister_type"); if(testType != H5I_NTYPES) diff --git a/test/tvlstr.c b/test/tvlstr.c index 731270c..cc01084 100644 --- a/test/tvlstr.c +++ b/test/tvlstr.c @@ -861,12 +861,12 @@ static void test_write_same_element(void) hid_t file1, dataset1; hid_t mspace, fspace, dtype; hsize_t fdim[] = {SPACE1_DIM1}; - char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"}; + const char *val[SPACE1_DIM1] = {"But", "reuniting", "is a", "great joy"}; hsize_t marray[] = {NUMP}; hsize_t coord[SPACE1_RANK][NUMP]; herr_t ret; - char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."}; + const char *wdata[SPACE1_DIM1] = {"Parting", "is such a", "sweet", "sorrow."}; file1 = H5Fcreate(DATAFILE3, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); CHECK(file1, FAIL, "H5Fcreate"); diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c index 1eef5ab..65c2359 100644 --- a/tools/src/h5import/h5import.c +++ b/tools/src/h5import/h5import.c @@ -1428,7 +1428,7 @@ static int processConfigurationFile(char *infile, struct Input *in) /* Initialize machine endian */ volatile uint32_t ibyte=0x01234567; /* 0 for big endian, 1 for little endian. */ - if ((*((uint8_t*)(&ibyte))) == 0x67) { + if ((*((volatile uint8_t*)(&ibyte))) == 0x67) { if ((kindex = OutputByteOrderStrToInt("LE")) == -1) { (void) HDfprintf(stderr, "%s", err11e); return (-1); diff --git a/tools/src/h5repack/h5repack_main.c b/tools/src/h5repack/h5repack_main.c index c628beb..16899a3 100644 --- a/tools/src/h5repack/h5repack_main.c +++ b/tools/src/h5repack/h5repack_main.c @@ -281,7 +281,7 @@ int read_info(const char *filename, pack_opt_t *options) char comp_info[1024]; FILE *fp = NULL; char c; - int i, rc = 1; + int i; int ret_value = EXIT_SUCCESS; if (NULL == (fp = HDfopen(filename, "r"))) { @@ -412,7 +412,7 @@ set_sort_order(const char *form) static int parse_command_line(int argc, const char **argv, pack_opt_t* options) { - int opt; + int bound, opt; int ret_value = 0; /* parse command line options */ @@ -492,19 +492,21 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options) break; case 'j': - options->low_bound = (H5F_libver_t)HDatoi(opt_arg); - if (options->low_bound < H5F_LIBVER_EARLIEST || options->low_bound > H5F_LIBVER_LATEST) { + bound = HDatoi(opt_arg); + if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) { error_msg("in parsing low bound\n"); goto done; } + options->low_bound = bound; break; case 'k': - options->high_bound = (H5F_libver_t)HDatoi(opt_arg); - if (options->high_bound < H5F_LIBVER_EARLIEST || options->high_bound > H5F_LIBVER_LATEST) { + bound = HDatoi(opt_arg); + if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) { error_msg("in parsing high bound\n"); goto done; } + options->high_bound = bound; break; case 'c': |