From 093c2c7e69bc4a40e9d49eece1d6fdcf54e8ecb0 Mon Sep 17 00:00:00 2001 From: David Young Date: Thu, 13 Feb 2020 10:01:05 -0600 Subject: Avoid a crash, don't check if we're flushing when the file is closing: there's no need to check if the metadata cache is flushing if we already know the file is closing, because the condition we rely on is "closing OR flushing." Further, the cache may have already gone away, so sometimes calling into the cache to see if it's flushing will crash the program. --- src/H5FSsection.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) 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 -- cgit v0.12 From d8e5995f6d158ddf835da1ee669240ca092bf4a7 Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 25 Feb 2020 11:38:15 -0600 Subject: Break out warnings into more files that autoconf and CMake can share. This change temporarily disables the warnings that were promoted to errors, but I will add those warnings back as warnings, not errors, in the next commit. --- config/gnu-flags | 118 ++++++++++++++-------------------- config/gnu-warnings-4.2-4.3 | 3 + config/gnu-warnings-4.2-4.4 | 2 + config/gnu-warnings-4.2-4.6 | 2 + config/gnu-warnings-4.2-4.last | 3 + config/gnu-warnings-4.3 | 2 + config/gnu-warnings-4.4 | 3 + config/gnu-warnings-4.5 | 1 + config/gnu-warnings-4.5-4.6 | 3 + config/gnu-warnings-4.6 | 2 + config/gnu-warnings-4.7 | 5 ++ config/gnu-warnings-4.8 | 1 + config/gnu-warnings-4.9 | 1 + config/gnu-warnings-5 | 2 + config/gnu-warnings-6 | 9 +++ config/gnu-warnings-7 | 7 ++ config/gnu-warnings-8 | 3 + config/gnu-warnings-9 | 2 + config/gnu-warnings-developer-4.5 | 7 ++ config/gnu-warnings-developer-4.6 | 1 + config/gnu-warnings-developer-4.7 | 7 ++ config/gnu-warnings-developer-4.8 | 1 + config/gnu-warnings-developer-7 | 1 + config/gnu-warnings-developer-8 | 3 + config/gnu-warnings-developer-general | 5 ++ config/gnu-warnings-general | 2 +- config/gnu-warnings-no-developer-4.5 | 1 + config/gnu-warnings-no-developer-4.6 | 1 + config/gnu-warnings-no-developer-4.7 | 2 + config/gnu-warnings-no-developer-4.8 | 1 + config/gnu-warnings-no-developer-8 | 2 + config/gnu-werrors-5 | 12 ++++ config/gnu-werrors-8 | 9 +++ config/gnu-werrors-general | 24 +++++++ 34 files changed, 177 insertions(+), 71 deletions(-) create mode 100644 config/gnu-warnings-4.2-4.3 create mode 100644 config/gnu-warnings-4.2-4.4 create mode 100644 config/gnu-warnings-4.2-4.6 create mode 100644 config/gnu-warnings-4.2-4.last create mode 100644 config/gnu-warnings-4.3 create mode 100644 config/gnu-warnings-4.4 create mode 100644 config/gnu-warnings-4.5 create mode 100644 config/gnu-warnings-4.5-4.6 create mode 100644 config/gnu-warnings-4.6 create mode 100644 config/gnu-warnings-4.7 create mode 100644 config/gnu-warnings-4.8 create mode 100644 config/gnu-warnings-4.9 create mode 100644 config/gnu-warnings-5 create mode 100644 config/gnu-warnings-6 create mode 100644 config/gnu-warnings-7 create mode 100644 config/gnu-warnings-8 create mode 100644 config/gnu-warnings-9 create mode 100644 config/gnu-warnings-developer-4.5 create mode 100644 config/gnu-warnings-developer-4.6 create mode 100644 config/gnu-warnings-developer-4.7 create mode 100644 config/gnu-warnings-developer-4.8 create mode 100644 config/gnu-warnings-developer-7 create mode 100644 config/gnu-warnings-developer-8 create mode 100644 config/gnu-warnings-no-developer-4.5 create mode 100644 config/gnu-warnings-no-developer-4.6 create mode 100644 config/gnu-warnings-no-developer-4.7 create mode 100644 config/gnu-warnings-no-developer-4.8 create mode 100644 config/gnu-warnings-no-developer-8 create mode 100644 config/gnu-werrors-5 create mode 100644 config/gnu-werrors-8 create mode 100644 config/gnu-werrors-general diff --git a/config/gnu-flags b/config/gnu-flags index 3ca74c1..41d9058 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -171,35 +171,13 @@ if test "X-gcc" = "X-$cc_vendor"; then # General # ########### - # Note that some of the flags listed here really should be developer - # flags (listed in a separate variable, below) but we put them here - # because they are not raised by the current code and we'd like to - # know if they do start showing up. - # - # NOTE: Don't add -Wpadded here since we can't/won't fix the (many) - # warnings that are emitted. If you need it, add it from the - # environment variable at configure time. - # - # NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add - # it to the developer flags. - # - # 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 $(load_gcc_arguments warnings-general)" - H5_CFLAGS="$H5_CFLAGS -Wbad-function-cast -Wcast-align" - H5_CFLAGS="$H5_CFLAGS -Wdeclaration-after-statement -Wdisabled-optimization" - H5_CFLAGS="$H5_CFLAGS -Wmissing-declarations" - H5_CFLAGS="$H5_CFLAGS -Wmissing-prototypes -Wnested-externs -Wold-style-definition -Wpacked" - H5_CFLAGS="$H5_CFLAGS -Wredundant-decls -Wstrict-prototypes -Wswitch-enum -Wswitch-default" - H5_CFLAGS="$H5_CFLAGS -Wunused-macros -Wunsafe-loop-optimizations" + H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments werrors-general)" ###################### # Developer warnings # ###################### - # (suggestions from gcc, not code problems) - # NOTE: -Wformat-nonliteral added back in here (from being disabled in H5_CFLAGS) NO_DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments warnings-no-developer-general) DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments warnings-developer-general) @@ -207,106 +185,106 @@ if test "X-gcc" = "X-$cc_vendor"; then # gcc 4 special cases # ####################### - # Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier + # GCC 4.2 through 4.6 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then - H5_CFLAGS="$H5_CFLAGS -Wno-long-long" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.2-4.6)" fi - # -Wvolatile-register-var was later incorporated into -Wall and - # only needs to be specified explicitly for gcc 4.2-4.3 + # GCC 4.2 through 4.3 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 3; then - H5_CFLAGS="$H5_CFLAGS -Wvolatile-register-var" - fi + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.2-4.3)" + fi - # -Wstrict-aliasing was later incorporated into -Wall and - # only needs to be specified explicitly for gcc 4.5-4.6 + # GCC 4.5 through 4.6 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then - H5_CFLAGS="$H5_CFLAGS -Wstrict-aliasing" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.5-4.6)" fi - # The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4 + # GCC 4.2 through 4.4 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -a $cc_vers_major -eq 4 -a $cc_vers_minor -le 4; then - H5_CFLAGS="$H5_CFLAGS -Wstrict-overflow" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.2-4.4)" fi - # -Wvla was later incorporated into -Wpedantic and - # only needs to be specified explicitly for gcc 4 + # GCC 4.2 through the end of GCC 4 series if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2; then - H5_CFLAGS="$H5_CFLAGS -Wvla" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.2-4.last)" fi ############################# # Version-specific warnings # ############################# - # gcc 4.3 + # 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" - fi + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.3)" + fi - # gcc 4.4 + # 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 $(load_gcc_arguments warnings-4.4)" fi - # gcc 4.5 + # 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" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wunsuffixed-float-constants" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-unsuffixed-float-constants" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.5)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-developer-4.5)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-no-developer-4.5)" fi - # gcc 4.6 + # gcc >= 4.6 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 6; then - 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" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.6)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-developer-4.6)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-no-developer-4.6)" fi - # gcc 4.7 + # 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" - 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" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.7)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-developer-4.7)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-no-developer-4.7)" fi - # gcc 4.8 + # gcc >= 4.8 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8; then - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wsuggest-attribute=format" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=format" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.8)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-developer-4.8)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-no-developer-4.8)" fi - # gcc 4.9 + # gcc >= 4.9 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 9; then - H5_CFLAGS="$H5_CFLAGS -Wdate-time" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.9)" fi - # gcc 5 + # gcc >= 5 if test $cc_vers_major -ge 5; then - H5_CFLAGS="$H5_CFLAGS -Warray-bounds=2 -Wc99-c11-compat" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-5)" + H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments werrors-5)" fi - # gcc 6 + # 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 $(load_gcc_arguments warnings-6)" fi - # gcc 7 + # 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=1 -Wimplicit-fallthrough=5 -Wrestrict" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-7)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-developer-7)" fi # gcc 8 if test $cc_vers_major -ge 8; then - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS -Wstringop-overflow=4 -Wsuggest-attribute=cold -Wsuggest-attribute=malloc" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS -Wno-suggest-attribute=cold -Wno-suggest-attribute=malloc" - H5_CFLAGS="$H5_CFLAGS -Wattribute-alias -Wcast-align=strict -Wshift-overflow=2" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-8)" + H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments werrors-8)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-developer-8)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-no-developer-8)" fi # gcc 9 if test $cc_vers_major -ge 9; then - H5_CFLAGS="$H5_CFLAGS -Wattribute-alias=2 -Wmissing-profile" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-9)" fi ################# diff --git a/config/gnu-warnings-4.2-4.3 b/config/gnu-warnings-4.2-4.3 new file mode 100644 index 0000000..1881797 --- /dev/null +++ b/config/gnu-warnings-4.2-4.3 @@ -0,0 +1,3 @@ +# -Wvolatile-register-var was later incorporated into -Wall and +# only needs to be specified explicitly for gcc 4.2-4.3 +-Wvolatile-register-var diff --git a/config/gnu-warnings-4.2-4.4 b/config/gnu-warnings-4.2-4.4 new file mode 100644 index 0000000..ec4876f --- /dev/null +++ b/config/gnu-warnings-4.2-4.4 @@ -0,0 +1,2 @@ +# The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4 +-Wstrict-overflow diff --git a/config/gnu-warnings-4.2-4.6 b/config/gnu-warnings-4.2-4.6 new file mode 100644 index 0000000..37df4ab --- /dev/null +++ b/config/gnu-warnings-4.2-4.6 @@ -0,0 +1,2 @@ +# Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier +-Wno-long-long diff --git a/config/gnu-warnings-4.2-4.last b/config/gnu-warnings-4.2-4.last new file mode 100644 index 0000000..2db90fb --- /dev/null +++ b/config/gnu-warnings-4.2-4.last @@ -0,0 +1,3 @@ +# -Wvla was later incorporated into -Wpedantic and +# only needs to be specified explicitly for gcc 4 +-Wvla diff --git a/config/gnu-warnings-4.3 b/config/gnu-warnings-4.3 new file mode 100644 index 0000000..13d8558 --- /dev/null +++ b/config/gnu-warnings-4.3 @@ -0,0 +1,2 @@ +-Wlarger-than=2560 +-Wlogical-op diff --git a/config/gnu-warnings-4.4 b/config/gnu-warnings-4.4 new file mode 100644 index 0000000..42929b5 --- /dev/null +++ b/config/gnu-warnings-4.4 @@ -0,0 +1,3 @@ +-Wframe-larger-than=16384 +-Wpacked-bitfield-compat +-Wsync-nand diff --git a/config/gnu-warnings-4.5 b/config/gnu-warnings-4.5 new file mode 100644 index 0000000..ddb96df --- /dev/null +++ b/config/gnu-warnings-4.5 @@ -0,0 +1 @@ +-Wstrict-overflow=5 diff --git a/config/gnu-warnings-4.5-4.6 b/config/gnu-warnings-4.5-4.6 new file mode 100644 index 0000000..d3035fe --- /dev/null +++ b/config/gnu-warnings-4.5-4.6 @@ -0,0 +1,3 @@ +# -Wstrict-aliasing was later incorporated into -Wall and +# only needs to be specified explicitly for gcc 4.5-4.6 +-Wstrict-aliasing diff --git a/config/gnu-warnings-4.6 b/config/gnu-warnings-4.6 new file mode 100644 index 0000000..140a20c --- /dev/null +++ b/config/gnu-warnings-4.6 @@ -0,0 +1,2 @@ +-Wdouble-promotion +-Wtrampolines diff --git a/config/gnu-warnings-4.7 b/config/gnu-warnings-4.7 new file mode 100644 index 0000000..c47fe4b --- /dev/null +++ b/config/gnu-warnings-4.7 @@ -0,0 +1,5 @@ +# +# -Wstack-usage=8192 warnings need to be swept up on a branch so +# that we can stop burdening the whole development team. +# +-Wstack-usage=8192 diff --git a/config/gnu-warnings-4.8 b/config/gnu-warnings-4.8 new file mode 100644 index 0000000..5dc577f --- /dev/null +++ b/config/gnu-warnings-4.8 @@ -0,0 +1 @@ +-Wmaybe-uninitialized diff --git a/config/gnu-warnings-4.9 b/config/gnu-warnings-4.9 new file mode 100644 index 0000000..78aa929 --- /dev/null +++ b/config/gnu-warnings-4.9 @@ -0,0 +1 @@ +-Wdate-time diff --git a/config/gnu-warnings-5 b/config/gnu-warnings-5 new file mode 100644 index 0000000..32cb196 --- /dev/null +++ b/config/gnu-warnings-5 @@ -0,0 +1,2 @@ +-Warray-bounds=2 +-Wc99-c11-compat diff --git a/config/gnu-warnings-6 b/config/gnu-warnings-6 new file mode 100644 index 0000000..736a446 --- /dev/null +++ b/config/gnu-warnings-6 @@ -0,0 +1,9 @@ +# +# Careful! -Wduplicated-cond, combined with HDF5's heavy use of +# macros, can make a lot of noise. +# +-Wduplicated-cond +-Whsa +-Wnormalized +-Wnull-dereference +-Wunused-const-variable diff --git a/config/gnu-warnings-7 b/config/gnu-warnings-7 new file mode 100644 index 0000000..266f5c1 --- /dev/null +++ b/config/gnu-warnings-7 @@ -0,0 +1,7 @@ +-Walloca +-Walloc-zero +-Wduplicated-branches +-Wformat-overflow=2 +-Wformat-truncation=1 +-Wimplicit-fallthrough=5 +-Wrestrict diff --git a/config/gnu-warnings-8 b/config/gnu-warnings-8 new file mode 100644 index 0000000..5e7519d --- /dev/null +++ b/config/gnu-warnings-8 @@ -0,0 +1,3 @@ +-Wattribute-alias +-Wcast-align=strict +-Wshift-overflow=2 diff --git a/config/gnu-warnings-9 b/config/gnu-warnings-9 new file mode 100644 index 0000000..c084350 --- /dev/null +++ b/config/gnu-warnings-9 @@ -0,0 +1,2 @@ +-Wattribute-alias=2 +-Wmissing-profile diff --git a/config/gnu-warnings-developer-4.5 b/config/gnu-warnings-developer-4.5 new file mode 100644 index 0000000..48df846 --- /dev/null +++ b/config/gnu-warnings-developer-4.5 @@ -0,0 +1,7 @@ +# +# -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? +# +-Wjump-misses-init +-Wunsuffixed-float-constants diff --git a/config/gnu-warnings-developer-4.6 b/config/gnu-warnings-developer-4.6 new file mode 100644 index 0000000..2372fbf --- /dev/null +++ b/config/gnu-warnings-developer-4.6 @@ -0,0 +1 @@ +-Wsuggest-attribute=const diff --git a/config/gnu-warnings-developer-4.7 b/config/gnu-warnings-developer-4.7 new file mode 100644 index 0000000..a3b0781 --- /dev/null +++ b/config/gnu-warnings-developer-4.7 @@ -0,0 +1,7 @@ +-Wsuggest-attribute=noreturn +-Wsuggest-attribute=pure +# +# It's not clear that -Wvector-operation-performance warnings are +# actionable, so they are demoted to "developer" warnings. +# +-Wvector-operation-performance diff --git a/config/gnu-warnings-developer-4.8 b/config/gnu-warnings-developer-4.8 new file mode 100644 index 0000000..b0109e2 --- /dev/null +++ b/config/gnu-warnings-developer-4.8 @@ -0,0 +1 @@ +-Wsuggest-attribute=format diff --git a/config/gnu-warnings-developer-7 b/config/gnu-warnings-developer-7 new file mode 100644 index 0000000..2a3ce7e --- /dev/null +++ b/config/gnu-warnings-developer-7 @@ -0,0 +1 @@ +-Wstringop-overflow=2 diff --git a/config/gnu-warnings-developer-8 b/config/gnu-warnings-developer-8 new file mode 100644 index 0000000..a2ba7ca --- /dev/null +++ b/config/gnu-warnings-developer-8 @@ -0,0 +1,3 @@ +-Wstringop-overflow=4 +-Wsuggest-attribute=cold +-Wsuggest-attribute=malloc diff --git a/config/gnu-warnings-developer-general b/config/gnu-warnings-developer-general index 698f0e0..b34c4b7 100644 --- a/config/gnu-warnings-developer-general +++ b/config/gnu-warnings-developer-general @@ -2,7 +2,12 @@ # NOTE: -Wformat-nonliteral added back in here (from being disabled in # H5_CFLAGS) -Waggregate-return +-Wdisabled-optimization -Wformat-nonliteral -Winline -Wmissing-format-attribute -Wmissing-noreturn +-Wswitch-default +-Wswitch-enum +-Wunsafe-loop-optimizations +-Wunused-macros diff --git a/config/gnu-warnings-general b/config/gnu-warnings-general index 9e67b71..a7a20b7 100644 --- a/config/gnu-warnings-general +++ b/config/gnu-warnings-general @@ -29,4 +29,4 @@ -Wshadow -Wundef -Wwrite-strings --pedantic \ No newline at end of file +-pedantic diff --git a/config/gnu-warnings-no-developer-4.5 b/config/gnu-warnings-no-developer-4.5 new file mode 100644 index 0000000..ef7d38f --- /dev/null +++ b/config/gnu-warnings-no-developer-4.5 @@ -0,0 +1 @@ +-Wno-unsuffixed-float-constants diff --git a/config/gnu-warnings-no-developer-4.6 b/config/gnu-warnings-no-developer-4.6 new file mode 100644 index 0000000..ea9cc66 --- /dev/null +++ b/config/gnu-warnings-no-developer-4.6 @@ -0,0 +1 @@ +-Wno-suggest-attribute=const diff --git a/config/gnu-warnings-no-developer-4.7 b/config/gnu-warnings-no-developer-4.7 new file mode 100644 index 0000000..5b85e1f --- /dev/null +++ b/config/gnu-warnings-no-developer-4.7 @@ -0,0 +1,2 @@ +-Wno-suggest-attribute=noreturn +-Wno-suggest-attribute=pure diff --git a/config/gnu-warnings-no-developer-4.8 b/config/gnu-warnings-no-developer-4.8 new file mode 100644 index 0000000..e42e09f --- /dev/null +++ b/config/gnu-warnings-no-developer-4.8 @@ -0,0 +1 @@ +-Wno-suggest-attribute=format diff --git a/config/gnu-warnings-no-developer-8 b/config/gnu-warnings-no-developer-8 new file mode 100644 index 0000000..2134bad --- /dev/null +++ b/config/gnu-warnings-no-developer-8 @@ -0,0 +1,2 @@ +-Wno-suggest-attribute=cold +-Wno-suggest-attribute=malloc diff --git a/config/gnu-werrors-5 b/config/gnu-werrors-5 new file mode 100644 index 0000000..f7e1138 --- /dev/null +++ b/config/gnu-werrors-5 @@ -0,0 +1,12 @@ +-Werror=incompatible-pointer-types +# +# In GCC 4.4.7, the compiler gripes about shadowed global +# declarations when a local variable uses the name of a +# function that's in a system header file. For some reason, +# later versions of GCC (e.g., 5.2.0) don't complain about +# the shadowed globals. Maybe later versions are less fussy? +# Anyway, the shadowing seems to be harmless, and GCC 4.4.7 +# is not a supported compiler, so let us promote shadowed globals +# warnings to errors only for GCC 5 and later. +# +-Werror=shadow diff --git a/config/gnu-werrors-8 b/config/gnu-werrors-8 new file mode 100644 index 0000000..36c1414 --- /dev/null +++ b/config/gnu-werrors-8 @@ -0,0 +1,9 @@ +-Werror=cast-function-type +# +# For GCC 8, promote maybe-initialized warnings to an error. GCC 8 +# reports 0 maybe-uninitialized warnings where earlier versions +# make many false reports. GCC 8 seems to analyze calls to static +# in order to detect initializations that occur there. It's possible +# that GCC 8 only performs that analysis at -O3, though. +# +-Werror=maybe-uninitialized diff --git a/config/gnu-werrors-general b/config/gnu-werrors-general new file mode 100644 index 0000000..d0e272a --- /dev/null +++ b/config/gnu-werrors-general @@ -0,0 +1,24 @@ +# +# HDF5 code should not trigger the following warnings under any +# circumstances, so ask the compiler to treat them as errors: +# +-Werror=bad-function-cast +-Werror=cast-align +-Werror=declaration-after-statement +-Werror=format +-Werror=implicit-function-declaration +-Werror=missing-declarations +-Werror=missing-prototypes +-Werror=nested-externs +-Werror=old-style-definition +-Werror=packed +-Werror=pointer-sign +-Werror=pointer-to-int-cast +-Werror=redundant-decls +-Werror=strict-prototypes +-Werror=switch +-Werror=unused-but-set-variable +-Werror=unused-function +-Werror=unused-parameter +-Werror=unused-variable +#-Werror=discarded-qualifiers -- cgit v0.12 From 626c60dec4c17eb95987d4ed7838408272487aba Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 25 Feb 2020 11:59:37 -0600 Subject: Incorporate the H5_ECFLAGS into the library CFLAGS. Now a bunch of errors will occur. Next commit will demote the warnings promoted to errors back to warnings again. --- config/commence.am | 2 +- configure.ac | 4 ++++ src/libhdf5.settings.in | 2 +- 3 files changed, 6 insertions(+), 2 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/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/libhdf5.settings.in b/src/libhdf5.settings.in index 1591bed..0c2be75 100644 --- a/src/libhdf5.settings.in +++ b/src/libhdf5.settings.in @@ -39,7 +39,7 @@ Languages: H5_CPPFLAGS: @H5_CPPFLAGS@ AM_CPPFLAGS: @AM_CPPFLAGS@ C Flags: @CFLAGS@ - H5 C Flags: @H5_CFLAGS@ + H5 C Flags: @H5_CFLAGS@ @H5_ECFLAGS@ AM C Flags: @AM_CFLAGS@ Shared C Library: @enable_shared@ Static C Library: @enable_static@ -- cgit v0.12 From 0f32728f728f0670e49cb712acd8e7b34fa0bcc4 Mon Sep 17 00:00:00 2001 From: David Young Date: Tue, 25 Feb 2020 12:02:07 -0600 Subject: By default, demote warnings promoted to errors back to warnings. --- config/gnu-flags | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/config/gnu-flags b/config/gnu-flags index 41d9058..61a1bfd 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -18,6 +18,24 @@ # # +# For now, do not promote any warnings to errors. +# +PROMOTE_ERRORS_DFLT=no + +# +# This filter rewrites -Werror= as -W, in that way demoting warnings +# promoted to errors back to warnings, if PROMOTE_ERRORS is no. +# +demote_errors() +{ + if [ ${PROMOTE_ERRORS:-${PROMOTE_ERRORS_DFLT}} = no ]; then + sed 's,-Werror=,-W,g' + else + cat + fi +} + +# # Prepend `$srcdir/config/gnu-` to the filename suffix(es) given as # subroutine argument(s), remove comments starting with # and ending # at EOL, replace spans of whitespace (including newlines) with spaces, @@ -26,7 +44,7 @@ load_gcc_arguments() { set -- $(for arg; do - sed 's,#.*$,,' $srcdir/config/gnu-${arg} + sed 's,#.*$,,' $srcdir/config/gnu-${arg} | demote_errors done) IFS=' ' echo "$*" } -- cgit v0.12 From 04b8cc82a858aeb8a0beb3738984240b528952dc Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Tue, 10 Mar 2020 18:37:55 -0500 Subject: Add routines to query the library's free list sizes and allocation stats. --- src/H5.c | 93 +++++++++++ src/H5FL.c | 484 +++++++++++++++++++++++++++++++----------------------- src/H5FLprivate.h | 16 +- src/H5MM.c | 74 ++++++++- src/H5MMprivate.h | 3 + src/H5Tconv.c | 2 +- src/H5public.h | 5 + src/H5trace.c | 2 +- test/tmisc.c | 139 ++++++++++++++++ 9 files changed, 606 insertions(+), 212 deletions(-) diff --git a/src/H5.c b/src/H5.c index 16c12cb..7853038 100644 --- a/src/H5.c +++ b/src/H5.c @@ -556,6 +556,99 @@ done: /*------------------------------------------------------------------------- + * Function: H5get_free_list_sizes + * + * Purpose: Gets the current size of the different kinds of free lists that + * the library uses to manage memory. The free list sizes can be set with + * H5set_free_list_limits and garbage collected with H5garbage_collect. + * These lists are global for the entire library. + * + * Parameters: + * size_t *reg_size; OUT: The current size of all "regular" free list memory used + * size_t *arr_size; OUT: The current size of all "array" free list memory used + * size_t *blk_size; OUT: The current size of all "block" free list memory used + * size_t *fac_size; OUT: The current size of all "factory" free list memory used + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Friday, March 6, 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, + size_t *fac_size) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE4("e", "*z*z*z*z", reg_size, arr_size, blk_size, fac_size); + + /* Call the free list function to actually get the sizes */ + if(H5FL_get_free_list_sizes(reg_size, arr_size, blk_size, fac_size) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get garbage collection sizes") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5get_free_list_sizes() */ + + +/*------------------------------------------------------------------------- + * Function: H5get_alloc_stats + * + * Purpose: Gets the memory allocation statistics for the library, if the + * --enable-memory-alloc-sanity-check option was given when building the + * library. Applications can check whether this option was enabled by + * detecting if the 'H5_MEMORY_ALLOC_SANITY_CHECK' macro is defined. This + * option is enabled by default for debug builds of the library and + * disabled by default for non-debug builds. If the option is not enabled, + * all the values returned with be 0. These statistics are global for the + * entire library, but don't include allocations from chunked dataset I/O + * filters or non-native VOL connectors. + * + * Parameters: + * unsigned long long *total_alloc_bytes; OUT: Running count of total # of bytes allocated + * size_t *curr_alloc_bytes; OUT: Current # of bytes allocated + * size_t *peak_alloc_bytes; OUT: Peak # of bytes allocated + * size_t *max_block_size; OUT: Largest block allocated + * size_t *total_alloc_blocks_count; OUT: Running count of total # of blocks allocated + * size_t *curr_alloc_blocks_count; OUT: Current # of blocks allocated + * size_t *peak_alloc_blocks_count; OUT: Peak # of blocks allocated + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, March 7, 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5get_alloc_stats(unsigned long long *total_alloc_bytes, size_t *curr_alloc_bytes, + size_t *peak_alloc_bytes, size_t *max_block_size, size_t *total_alloc_blocks_count, + size_t *curr_alloc_blocks_count, size_t *peak_alloc_blocks_count) +{ + herr_t ret_value = SUCCEED; /* Return value */ + + FUNC_ENTER_API(FAIL) + H5TRACE7("e", "*UL*z*z*z*z*z*z", total_alloc_bytes, curr_alloc_bytes, + peak_alloc_bytes, max_block_size, total_alloc_blocks_count, + curr_alloc_blocks_count, peak_alloc_blocks_count); + + /* Call the internal allocation stat routine to get the values */ + if(H5MM_get_alloc_stats(total_alloc_bytes, curr_alloc_bytes, peak_alloc_bytes, + max_block_size, total_alloc_blocks_count, curr_alloc_blocks_count, + peak_alloc_blocks_count) < 0) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get allocation stats") + +done: + FUNC_LEAVE_API(ret_value) +} /* end H5get_alloc_stats() */ + + +/*------------------------------------------------------------------------- * Function: H5_debug_mask * * Purpose: Set runtime debugging flags according to the string S. The diff --git a/src/H5FL.c b/src/H5FL.c index 9ed867d..66d27fb 100644 --- a/src/H5FL.c +++ b/src/H5FL.c @@ -130,17 +130,23 @@ static H5FL_track_t *H5FL_out_head_g = NULL; #endif /* H5FL_TRACK */ /* Forward declarations of local static functions */ +static void * H5FL__malloc(size_t mem_size); +static herr_t H5FL__reg_init(H5FL_reg_head_t *head); static herr_t H5FL__reg_gc(void); static herr_t H5FL__reg_gc_list(H5FL_reg_head_t *head); static int H5FL__reg_term(void); -static herr_t H5FL__arr_gc(void); -static herr_t H5FL__arr_gc_list(H5FL_arr_head_t *head); -static int H5FL__arr_term(void); -static herr_t H5FL__blk_gc(void); +static H5FL_blk_node_t *H5FL__blk_find_list(H5FL_blk_node_t **head, size_t size); +static H5FL_blk_node_t *H5FL__blk_create_list(H5FL_blk_node_t **head, size_t size); +static herr_t H5FL__blk_init(H5FL_blk_head_t *head); static herr_t H5FL__blk_gc_list(H5FL_blk_head_t *head); +static herr_t H5FL__blk_gc(void); static int H5FL__blk_term(void); -static herr_t H5FL__fac_gc(void); +static herr_t H5FL__arr_init(H5FL_arr_head_t *head); +static herr_t H5FL__arr_gc_list(H5FL_arr_head_t *head); +static herr_t H5FL__arr_gc(void); +static int H5FL__arr_term(void); static herr_t H5FL__fac_gc_list(H5FL_fac_head_t *head); +static herr_t H5FL__fac_gc(void); static int H5FL__fac_term_all(void); /* Declare a free list to manage the H5FL_blk_node_t struct */ @@ -217,7 +223,7 @@ H5FL_term_package(void) /*------------------------------------------------------------------------- - * Function: H5FL_malloc + * Function: H5FL__malloc * * Purpose: Attempt to allocate space using malloc. If malloc fails, garbage * collect and try again. If malloc fails again, then return NULL. @@ -228,16 +234,14 @@ H5FL_term_package(void) * Programmer: Quincey Koziol * Tuesday, August 1, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static void * -H5FL_malloc(size_t mem_size) +H5FL__malloc(size_t mem_size) { void *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Attempt to allocate the memory requested */ if(NULL==(ret_value=H5MM_malloc(mem_size))) { @@ -252,11 +256,11 @@ H5FL_malloc(size_t mem_size) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_malloc() */ +} /* end H5FL__malloc() */ /*------------------------------------------------------------------------- - * Function: H5FL_reg_init + * Function: H5FL__reg_init * * Purpose: Initialize a free list for a certain type. Right now, this just * adds the free list to the list of things to garbage collect. @@ -267,17 +271,15 @@ done: * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_reg_init(H5FL_reg_head_t *head) +H5FL__reg_init(H5FL_reg_head_t *head) { H5FL_reg_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ herr_t ret_value=SUCCEED; /* return value*/ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate a new garbage collection node */ if(NULL == (new_node = (H5FL_reg_gc_node_t *)H5MM_malloc(sizeof(H5FL_reg_gc_node_t)))) @@ -304,7 +306,7 @@ H5FL_reg_init(H5FL_reg_head_t *head) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_reg_init() */ +} /* end H5FL__reg_init() */ /*------------------------------------------------------------------------- @@ -317,8 +319,6 @@ done: * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -403,8 +403,6 @@ done: * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -419,7 +417,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) /* Make certain the list is initialized first */ if(!head->init) - if(H5FL_reg_init(head)<0) + if(H5FL__reg_init(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'regular' blocks") /* Check for nodes available on the free list first */ @@ -438,7 +436,7 @@ H5FL_reg_malloc(H5FL_reg_head_t *head H5FL_TRACK_PARAMS) } /* end if */ /* Otherwise allocate a node */ else { - if (NULL==(ret_value = H5FL_malloc(head->size))) + if(NULL == (ret_value = H5FL__malloc(head->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Increment the number of blocks allocated in list */ @@ -480,8 +478,6 @@ done: * Programmer: Quincey Koziol * Monday, December 23, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -524,35 +520,34 @@ static herr_t H5FL__reg_gc_list(H5FL_reg_head_t *head) { H5FL_reg_node_t *free_list; /* Pointer to nodes in free list being garbage collected */ - size_t total_mem; /* Total memory used on list */ FUNC_ENTER_STATIC_NOERR - /* Calculate the total memory used on this list */ - total_mem = head->onlist * head->size; - /* For each free list being garbage collected, walk through the nodes and free them */ free_list = head->list; while(free_list != NULL) { - void *tmp; /* Temporary node pointer */ + H5FL_reg_node_t *tmp; /* Temporary node pointer */ + /* Get the pointer to the next node */ tmp = free_list->next; - /* Decrement the count of nodes allocated and free the node */ - head->allocated--; - + /* Free the block */ H5MM_free(free_list); - free_list = (H5FL_reg_node_t *)tmp; + /* Advance to the next node */ + free_list = tmp; } /* end while */ + /* Decrement the count of nodes allocated and free the node */ + head->allocated -= head->onlist; + + /* Decrement global count of free memory on "regular" lists */ + H5FL_reg_gc_head.mem_freed -= (head->onlist * head->size); + /* Indicate no free nodes on the free list */ head->list = NULL; head->onlist = 0; - /* Decrement global count of free memory on "regular" lists */ - H5FL_reg_gc_head.mem_freed -= total_mem; - FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FL__reg_gc_list() */ @@ -568,10 +563,6 @@ H5FL__reg_gc_list(H5FL_reg_head_t *head) * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * Broke into two parts, one for looping over all the free lists and - * another for freeing each list - QAK 7/25/00 - * *------------------------------------------------------------------------- */ static herr_t @@ -670,7 +661,7 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.f /*------------------------------------------------------------------------- - * Function: H5FL_blk_find_list + * Function: H5FL__blk_find_list * * Purpose: Finds the free list for blocks of a given size. Also moves that * free list node to the head of the priority queue (if it isn't there @@ -684,16 +675,14 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.f * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5FL_blk_node_t * -H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size) +H5FL__blk_find_list(H5FL_blk_node_t **head, size_t size) { H5FL_blk_node_t *temp = NULL; /* Temp. pointer to node in the native list */ - FUNC_ENTER_NOAPI_NOINIT_NOERR + FUNC_ENTER_STATIC_NOERR /* Find the correct free list */ temp=*head; @@ -729,11 +718,11 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size) } /* end if */ FUNC_LEAVE_NOAPI(temp) -} /* end H5FL_blk_find_list() */ +} /* end H5FL__blk_find_list() */ /*------------------------------------------------------------------------- - * Function: H5FL_blk_create_list + * Function: H5FL__blk_create_list * * Purpose: Creates a new free list for blocks of the given size at the * head of the priority queue. @@ -745,47 +734,38 @@ H5FL_blk_find_list(H5FL_blk_node_t **head, size_t size) * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static H5FL_blk_node_t * -H5FL_blk_create_list(H5FL_blk_node_t **head, size_t size) +H5FL__blk_create_list(H5FL_blk_node_t **head, size_t size) { - H5FL_blk_node_t *temp; /* Temp. pointer to node in the list */ H5FL_blk_node_t *ret_value = NULL; /* Return value */ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate room for the new free list node */ - if(NULL==(temp=H5FL_MALLOC(H5FL_blk_node_t))) - HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk info") + if(NULL == (ret_value = H5FL_CALLOC(H5FL_blk_node_t))) + HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, NULL, "memory allocation failed for chunk info") /* Set the correct values for the new free list */ - temp->size=size; - temp->list=NULL; + ret_value->size = size; /* Attach to head of priority queue */ - if(*head==NULL) { - *head=temp; - temp->next=temp->prev=NULL; - } /* end if */ + if(NULL == *head) + *head = ret_value; else { - temp->next=*head; - (*head)->prev=temp; - temp->prev=NULL; - *head=temp; + ret_value->next = *head; + (*head)->prev = ret_value; + *head = ret_value; } /* end else */ - ret_value=temp; - done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_blk_create_list() */ +} /* end H5FL__blk_create_list() */ /*------------------------------------------------------------------------- - * Function: H5FL_blk_init + * Function: H5FL__blk_init * * Purpose: Initialize a priority queue of a certain type. Right now, this just * adds the PQ to the list of things to garbage collect. @@ -796,17 +776,15 @@ done: * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_blk_init(H5FL_blk_head_t *head) +H5FL__blk_init(H5FL_blk_head_t *head) { H5FL_blk_gc_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ herr_t ret_value=SUCCEED; /* return value*/ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate a new garbage collection node */ if(NULL == (new_node = (H5FL_blk_gc_node_t *)H5MM_malloc(sizeof(H5FL_blk_gc_node_t)))) @@ -824,7 +802,7 @@ H5FL_blk_init(H5FL_blk_head_t *head) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_blk_init() */ +} /* end H5FL__blk_init() */ /*------------------------------------------------------------------------- @@ -839,8 +817,6 @@ done: * Programmer: Quincey Koziol * Monday, December 16, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ htri_t @@ -856,10 +832,11 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size) /* check if there is a free list for blocks of this size */ /* and if there are any blocks available on the list */ - if((free_list = H5FL_blk_find_list(&(head->head), size)) != NULL && free_list->list != NULL) + if((free_list = H5FL__blk_find_list(&(head->head), size)) != NULL && free_list->list != NULL) ret_value = TRUE; else ret_value = FALSE; + FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_blk_free_block_avail() */ @@ -878,8 +855,6 @@ H5FL_blk_free_block_avail(H5FL_blk_head_t *head, size_t size) * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -897,31 +872,40 @@ H5FL_blk_malloc(H5FL_blk_head_t *head, size_t size H5FL_TRACK_PARAMS) /* Make certain the list is initialized first */ if(!head->init) - if(H5FL_blk_init(head)<0) + if(H5FL__blk_init(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'block' list") /* check if there is a free list for blocks of this size */ /* and if there are any blocks available on the list */ - if((free_list=H5FL_blk_find_list(&(head->head),size))!=NULL && free_list->list!=NULL) { + if(NULL != (free_list = H5FL__blk_find_list(&(head->head), size)) && NULL != free_list->list) { /* Remove the first node from the free list */ temp=free_list->list; free_list->list=free_list->list->next; /* Decrement the number of blocks & memory used on free list */ + free_list->onlist--; head->onlist--; head->list_mem-=size; /* Decrement the amount of global "block" free list memory in use */ H5FL_blk_gc_head.mem_freed-=size; - } /* end if */ /* No free list available, or there are no nodes on the list, allocate a new node to give to the user */ else { + /* Check if there was no free list for native blocks of this size */ + if(NULL == free_list) + /* Create a new list node and insert it to the queue */ + free_list = H5FL__blk_create_list(&(head->head), size); + HDassert(free_list); + /* Allocate new node, with room for the page info header and the actual page data */ - if(NULL == (temp = (H5FL_blk_list_t *)H5FL_malloc(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE + size))) + if(NULL == (temp = (H5FL_blk_list_t *)H5FL__malloc(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE + size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed for chunk") - /* Increment the number of blocks allocated */ + /* Increment the number of blocks of this size */ + free_list->allocated++; + + /* Increment the total number of blocks allocated */ head->allocated++; } /* end else */ @@ -970,8 +954,6 @@ done: * Programmer: Quincey Koziol * Monday, December 23, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1011,8 +993,6 @@ done: * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1055,7 +1035,7 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) #endif /* H5FL_TRACK */ /* Get the pointer to the native block info header in front of the native block to free */ - temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - sizeof(H5FL_blk_list_t))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ + temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block - (sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE))); /*lint !e826 Pointer-to-pointer cast is appropriate here */ /* Save the block's size for later */ free_size=temp->size; @@ -1064,20 +1044,18 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block) HDmemset(temp,255,free_size + sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE); #endif /* H5FL_DEBUG */ - /* check if there is a free list for native blocks of this size */ - if((free_list=H5FL_blk_find_list(&(head->head),free_size))==NULL) { + /* Check if there is a free list for native blocks of this size */ + if(NULL == (free_list = H5FL__blk_find_list(&(head->head), free_size))) /* No free list available, create a new list node and insert it to the queue */ - free_list=H5FL_blk_create_list(&(head->head),free_size); - HDassert(free_list); - } /* end if */ + free_list = H5FL__blk_create_list(&(head->head), free_size); + HDassert(free_list); /* Prepend the free'd native block to the front of the free list */ - if(free_list!=NULL) { - temp->next=free_list->list; /* Overwrites the size field in union */ - free_list->list=temp; - } /* end if */ + temp->next = free_list->list; /* Note: Overwrites the size field in union */ + free_list->list = temp; /* Increment the number of blocks on free list */ + free_list->onlist++; head->onlist++; head->list_mem += free_size; @@ -1113,8 +1091,6 @@ done: * Programmer: Quincey Koziol * Thursday, March 23, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1191,44 +1167,70 @@ done: static herr_t H5FL__blk_gc_list(H5FL_blk_head_t *head) { + H5FL_blk_node_t *blk_head; /* Temp. ptr to the free list page node */ + FUNC_ENTER_STATIC_NOERR /* Loop through all the nodes in the block free list queue */ - while(head->head != NULL) { - H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */ - void *temp; /* Temp. ptr to the free list page node */ + blk_head = head->head; + while(blk_head != NULL) { + H5FL_blk_node_t *blk_next; /* Temp. ptr to the next free list node */ + H5FL_blk_list_t *list; /* The free list of native nodes of a particular size */ - temp = head->head->next; + /* Sanity check */ + HDassert((blk_head->onlist && blk_head->list) || (0 == blk_head->onlist && NULL == blk_head->list)); /* Loop through all the blocks in the free list, freeing them */ - list = head->head->list; + list = blk_head->list; while(list != NULL) { - void *next; /* Temp. ptr to the free list list node */ + H5FL_blk_list_t *next; /* Temp. ptr to the free list list node */ + /* Get the pointer to the next node */ next = list->next; - /* Decrement the number of blocks & memory allocated from this PQ */ - head->allocated--; - head->list_mem -= head->head->size; - - /* Decrement global count of free memory on "block" lists */ - H5FL_blk_gc_head.mem_freed -= head->head->size; - /* Free the block */ H5MM_free(list); - list = (H5FL_blk_list_t *)next; + /* Advance to the next node */ + list = next; } /* end while */ - /* Free the free list node */ - head->head = H5FL_FREE(H5FL_blk_node_t, head->head); + /* Decrement the number of blocks allocated from this list */ + blk_head->allocated -= blk_head->onlist; + head->allocated -= blk_head->onlist; + + /* Decrement count of free memory on this "block" list */ + head->list_mem -= (blk_head->onlist * blk_head->size); + + /* Decrement global count of free memory on "block" lists */ + H5FL_blk_gc_head.mem_freed -= (blk_head->onlist * blk_head->size); + + /* Indicate no free nodes on the free list */ + blk_head->list = NULL; + blk_head->onlist = 0; - /* Advance to the next free list */ - head->head = (H5FL_blk_node_t *)temp; + /* Get pointer to next node */ + blk_next = blk_head->next; + + /* Check for list completely unused now */ + if(0 == blk_head->allocated) { + /* Patch this node out of the PQ */ + if(head->head == blk_head) + head->head = blk_head->next; + if(blk_head->prev) + blk_head->prev->next = blk_head->next; + if(blk_head->next) + blk_head->next->prev = blk_head->prev; + + /* Free the free list node */ + H5FL_FREE(H5FL_blk_node_t, blk_head); + } /* end if */ + + /* Advance to the next node */ + blk_head = blk_next; } /* end while */ /* Indicate no free nodes on the free list */ - head->head = NULL; head->onlist = 0; /* Double check that all the memory on this list is recycled */ @@ -1257,7 +1259,7 @@ H5FL__blk_gc(void) H5FL_blk_gc_node_t *gc_node; /* Pointer into the list of things to garbage collect */ herr_t ret_value = SUCCEED; /* return value*/ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Walk through all the free lists, free()'ing the nodes */ gc_node = H5FL_blk_gc_head.first; @@ -1341,7 +1343,7 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.f /*------------------------------------------------------------------------- - * Function: H5FL_arr_init + * Function: H5FL__arr_init * * Purpose: Initialize a free list for a arrays of certain type. Right now, * this just adds the free list to the list of things to garbage collect. @@ -1352,18 +1354,16 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.f * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ static herr_t -H5FL_arr_init(H5FL_arr_head_t *head) +H5FL__arr_init(H5FL_arr_head_t *head) { H5FL_gc_arr_node_t *new_node; /* Pointer to the node for the new list to garbage collect */ size_t u; /* Local index variable */ herr_t ret_value=SUCCEED; /* return value*/ - FUNC_ENTER_NOAPI_NOINIT + FUNC_ENTER_STATIC /* Allocate a new garbage collection node */ if(NULL == (new_node = (H5FL_gc_arr_node_t *)H5MM_malloc(sizeof(H5FL_gc_arr_node_t)))) @@ -1389,7 +1389,7 @@ H5FL_arr_init(H5FL_arr_head_t *head) done: FUNC_LEAVE_NOAPI(ret_value) -} /* end H5FL_arr_init() */ +} /* end H5FL__arr_init() */ /*------------------------------------------------------------------------- @@ -1403,8 +1403,6 @@ done: * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1481,8 +1479,6 @@ done: * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1500,7 +1496,7 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem) /* Make certain the list is initialized first */ if(!head->init) - if(H5FL_arr_init(head)<0) + if(H5FL__arr_init(head) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTINIT, NULL, "can't initialize 'array' blocks") /* Sanity check that the number of elements is supported */ @@ -1527,10 +1523,13 @@ H5FL_arr_malloc(H5FL_arr_head_t *head, size_t elem) } /* end if */ /* Otherwise allocate a node */ else { - if(NULL == (new_obj = (H5FL_arr_list_t *)H5FL_malloc(sizeof(H5FL_arr_list_t)+mem_size))) + if(NULL == (new_obj = (H5FL_arr_list_t *)H5FL__malloc(sizeof(H5FL_arr_list_t)+mem_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") - /* Increment the number of blocks allocated in list */ + /* Increment the number of blocks of this size */ + head->list_arr[elem].allocated++; + + /* Increment the number of blocks allocated in list, of all sizes */ head->allocated++; } /* end else */ @@ -1556,8 +1555,6 @@ done: * Programmer: Quincey Koziol * Monday, December 23, 2002 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1594,8 +1591,6 @@ done: * Programmer: Quincey Koziol * Saturday, March 25, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1667,34 +1662,35 @@ H5FL__arr_gc_list(H5FL_arr_head_t *head) for(u = 0; u < (unsigned)head->maxelem; u++) { if(head->list_arr[u].onlist > 0) { H5FL_arr_list_t *arr_free_list; /* Pointer to nodes in free list being garbage collected */ - size_t total_mem; /* Total memory used on list */ - - /* Calculate the total memory used on this list */ - total_mem = head->list_arr[u].onlist * head->list_arr[u].size; /* For each free list being garbage collected, walk through the nodes and free them */ arr_free_list = head->list_arr[u].list; while(arr_free_list != NULL) { - void *tmp; /* Temporary node pointer */ + H5FL_arr_list_t *tmp; /* Temporary node pointer */ + /* Get the pointer to the next node */ tmp = arr_free_list->next; - /* Decrement the count of nodes allocated and free the node */ - head->allocated--; + /* Free the node */ H5MM_free(arr_free_list); - arr_free_list = (H5FL_arr_list_t *)tmp; + /* Advance to the next node */ + arr_free_list = tmp; } /* end while */ - /* Indicate no free nodes on the free list */ - head->list_arr[u].list = NULL; - head->list_arr[u].onlist = 0; + /* Decrement the count of nodes allocated */ + head->list_arr[u].allocated -= head->list_arr[u].onlist; + head->allocated -= head->list_arr[u].onlist; /* Decrement count of free memory on this "array" list */ - head->list_mem -= total_mem; + head->list_mem -= (head->list_arr[u].onlist * head->list_arr[u].size); /* Decrement global count of free memory on "array" lists */ - H5FL_arr_gc_head.mem_freed -= total_mem; + H5FL_arr_gc_head.mem_freed -= (head->list_arr[u].onlist * head->list_arr[u].size); + + /* Indicate no free nodes on the free list */ + head->list_arr[u].list = NULL; + head->list_arr[u].onlist = 0; } /* end if */ } /* end for */ @@ -1820,8 +1816,6 @@ HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.f * Programmer: Quincey Koziol * Saturday, April 3, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1856,8 +1850,6 @@ H5FL_seq_free(H5FL_seq_head_t *head, void *obj) * Programmer: Quincey Koziol * Saturday, April 3, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1889,8 +1881,6 @@ H5FL_seq_malloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) * Programmer: Quincey Koziol * Saturday, April 3, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1922,8 +1912,6 @@ H5FL_seq_calloc(H5FL_seq_head_t *head, size_t elem H5FL_TRACK_PARAMS) * Programmer: Quincey Koziol * Saturday, April 3, 2004 * - * Modifications: - * *------------------------------------------------------------------------- */ void * @@ -1955,11 +1943,6 @@ H5FL_seq_realloc(H5FL_seq_head_t *head, void * obj, size_t new_elem H5FL_TRACK_P * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ H5FL_fac_head_t * @@ -2032,11 +2015,6 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ void * @@ -2120,11 +2098,6 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ void * @@ -2155,7 +2128,7 @@ H5FL_fac_malloc(H5FL_fac_head_t *head H5FL_TRACK_PARAMS) } /* end if */ /* Otherwise allocate a node */ else { - if (NULL==(ret_value = H5FL_malloc(head->size))) + if(NULL == (ret_value = H5FL__malloc(head->size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, NULL, "memory allocation failed") /* Increment the number of blocks allocated in list */ @@ -2197,11 +2170,6 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ void * @@ -2245,35 +2213,34 @@ static herr_t H5FL__fac_gc_list(H5FL_fac_head_t *head) { H5FL_fac_node_t *free_list; /* Pointer to nodes in free list being garbage collected */ - size_t total_mem; /* Total memory used on list */ FUNC_ENTER_STATIC_NOERR - /* Calculate the total memory used on this list */ - total_mem = head->onlist * head->size; - /* For each free list being garbage collected, walk through the nodes and free them */ free_list = head->list; while(free_list != NULL) { - void *tmp; /* Temporary node pointer */ + H5FL_fac_node_t *tmp; /* Temporary node pointer */ + /* Get the pointer to the next node */ tmp = free_list->next; - /* Decrement the count of nodes allocated and free the node */ - head->allocated--; - + /* Free the block */ H5MM_free(free_list); - free_list = (H5FL_fac_node_t *)tmp; + /* Advance to the next node */ + free_list = tmp; } /* end while */ + /* Decrement the count of nodes allocated and free the node */ + head->allocated -= head->onlist; + + /* Decrement global count of free memory on "factory" lists */ + H5FL_fac_gc_head.mem_freed -= (head->onlist * head->size); + /* Indicate no free nodes on the free list */ head->list = NULL; head->onlist = 0; - /* Decrement global count of free memory on "factory" lists */ - H5FL_fac_gc_head.mem_freed -= total_mem; - FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FL__fac_gc_list() */ @@ -2329,11 +2296,6 @@ done: * Programmer: Quincey Koziol * Wednesday, February 2, 2005 * - * Modifications: - * Neil Fortner - * Friday, December 19, 2008 - * Totally rewritten to support new factory implementation - * *------------------------------------------------------------------------- */ herr_t @@ -2438,8 +2400,6 @@ HDprintf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_h * Programmer: Quincey Koziol * Friday, March 24, 2000 * - * Modifications: - * *------------------------------------------------------------------------- */ herr_t @@ -2495,10 +2455,6 @@ done: * Programmer: Quincey Koziol * Wednesday, August 2, 2000 * - * Modifications: Neil Fortner - * Wednesday, April 8, 2009 - * Added support for factory free lists - * *------------------------------------------------------------------------- */ herr_t @@ -2531,3 +2487,127 @@ H5FL_set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_l FUNC_LEAVE_NOAPI(ret_value) } /* end H5FL_set_free_list_limits() */ + +/*------------------------------------------------------------------------- + * Function: H5FL_get_free_list_sizes + * + * Purpose: Gets the current size of the different kinds of free lists. + * These lists are global for the entire library. The size returned + * included nodes that are freed and awaiting garbage collection / + * reallocation. + * + * Parameters: + * size_t *reg_size; OUT: The current size of all "regular" free list memory used + * size_t *arr_size; OUT: The current size of all "array" free list memory used + * size_t *blk_size; OUT: The current size of all "block" free list memory used + * size_t *fac_size; OUT: The current size of all "factory" free list memory used + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Friday, March 6, 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, + size_t *fac_size) +{ + FUNC_ENTER_NOAPI_NOERR + + /* Retrieve the amount of "regular" memory used */ + if(reg_size) { + H5FL_reg_gc_node_t *gc_node; /* Pointer into the list of lists */ + + /* Walk through all the free lists, counting the amount of memory */ + *reg_size = 0; + gc_node = H5FL_reg_gc_head.first; + while(gc_node != NULL) { + H5FL_reg_head_t *reg_list = gc_node->list; /* Head of list */ + + /* Sanity check */ + HDassert(reg_list->init); + + /* Add the amount of memory for this list */ + *reg_size += (reg_list->size * reg_list->allocated); + + /* Go on to the next free list */ + gc_node = gc_node->next; + } /* end while */ + } /* end if */ + + /* Retrieve the amount of "array" memory used */ + if(arr_size) { + H5FL_gc_arr_node_t *gc_arr_node; /* Pointer into the list of things to garbage collect */ + + /* Walk through all the free lists, counting the amount of memory */ + *arr_size = 0; + gc_arr_node = H5FL_arr_gc_head.first; + while(gc_arr_node != NULL) { + H5FL_arr_head_t *head = gc_arr_node->list; /* Head of array list elements */ + + /* Sanity check */ + HDassert(head->init); + + /* Check for any allocated elements in this list */ + if(head->allocated > 0) { + unsigned u; + + /* Walk through the free lists for array sizes */ + for(u = 0; u < (unsigned)head->maxelem; u++) + /* Add the amount of memory for this size */ + *arr_size += head->list_arr[u].allocated * head->list_arr[u].size; + } /* end if */ + + /* Go on to the next free list */ + gc_arr_node = gc_arr_node->next; + } /* end while */ + } /* end if */ + + /* Retrieve the amount of "block" memory used */ + if(blk_size) { + H5FL_blk_gc_node_t *gc_blk_node; /* Pointer into the list of things */ + + /* Walk through all the free lists */ + gc_blk_node = H5FL_blk_gc_head.first; + *blk_size = 0; + while(gc_blk_node != NULL) { + H5FL_blk_node_t *blk_head; /* Temp. ptr to the free list block node */ + + /* Loop through all the nodes in the block free list queue */ + blk_head = gc_blk_node->pq->head; + while(blk_head != NULL) { + /* Add size of blocks on this list */ + *blk_size += (blk_head->allocated * blk_head->size); + + /* Get pointer to next node */ + blk_head = blk_head->next; + } /* end while */ + + /* Go on to the next free list */ + gc_blk_node = gc_blk_node->next; + } /* end while */ + } /* end if */ + + /* Retrieve the amount of "factory" memory used */ + if(fac_size) { + H5FL_fac_gc_node_t *gc_fac_node; /* Pointer into the list of things to garbage collect */ + + /* Walk through all the free lists */ + gc_fac_node = H5FL_fac_gc_head.first; + *fac_size = 0; + while(gc_fac_node != NULL) { + H5FL_fac_head_t *fac_head = gc_fac_node->list; /* Head node for factory list */ + + /* Add size of blocks on this list */ + *fac_size += (fac_head->allocated * fac_head->size); + + /* Go on to the next free list to garbage collect */ + gc_fac_node = gc_fac_node->next; + } /* end while */ + } /* end if */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5FL_get_free_list_sizes() */ + diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index d5a68d7..94a51e5 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -157,6 +157,8 @@ typedef union H5FL_blk_list_t { /* Data structure for priority queue node of block free lists */ typedef struct H5FL_blk_node_t { size_t size; /* Size of the blocks in the list */ + unsigned allocated; /* Number of blocks of this size allocated */ + unsigned onlist; /* Number of blocks on free list */ H5FL_blk_list_t *list; /* List of free blocks */ struct H5FL_blk_node_t *next; /* Pointer to next free list in queue */ struct H5FL_blk_node_t *prev; /* Pointer to previous free list in queue */ @@ -165,9 +167,9 @@ typedef struct H5FL_blk_node_t { /* Data structure for priority queue of native block free lists */ typedef struct H5FL_blk_head_t { hbool_t init; /* Whether the free list has been initialized */ - unsigned allocated; /* Number of blocks allocated */ - unsigned onlist; /* Number of blocks on free list */ - size_t list_mem; /* Amount of memory in block on free list */ + unsigned allocated; /* Total number of blocks allocated */ + unsigned onlist; /* Total number of blocks on free list */ + size_t list_mem; /* Total amount of memory in blocks on free list */ const char *name; /* Name of the type */ H5FL_blk_node_t *head; /* Pointer to first free list in queue */ } H5FL_blk_head_t; @@ -228,7 +230,9 @@ typedef union H5FL_arr_list_t { /* Data structure for each size of array element */ typedef struct H5FL_arr_node_t { - size_t size; /* Size of the blocks in the list */ + size_t size; /* Size of the blocks in the list (in bytes) */ + /* (Note: base_size + <# of elem> * elem_size) */ + unsigned allocated; /* Number of blocks allocated of this element size */ unsigned onlist; /* Number of blocks on free list */ H5FL_arr_list_t *list; /* List of free blocks */ } H5FL_arr_node_t; @@ -236,7 +240,7 @@ typedef struct H5FL_arr_node_t { /* Data structure for free list of array blocks */ typedef struct H5FL_arr_head_t { hbool_t init; /* Whether the free list has been initialized */ - unsigned allocated; /* Number of blocks allocated */ + unsigned allocated; /* Total number of blocks allocated */ size_t list_mem; /* Amount of memory in block on free list */ const char *name; /* Name of the type */ int maxelem; /* Maximum number of elements in an array */ @@ -423,6 +427,8 @@ H5_DLL herr_t H5FL_garbage_coll(void); H5_DLL herr_t H5FL_set_free_list_limits(int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim, int fac_global_lim, int fac_list_lim); +H5_DLL herr_t H5FL_get_free_list_sizes(size_t *reg_size, size_t *arr_size, + size_t *blk_size, size_t *fac_size); H5_DLL int H5FL_term_interface(void); #endif diff --git a/src/H5MM.c b/src/H5MM.c index 94bd542..4fbecd4 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -108,8 +108,8 @@ static H5MM_block_t H5MM_block_head_s; /* Statistics about block allocations */ static unsigned long long H5MM_total_alloc_bytes_s = 0; -static unsigned long long H5MM_curr_alloc_bytes_s = 0; -static unsigned long long H5MM_peak_alloc_bytes_s = 0; +static size_t H5MM_curr_alloc_bytes_s = 0; +static size_t H5MM_peak_alloc_bytes_s = 0; static size_t H5MM_max_block_size_s = 0; static size_t H5MM_total_alloc_blocks_count_s = 0; static size_t H5MM_curr_alloc_blocks_count_s = 0; @@ -235,7 +235,7 @@ H5MM_final_sanity_check(void) HDassert(H5MM_block_head_s.prev == &H5MM_block_head_s); #ifdef H5MM_PRINT_MEMORY_STATS HDfprintf(stderr, "%s: H5MM_total_alloc_bytes_s = %llu\n", __func__, H5MM_total_alloc_bytes_s); - HDfprintf(stderr, "%s: H5MM_peak_alloc_bytes_s = %llu\n", __func__, H5MM_peak_alloc_bytes_s); + HDfprintf(stderr, "%s: H5MM_peak_alloc_bytes_s = %zu\n", __func__, H5MM_peak_alloc_bytes_s); HDfprintf(stderr, "%s: H5MM_max_block_size_s = %zu\n", __func__, H5MM_max_block_size_s); HDfprintf(stderr, "%s: H5MM_total_alloc_blocks_count_s = %zu\n", __func__, H5MM_total_alloc_blocks_count_s); HDfprintf(stderr, "%s: H5MM_peak_alloc_blocks_count_s = %zu\n", __func__, H5MM_peak_alloc_blocks_count_s); @@ -625,3 +625,71 @@ H5MM_memcpy(void *dest, const void *src, size_t n) } /* end H5MM_memcpy() */ + +/*------------------------------------------------------------------------- + * Function: H5MM_get_alloc_stats + * + * Purpose: Gets the memory allocation statistics for the library, if the + * H5_MEMORY_ALLOC_SANITY_CHECK macro is defined. If the macro is not + * defined, zeros are returned. These statistics are global for the + * entire library. + * + * Parameters: + * unsigned long long *total_alloc_bytes; OUT: Running count of total # of bytes allocated + * size_t *curr_alloc_bytes; OUT: Current # of bytes allocated + * size_t *peak_alloc_bytes; OUT: Peak # of bytes allocated + * size_t *max_block_size; OUT: Largest block allocated + * size_t *total_alloc_blocks_count; OUT: Running count of total # of blocks allocated + * size_t *curr_alloc_blocks_count; OUT: Current # of blocks allocated + * size_t *peak_alloc_blocks_count; OUT: Peak # of blocks allocated + * + * Return: Success: non-negative + * Failure: negative + * + * Programmer: Quincey Koziol + * Saturday, March 7, 2020 + * + *------------------------------------------------------------------------- + */ +herr_t +H5MM_get_alloc_stats(unsigned long long *total_alloc_bytes, size_t *curr_alloc_bytes, + size_t *peak_alloc_bytes, size_t *max_block_size, size_t *total_alloc_blocks_count, + size_t *curr_alloc_blocks_count, size_t *peak_alloc_blocks_count) +{ + FUNC_ENTER_NOAPI_NOERR + +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + if(total_alloc_bytes) + *total_alloc_bytes = H5MM_total_alloc_bytes_s; + if(curr_alloc_bytes) + *curr_alloc_bytes = H5MM_curr_alloc_bytes_s; + if(peak_alloc_bytes) + *peak_alloc_bytes = H5MM_peak_alloc_bytes_s; + if(max_block_size) + *max_block_size = H5MM_max_block_size_s; + if(total_alloc_blocks_count) + *total_alloc_blocks_count = H5MM_total_alloc_blocks_count_s; + if(curr_alloc_blocks_count) + *curr_alloc_blocks_count = H5MM_curr_alloc_blocks_count_s; + if(peak_alloc_blocks_count) + *peak_alloc_blocks_count = H5MM_peak_alloc_blocks_count_s; +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ + if(total_alloc_bytes) + *total_alloc_bytes = 0; + if(curr_alloc_bytes) + *curr_alloc_bytes = 0; + if(peak_alloc_bytes) + *peak_alloc_bytes = 0; + if(max_block_size) + *max_block_size = 0; + if(total_alloc_blocks_count) + *total_alloc_blocks_count = 0; + if(curr_alloc_blocks_count) + *curr_alloc_blocks_count = 0; + if(peak_alloc_blocks_count) + *peak_alloc_blocks_count = 0; +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + + FUNC_LEAVE_NOAPI(SUCCEED) +} /* end H5get_alloc_stats() */ + diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index 240b931..3bf8c49 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -47,6 +47,9 @@ H5_DLL char *H5MM_strdup(const char *s); H5_DLL void *H5MM_xfree(void *mem); H5_DLL void *H5MM_xfree_const(const void *mem); H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n); +H5_DLL herr_t H5MM_get_alloc_stats(unsigned long long *total_alloc_bytes, size_t *curr_alloc_bytes, + size_t *peak_alloc_bytes, size_t *max_block_size, size_t *total_alloc_blocks_count, + size_t *curr_alloc_blocks_count, size_t *peak_alloc_blocks_count); #if defined H5_MEMORY_ALLOC_SANITY_CHECK H5_DLL void H5MM_sanity_check_all(void); H5_DLL void H5MM_final_sanity_check(void); diff --git a/src/H5Tconv.c b/src/H5Tconv.c index 29fd582..2b1283e 100644 --- a/src/H5Tconv.c +++ b/src/H5Tconv.c @@ -3213,7 +3213,7 @@ H5T__conv_vlen(hid_t src_id, hid_t dst_id, H5T_cdata_t *cdata, size_t nelmts, * necessary. If the SEQ_LEN is 0, allocate a minimal size buffer. */ if(!seq_len && !conv_buf) { - conv_buf_size = ((1 / H5T_VLEN_MIN_CONF_BUF_SIZE) + 1) * H5T_VLEN_MIN_CONF_BUF_SIZE; + conv_buf_size = H5T_VLEN_MIN_CONF_BUF_SIZE; if(NULL == (conv_buf = H5FL_BLK_CALLOC(vlen_seq, conv_buf_size))) HGOTO_ERROR(H5E_RESOURCE, H5E_NOSPACE, FAIL, "memory allocation failed for type conversion") } /* end if */ diff --git a/src/H5public.h b/src/H5public.h index 3312cf4..60bad93 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -386,6 +386,11 @@ H5_DLL herr_t H5garbage_collect(void); H5_DLL herr_t H5set_free_list_limits (int reg_global_lim, int reg_list_lim, int arr_global_lim, int arr_list_lim, int blk_global_lim, int blk_list_lim); +H5_DLL herr_t H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, + size_t *blk_size, size_t *fac_size); +H5_DLL herr_t H5get_alloc_stats(unsigned long long *total_alloc_bytes, size_t *curr_alloc_bytes, + size_t *peak_alloc_bytes, size_t *max_block_size, size_t *total_alloc_blocks_count, + size_t *curr_alloc_blocks_count, size_t *peak_alloc_blocks_count); H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum); H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, diff --git a/src/H5trace.c b/src/H5trace.c index 7168d5d..03d9e7c 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -155,7 +155,7 @@ H5_trace(const double *returning, const char *func, const char *type, ...) } /* end if */ /* Get time for event */ - if(H5_DBL_ABS_EQUAL(first_time.etime, 0.0)) + if(H5_DBL_ABS_EQUAL(first_time.etime, (double)0.0f)) H5_timer_begin(&first_time); if(H5_debug_g.ttimes) H5_timer_begin(&event_time); diff --git a/test/tmisc.c b/test/tmisc.c index 0ea9c4c..a555b3e 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -329,6 +329,14 @@ typedef struct /* and bad offset values are written to that file for testing */ #define MISC33_FILE "bad_offset.h5" +/* Definitions for misc. test #35 */ +#define MISC35_SPACE_RANK 3 +#define MISC35_SPACE_DIM1 3 +#define MISC35_SPACE_DIM2 15 +#define MISC35_SPACE_DIM3 13 +#define MISC35_NPOINTS 10 + + /**************************************************************** ** ** test_misc1(): test unlinking a dataset from a group and immediately @@ -5684,6 +5692,136 @@ test_misc34(void) /**************************************************************** ** +** test_misc35(): Check operation of free-list routines +** +****************************************************************/ +static void +test_misc35(void) +{ + hid_t sid = H5I_INVALID_HID; /* Dataspace ID */ + hsize_t dims[] = {MISC35_SPACE_DIM1, MISC35_SPACE_DIM2, MISC35_SPACE_DIM3}; /* Dataspace dims */ + hsize_t coord[MISC35_NPOINTS][MISC35_SPACE_RANK]; /* Coordinates for point selection */ + size_t reg_size_start; /* Initial amount of regular memory allocated */ + size_t arr_size_start; /* Initial amount of array memory allocated */ + size_t blk_size_start; /* Initial amount of block memory allocated */ + size_t fac_size_start; /* Initial amount of factory memory allocated */ + size_t reg_size_final; /* Final amount of regular memory allocated */ + size_t arr_size_final; /* Final amount of array memory allocated */ + size_t blk_size_final; /* Final amount of block memory allocated */ + size_t fac_size_final; /* Final amount of factory memory allocated */ + unsigned long long total_alloc_bytes; /* Running count of total # of bytes allocated */ + size_t curr_alloc_bytes; /* Current # of bytes allocated */ + size_t peak_alloc_bytes; /* Peak # of bytes allocated */ + size_t max_block_size; /* Largest block allocated */ + size_t total_alloc_blocks_count; /* Running count of total # of blocks allocated */ + size_t curr_alloc_blocks_count; /* Current # of blocks allocated */ + size_t peak_alloc_blocks_count; /* Peak # of blocks allocated */ + herr_t ret; /* Return value */ + + /* Output message about test being performed */ + MESSAGE(5, ("Free-list API calls")); + + /* Create dataspace */ + /* (Allocates array free-list nodes) */ + sid = H5Screate_simple(MISC35_SPACE_RANK, dims, NULL); + CHECK(sid, H5I_INVALID_HID, "H5Screate_simple"); + + /* Select sequence of ten points */ + coord[0][0]=0; coord[0][1]=10; coord[0][2]= 5; + coord[1][0]=1; coord[1][1]= 2; coord[1][2]= 7; + coord[2][0]=2; coord[2][1]= 4; coord[2][2]= 9; + coord[3][0]=0; coord[3][1]= 6; coord[3][2]=11; + coord[4][0]=1; coord[4][1]= 8; coord[4][2]=13; + coord[5][0]=2; coord[5][1]=12; coord[5][2]= 0; + coord[6][0]=0; coord[6][1]=14; coord[6][2]= 2; + coord[7][0]=1; coord[7][1]= 0; coord[7][2]= 4; + coord[8][0]=2; coord[8][1]= 1; coord[8][2]= 6; + coord[9][0]=0; coord[9][1]= 3; coord[9][2]= 8; + ret = H5Sselect_elements(sid, H5S_SELECT_SET, (size_t)MISC35_NPOINTS, (const hsize_t *)coord); + CHECK(ret, FAIL, "H5Sselect_elements"); + + /* Close dataspace */ + ret = H5Sclose(sid); + CHECK(ret, FAIL, "H5Sclose"); + + + /* Retrieve initial free list values */ + ret = H5get_free_list_sizes(®_size_start, &arr_size_start, &blk_size_start, &fac_size_start); + CHECK(ret, FAIL, "H5get_free_list_sizes"); + + /* All the free list values should be >0 */ + if(0 == reg_size_start) + ERROR("reg_size_start == 0"); + if(0 == arr_size_start) + ERROR("arr_size_start == 0"); + if(0 == blk_size_start) + ERROR("blk_size_start == 0"); + if(0 == fac_size_start) + ERROR("fac_size_start == 0"); + + /* Garbage collect the free lists */ + ret = H5garbage_collect(); + CHECK(ret, FAIL, "H5garbage_collect"); + + /* Retrieve free list values again */ + ret = H5get_free_list_sizes(®_size_final, &arr_size_final, &blk_size_final, &fac_size_final); + CHECK(ret, FAIL, "H5get_free_list_sizes"); + + /* All the free list values should be <= previous values */ + if(reg_size_final > reg_size_start) + ERROR("reg_size_final > reg_size_start"); + if(arr_size_final > arr_size_start) + ERROR("arr_size_final > arr_size_start"); + if(blk_size_final > blk_size_start) + ERROR("blk_size_final > blk_size_start"); + if(fac_size_final > fac_size_start) + ERROR("fac_size_final > fac_size_start"); + + /* Retrieve memory allocation statistics */ + ret = H5get_alloc_stats(&total_alloc_bytes, &curr_alloc_bytes, + &peak_alloc_bytes, &max_block_size, &total_alloc_blocks_count, + &curr_alloc_blocks_count, &peak_alloc_blocks_count); + CHECK(ret, FAIL, "H5get_alloc_stats"); + +#if defined H5_MEMORY_ALLOC_SANITY_CHECK + /* All the values should be >0 */ + if(0 == total_alloc_bytes) + ERROR("total_alloc_bytes == 0"); + if(0 == curr_alloc_bytes) + ERROR("curr_alloc_bytes == 0"); + if(0 == peak_alloc_bytes) + ERROR("peak_alloc_bytes == 0"); + if(0 == max_block_size) + ERROR("max_block_size == 0"); + if(0 == total_alloc_blocks_count) + ERROR("total_alloc_blocks_count == 0"); + if(0 == curr_alloc_blocks_count) + ERROR("curr_alloc_blocks_count == 0"); + if(0 == peak_alloc_blocks_count) + ERROR("peak_alloc_blocks_count == 0"); +#else /* H5_MEMORY_ALLOC_SANITY_CHECK */ + /* All the values should be == 0 */ + if(0 != total_alloc_bytes) + ERROR("total_alloc_bytes != 0"); + if(0 != curr_alloc_bytes) + ERROR("curr_alloc_bytes != 0"); + if(0 != peak_alloc_bytes) + ERROR("peak_alloc_bytes != 0"); + if(0 != max_block_size) + ERROR("max_block_size != 0"); + if(0 != total_alloc_blocks_count) + ERROR("total_alloc_blocks_count != 0"); + if(0 != curr_alloc_blocks_count) + ERROR("curr_alloc_blocks_count != 0"); + if(0 != peak_alloc_blocks_count) + ERROR("peak_alloc_blocks_count != 0"); +#endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ + +} /* end test_misc35() */ + + +/**************************************************************** +** ** test_misc(): Main misc. test routine. ** ****************************************************************/ @@ -5731,6 +5869,7 @@ test_misc(void) test_misc32(); /* Test filter memory allocation functions */ test_misc33(); /* Test to verify that H5HL_offset_into() returns error if offset exceeds heap block */ test_misc34(); /* Test behavior of 0 and NULL in H5MM API calls */ + test_misc35(); /* Test behavior of free-list & allocation statistics API calls */ } /* test_misc() */ -- cgit v0.12 From 3d29cbb27fd6e9beeb3213b6ee3f7f6c7c5bc37d Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Thu, 12 Mar 2020 13:21:11 -0700 Subject: Very minor comment change in H5VLconnector.h. --- src/H5VLconnector.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/H5VLconnector.h b/src/H5VLconnector.h index 39d9b14..7951a32 100644 --- a/src/H5VLconnector.h +++ b/src/H5VLconnector.h @@ -194,7 +194,7 @@ typedef enum H5VL_object_get_t { H5VL_OBJECT_GET_FILE, /* object file */ H5VL_OBJECT_GET_NAME, /* object name */ H5VL_OBJECT_GET_TYPE, /* object type */ - H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name)3 */ + H5VL_OBJECT_GET_INFO /* H5Oget_info(_by_idx|name) */ } H5VL_object_get_t; /* types for object SPECIFIC callback */ -- cgit v0.12 From 81b1ed4e1724b8a6a731ab2b8fb03234a8b49d15 Mon Sep 17 00:00:00 2001 From: Vailin Choi Date: Fri, 13 Mar 2020 11:22:22 -0500 Subject: Fix issues when deserializing point/all/none selection with version beyond the library's supported version: (1) Verify the decoded version before proceeding further with deserialization (2) Close the dataspace if errors occurred after opening the dataspace --- src/H5Rint.c | 8 +++++++- src/H5Sall.c | 3 +++ src/H5Snone.c | 3 +++ src/H5Spkg.h | 11 +++++++---- src/H5Spoint.c | 3 +++ 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/src/H5Rint.c b/src/H5Rint.c index 1df8a20..30f3dbb 100644 --- a/src/H5Rint.c +++ b/src/H5Rint.c @@ -1768,6 +1768,7 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, H5O_token_t token = { 0 }; size_t data_size; const uint8_t *p; + H5S_t *space = NULL; herr_t ret_value = SUCCEED; FUNC_ENTER_PACKAGE @@ -1788,7 +1789,6 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, if(space_ptr) { H5O_loc_t oloc; /* Object location */ - H5S_t *space = NULL; /* Initialize the object location */ H5O_loc_reset(&oloc); @@ -1812,6 +1812,12 @@ H5R__decode_token_region_compat(H5F_t *f, const unsigned char *buf, done: H5MM_free(data); + + if(ret_value < 0) { + if(space && H5S_close(space) < 0) + HDONE_ERROR(H5E_DATASET, H5E_CLOSEERROR, FAIL, "unable to release dataspace") + } + FUNC_LEAVE_NOAPI(ret_value) } /* end H5R__decode_token_region_compat() */ diff --git a/src/H5Sall.c b/src/H5Sall.c index 4a4245d..77fb582 100644 --- a/src/H5Sall.c +++ b/src/H5Sall.c @@ -690,6 +690,9 @@ H5S__all_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(*p, version); + if(version < H5S_ALL_VERSION_1 || version > H5S_ALL_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for all selection") + /* Skip over the remainder of the header */ *p += 8; diff --git a/src/H5Snone.c b/src/H5Snone.c index 0949b2a..630d1d5 100644 --- a/src/H5Snone.c +++ b/src/H5Snone.c @@ -648,6 +648,9 @@ H5S__none_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(*p, version); + if(version < H5S_NONE_VERSION_1 || version > H5S_NONE_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for none selection") + /* Skip over the remainder of the header */ *p += 8; diff --git a/src/H5Spkg.h b/src/H5Spkg.h index e139bce..da2dd4a 100644 --- a/src/H5Spkg.h +++ b/src/H5Spkg.h @@ -47,14 +47,17 @@ #define H5S_HYPER_VERSION_LATEST H5S_HYPER_VERSION_3 /* Versions for H5S_SEL_POINTS selection info */ -#define H5S_POINT_VERSION_1 1 -#define H5S_POINT_VERSION_2 2 +#define H5S_POINT_VERSION_1 1 +#define H5S_POINT_VERSION_2 2 +#define H5S_POINT_VERSION_LATEST H5S_POINT_VERSION_2 /* Versions for H5S_SEL_NONE selection info */ -#define H5S_NONE_VERSION_1 1 +#define H5S_NONE_VERSION_1 1 +#define H5S_NONE_VERSION_LATEST H5S_NONE_VERSION_1 /* Versions for H5S_SEL_ALL selection info */ -#define H5S_ALL_VERSION_1 1 +#define H5S_ALL_VERSION_1 1 +#define H5S_ALL_VERSION_LATEST H5S_ALL_VERSION_1 /* Encoded size of selection info for H5S_SEL_POINTS/H5S_SEL_HYPER */ #define H5S_SELECT_INFO_ENC_SIZE_2 0x02 /* 2 bytes: 16 bits */ diff --git a/src/H5Spoint.c b/src/H5Spoint.c index 721211e..6948125 100644 --- a/src/H5Spoint.c +++ b/src/H5Spoint.c @@ -1413,6 +1413,9 @@ H5S__point_deserialize(H5S_t **space, const uint8_t **p) /* Decode version */ UINT32DECODE(pp, version); + if(version < H5S_POINT_VERSION_1 || version > H5S_POINT_VERSION_LATEST) + HGOTO_ERROR(H5E_DATASPACE, H5E_BADVALUE, FAIL, "bad version number for point selection") + if(version >= (uint32_t)H5S_POINT_VERSION_2) /* Decode size of point info */ enc_size = *(pp)++; -- cgit v0.12 From 6be711bbd2b86de5bcd8f092d8f27d6b2251c111 Mon Sep 17 00:00:00 2001 From: Allen Byrne Date: Wed, 18 Mar 2020 15:31:27 -0500 Subject: Fix threadsafe for new test --- test/CMakeLists.txt | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 2594477..7929e2c 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -287,7 +287,7 @@ set (H5_TESTS cache_logging cork swmr - thread_id + thread_id # special link vol ) @@ -310,6 +310,7 @@ set (H5_TESTS_MULTIPLE testhdf5 cache_image ttsafe + thread_id # special link ) # Only build single source tests here foreach (h5_test ${H5_TESTS}) @@ -389,6 +390,24 @@ else () endif () set_target_properties (ttsafe PROPERTIES FOLDER test) +######### Special handling for extra link lib of threads ############# +#-- Adding test for thread_id +add_executable (thread_id ${HDF5_TEST_SOURCE_DIR}/thread_id.c) +target_include_directories (thread_id PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>") +if (NOT BUILD_SHARED_LIBS) + TARGET_C_PROPERTIES (thread_id STATIC) + target_link_libraries (thread_id PRIVATE ${HDF5_TEST_LIB_TARGET}) + if (NOT WIN32) + target_link_libraries (thread_id + PRIVATE $<$:Threads::Threads> + ) + endif () +else () + TARGET_C_PROPERTIES (thread_id SHARED) + target_link_libraries (thread_id PRIVATE ${HDF5_TEST_LIBSH_TARGET} $<$:Threads::Threads>) +endif () +set_target_properties (thread_id PROPERTIES FOLDER test) + ############################################################################## ### A D D I T I O N A L T E S T S ### ############################################################################## -- cgit v0.12 From 693008ecaff187a2551cfdf22fab618ff631658f Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 18 Mar 2020 13:58:02 -0700 Subject: Fix shutdown errors when using the HDF5_VOL_CONNECTOR environment variable to set a dynamically loaded plugin as the default VOL connector. Fixes HDFFV-11057 --- release_docs/RELEASE.txt | 12 ++++++++++++ src/H5.c | 4 +++- src/H5VLint.c | 2 +- src/H5VLpassthru.c | 12 ++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index ff024c3..77cd88b 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -419,6 +419,18 @@ New Features (ADB - 2018/09/18, HDFFV-10332) + - Fix shutdown failure when using the HDF5_VOL_CONNECTOR environment variable + + When using the HDF5_VOL_CONNECTOR environment variable to set an + alternative default VOL connector, if the VOL connector is a dynamically + loaded plugin, the library can experience segmentation faults at when + the library is closed. This is due to the library unloading the plugins + before the virtual object layer. When then the VOL shutdown occurs, + it will attempt to close the default VOL connector, however this will + fail since the plugins will already have been unloaded. + + (DER - 2020/03/18, HDFFV-11057) + Parallel Library: ----------------- diff --git a/src/H5.c b/src/H5.c index 16c12cb..62a1c09 100644 --- a/src/H5.c +++ b/src/H5.c @@ -355,7 +355,9 @@ H5_term_library(void) pending += DOWN(Z); pending += DOWN(FD); pending += DOWN(VL); - pending += DOWN(PL); + /* Don't shut down the plugin code until all "pluggable" interfaces (Z, FD, PL) are shut down */ + if(pending == 0) + pending += DOWN(PL); /* Don't shut down the error code until other APIs which use it are shut down */ if(pending == 0) pending += DOWN(E); diff --git a/src/H5VLint.c b/src/H5VLint.c index 6572faa..861629f 100644 --- a/src/H5VLint.c +++ b/src/H5VLint.c @@ -273,7 +273,7 @@ H5VL_term_package(void) else { if(H5I_nmembers(H5I_VOL) > 0) { /* Unregister all VOL connectors */ - (void)H5I_clear_type(H5I_VOL, FALSE, FALSE); + (void)H5I_clear_type(H5I_VOL, TRUE, FALSE); n++; } /* end if */ else { diff --git a/src/H5VLpassthru.c b/src/H5VLpassthru.c index 8b3dc62..2cf470e 100644 --- a/src/H5VLpassthru.c +++ b/src/H5VLpassthru.c @@ -1591,6 +1591,10 @@ H5VL_pass_through_file_create(const char *name, unsigned flags, hid_t fcpl_id, /* Get copy of our VOL info from FAPL */ H5Pget_vol_info(fapl_id, (void **)&info); + /* Make sure we have info about the underlying VOL to be used */ + if (!info) + return NULL; + /* Copy the FAPL */ under_fapl_id = H5Pcopy(fapl_id); @@ -1645,6 +1649,10 @@ H5VL_pass_through_file_open(const char *name, unsigned flags, hid_t fapl_id, /* Get copy of our VOL info from FAPL */ H5Pget_vol_info(fapl_id, (void **)&info); + /* Make sure we have info about the underlying VOL to be used */ + if (!info) + return NULL; + /* Copy the FAPL */ under_fapl_id = H5Pcopy(fapl_id); @@ -1785,6 +1793,10 @@ H5VL_pass_through_file_specific(void *file, H5VL_file_specific_t specific_type, /* Get copy of our VOL info from FAPL */ H5Pget_vol_info(fapl_id, (void **)&info); + /* Make sure we have info about the underlying VOL to be used */ + if (!info) + return (-1); + /* Copy the FAPL */ under_fapl_id = H5Pcopy(fapl_id); -- cgit v0.12 From ce7936d2b256bdd5e61a5ef018f35e9562667cac Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Wed, 18 Mar 2020 14:08:47 -0700 Subject: Fixed the RELEASE.txt note for HDFFV-11057 --- release_docs/RELEASE.txt | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/release_docs/RELEASE.txt b/release_docs/RELEASE.txt index 77cd88b..c7a8e53 100644 --- a/release_docs/RELEASE.txt +++ b/release_docs/RELEASE.txt @@ -419,15 +419,14 @@ New Features (ADB - 2018/09/18, HDFFV-10332) - - Fix shutdown failure when using the HDF5_VOL_CONNECTOR environment variable - - When using the HDF5_VOL_CONNECTOR environment variable to set an - alternative default VOL connector, if the VOL connector is a dynamically - loaded plugin, the library can experience segmentation faults at when - the library is closed. This is due to the library unloading the plugins - before the virtual object layer. When then the VOL shutdown occurs, - it will attempt to close the default VOL connector, however this will - fail since the plugins will already have been unloaded. + - Fix shutdown failure when using H5VLregister_connector_by_name/value + + When using H5VLregister_connector_by_name/value to dynamically load a + VOL connector plugin, the library can experience segmentation faults + when the library is closed. This is due to the library unloading + the plugin interface before the virtual object layer. Then, when the + VOL shutdown occurs, it will attempt to close the VOL connector, + however this will fail since the plugin will already have been unloaded. (DER - 2020/03/18, HDFFV-11057) -- cgit v0.12 From 2f09d8f3c8a4a44932c1b8ffb0f6ea2219059a5c Mon Sep 17 00:00:00 2001 From: David Young Date: Wed, 18 Mar 2020 21:12:53 -0500 Subject: Move the GNU warnings configuration under config/gnu-warnings/ and trim the filename prefixes. Update config/gnu-flags to suit. I also made changes to config/cmake/HDFCompilerFlags.cmake, but I'm not sure they're correct. --- config/cmake/HDFCompilerFlags.cmake | 6 +-- config/gnu-flags | 70 ++++++++++++++++---------------- config/gnu-warnings-4.2-4.3 | 3 -- config/gnu-warnings-4.2-4.4 | 2 - config/gnu-warnings-4.2-4.6 | 2 - config/gnu-warnings-4.2-4.last | 3 -- config/gnu-warnings-4.3 | 2 - config/gnu-warnings-4.4 | 3 -- config/gnu-warnings-4.5 | 1 - config/gnu-warnings-4.5-4.6 | 3 -- config/gnu-warnings-4.6 | 2 - config/gnu-warnings-4.7 | 5 --- config/gnu-warnings-4.8 | 1 - config/gnu-warnings-4.9 | 1 - config/gnu-warnings-5 | 2 - config/gnu-warnings-6 | 9 ---- config/gnu-warnings-7 | 7 ---- config/gnu-warnings-8 | 3 -- config/gnu-warnings-9 | 2 - config/gnu-warnings-developer-4.5 | 7 ---- config/gnu-warnings-developer-4.6 | 1 - config/gnu-warnings-developer-4.7 | 7 ---- config/gnu-warnings-developer-4.8 | 1 - config/gnu-warnings-developer-7 | 1 - config/gnu-warnings-developer-8 | 3 -- config/gnu-warnings-developer-general | 13 ------ config/gnu-warnings-general | 32 --------------- config/gnu-warnings-no-developer-4.5 | 1 - config/gnu-warnings-no-developer-4.6 | 1 - config/gnu-warnings-no-developer-4.7 | 2 - config/gnu-warnings-no-developer-4.8 | 1 - config/gnu-warnings-no-developer-8 | 2 - config/gnu-warnings-no-developer-general | 4 -- config/gnu-warnings/4.2-4.3 | 3 ++ config/gnu-warnings/4.2-4.4 | 2 + config/gnu-warnings/4.2-4.6 | 2 + config/gnu-warnings/4.2-4.last | 3 ++ config/gnu-warnings/4.3 | 2 + config/gnu-warnings/4.4 | 3 ++ config/gnu-warnings/4.5 | 1 + config/gnu-warnings/4.5-4.6 | 3 ++ config/gnu-warnings/4.6 | 2 + config/gnu-warnings/4.7 | 5 +++ config/gnu-warnings/4.8 | 1 + config/gnu-warnings/4.9 | 1 + config/gnu-warnings/5 | 2 + config/gnu-warnings/6 | 9 ++++ config/gnu-warnings/7 | 7 ++++ config/gnu-warnings/8 | 3 ++ config/gnu-warnings/9 | 2 + config/gnu-warnings/developer-4.5 | 7 ++++ config/gnu-warnings/developer-4.6 | 1 + config/gnu-warnings/developer-4.7 | 7 ++++ config/gnu-warnings/developer-4.8 | 1 + config/gnu-warnings/developer-7 | 1 + config/gnu-warnings/developer-8 | 3 ++ config/gnu-warnings/developer-general | 13 ++++++ config/gnu-warnings/error-5 | 12 ++++++ config/gnu-warnings/error-8 | 9 ++++ config/gnu-warnings/error-general | 24 +++++++++++ config/gnu-warnings/general | 32 +++++++++++++++ config/gnu-warnings/no-developer-4.5 | 1 + config/gnu-warnings/no-developer-4.6 | 1 + config/gnu-warnings/no-developer-4.7 | 2 + config/gnu-warnings/no-developer-4.8 | 1 + config/gnu-warnings/no-developer-8 | 2 + config/gnu-warnings/no-developer-general | 4 ++ config/gnu-werrors-5 | 12 ------ config/gnu-werrors-8 | 9 ---- config/gnu-werrors-general | 24 ----------- 70 files changed, 210 insertions(+), 210 deletions(-) delete mode 100644 config/gnu-warnings-4.2-4.3 delete mode 100644 config/gnu-warnings-4.2-4.4 delete mode 100644 config/gnu-warnings-4.2-4.6 delete mode 100644 config/gnu-warnings-4.2-4.last delete mode 100644 config/gnu-warnings-4.3 delete mode 100644 config/gnu-warnings-4.4 delete mode 100644 config/gnu-warnings-4.5 delete mode 100644 config/gnu-warnings-4.5-4.6 delete mode 100644 config/gnu-warnings-4.6 delete mode 100644 config/gnu-warnings-4.7 delete mode 100644 config/gnu-warnings-4.8 delete mode 100644 config/gnu-warnings-4.9 delete mode 100644 config/gnu-warnings-5 delete mode 100644 config/gnu-warnings-6 delete mode 100644 config/gnu-warnings-7 delete mode 100644 config/gnu-warnings-8 delete mode 100644 config/gnu-warnings-9 delete mode 100644 config/gnu-warnings-developer-4.5 delete mode 100644 config/gnu-warnings-developer-4.6 delete mode 100644 config/gnu-warnings-developer-4.7 delete mode 100644 config/gnu-warnings-developer-4.8 delete mode 100644 config/gnu-warnings-developer-7 delete mode 100644 config/gnu-warnings-developer-8 delete mode 100644 config/gnu-warnings-developer-general delete mode 100644 config/gnu-warnings-general delete mode 100644 config/gnu-warnings-no-developer-4.5 delete mode 100644 config/gnu-warnings-no-developer-4.6 delete mode 100644 config/gnu-warnings-no-developer-4.7 delete mode 100644 config/gnu-warnings-no-developer-4.8 delete mode 100644 config/gnu-warnings-no-developer-8 delete mode 100644 config/gnu-warnings-no-developer-general create mode 100644 config/gnu-warnings/4.2-4.3 create mode 100644 config/gnu-warnings/4.2-4.4 create mode 100644 config/gnu-warnings/4.2-4.6 create mode 100644 config/gnu-warnings/4.2-4.last create mode 100644 config/gnu-warnings/4.3 create mode 100644 config/gnu-warnings/4.4 create mode 100644 config/gnu-warnings/4.5 create mode 100644 config/gnu-warnings/4.5-4.6 create mode 100644 config/gnu-warnings/4.6 create mode 100644 config/gnu-warnings/4.7 create mode 100644 config/gnu-warnings/4.8 create mode 100644 config/gnu-warnings/4.9 create mode 100644 config/gnu-warnings/5 create mode 100644 config/gnu-warnings/6 create mode 100644 config/gnu-warnings/7 create mode 100644 config/gnu-warnings/8 create mode 100644 config/gnu-warnings/9 create mode 100644 config/gnu-warnings/developer-4.5 create mode 100644 config/gnu-warnings/developer-4.6 create mode 100644 config/gnu-warnings/developer-4.7 create mode 100644 config/gnu-warnings/developer-4.8 create mode 100644 config/gnu-warnings/developer-7 create mode 100644 config/gnu-warnings/developer-8 create mode 100644 config/gnu-warnings/developer-general create mode 100644 config/gnu-warnings/error-5 create mode 100644 config/gnu-warnings/error-8 create mode 100644 config/gnu-warnings/error-general create mode 100644 config/gnu-warnings/general create mode 100644 config/gnu-warnings/no-developer-4.5 create mode 100644 config/gnu-warnings/no-developer-4.6 create mode 100644 config/gnu-warnings/no-developer-4.7 create mode 100644 config/gnu-warnings/no-developer-4.8 create mode 100644 config/gnu-warnings/no-developer-8 create mode 100644 config/gnu-warnings/no-developer-general delete mode 100644 config/gnu-werrors-5 delete mode 100644 config/gnu-werrors-8 delete mode 100644 config/gnu-werrors-general diff --git a/config/cmake/HDFCompilerFlags.cmake b/config/cmake/HDFCompilerFlags.cmake index 17b0854..c395193 100644 --- a/config/cmake/HDFCompilerFlags.cmake +++ b/config/cmake/HDFCompilerFlags.cmake @@ -128,7 +128,7 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) set (H5_CFLAGS0 "${H5_CFLAGS0} -Wsign-compare -Wtrigraphs -Wwrite-strings") endif() elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") - ADD_H5_FLAGS (CMAKE_C_FLAGS_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings-general") + ADD_H5_FLAGS (CMAKE_C_FLAGS_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings/general") message (STATUS "CMAKE_C_FLAGS_GENERAL=${CMAKE_C_FLAGS_GENERAL}") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_GENERAL}") set (H5_CFLAGS0 "${H5_CFLAGS0} -Wbad-function-cast -Wcast-align") @@ -154,12 +154,12 @@ if (NOT MSVC AND CMAKE_COMPILER_IS_GNUCC) if (CMAKE_C_COMPILER_ID STREQUAL "Intel") set (H5_CFLAGS0 "${H5_CFLAGS0} -Winline -Wreorder -Wport -Wstrict-aliasing") elseif (CMAKE_C_COMPILER_ID STREQUAL "GNU") - ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings-developer-general") + ADD_H5_FLAGS (CMAKE_C_FLAGS_DEV_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings/developer-general") set (H5_CFLAGS0 "${H5_CFLAGS0} ${CMAKE_C_FLAGS_DEV_GENERAL}") endif () else () if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings-no-developer-general") + ADD_H5_FLAGS (CMAKE_C_FLAGS_NO_DEV_GENERAL "${HDF5_SOURCE_DIR}/config/gnu-warnings/no-developer-general") set (H5_CFLAGS0 "${H5_CFLAGS0} ${CMAKE_C_FLAGS_NO_DEV_GENERAL}") endif () endif () diff --git a/config/gnu-flags b/config/gnu-flags index 61a1bfd..1310769 100644 --- a/config/gnu-flags +++ b/config/gnu-flags @@ -44,7 +44,7 @@ demote_errors() load_gcc_arguments() { set -- $(for arg; do - sed 's,#.*$,,' $srcdir/config/gnu-${arg} | demote_errors + sed 's,#.*$,,' $srcdir/config/gnu-warnings/${arg} | demote_errors done) IFS=' ' echo "$*" } @@ -189,15 +189,15 @@ if test "X-gcc" = "X-$cc_vendor"; then # General # ########### - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-general)" - H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments werrors-general)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments general)" + H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-general)" ###################### # Developer warnings # ###################### - NO_DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments warnings-no-developer-general) - DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments warnings-developer-general) + NO_DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments no-developer-general) + DEVELOPER_WARNING_CFLAGS=$(load_gcc_arguments developer-general) ####################### # gcc 4 special cases # @@ -205,27 +205,27 @@ if test "X-gcc" = "X-$cc_vendor"; then # GCC 4.2 through 4.6 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.2-4.6)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.6)" fi # GCC 4.2 through 4.3 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 3; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.2-4.3)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.3)" fi # GCC 4.5 through 4.6 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -le 6; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.5-4.6)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.5-4.6)" fi # GCC 4.2 through 4.4 if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2 -a $cc_vers_major -eq 4 -a $cc_vers_minor -le 4; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.2-4.4)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.4)" fi # GCC 4.2 through the end of GCC 4 series if test $cc_vers_major -eq 4 -a $cc_vers_minor -ge 2; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.2-4.last)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.2-4.last)" fi ############################# @@ -234,75 +234,75 @@ 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 $(load_gcc_arguments warnings-4.3)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.3)" 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 $(load_gcc_arguments warnings-4.4)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.4)" 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 $(load_gcc_arguments warnings-4.5)" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-developer-4.5)" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-no-developer-4.5)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.5)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.5)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.5)" fi # gcc >= 4.6 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 6; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.6)" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-developer-4.6)" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-no-developer-4.6)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.6)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.6)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.6)" fi # 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 $(load_gcc_arguments warnings-4.7)" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-developer-4.7)" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-no-developer-4.7)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.7)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.7)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.7)" fi # gcc >= 4.8 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 8; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.8)" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-developer-4.8)" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-no-developer-4.8)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.8)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-4.8)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-4.8)" fi # gcc >= 4.9 if test $cc_vers_major -ge 5 -o $cc_vers_major -eq 4 -a $cc_vers_minor -ge 9; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-4.9)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 4.9)" fi # gcc >= 5 if test $cc_vers_major -ge 5; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-5)" - H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments werrors-5)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 5)" + H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-5)" fi # gcc >= 6 if test $cc_vers_major -ge 6; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-6)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 6)" fi # gcc >= 7 if test $cc_vers_major -ge 7; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-7)" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-developer-7)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 7)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-7)" fi # gcc 8 if test $cc_vers_major -ge 8; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-8)" - H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments werrors-8)" - DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-developer-8)" - NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments warnings-no-developer-8)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 8)" + H5_ECFLAGS="$H5_ECFLAGS $(load_gcc_arguments error-8)" + DEVELOPER_WARNING_CFLAGS="$DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments developer-8)" + NO_DEVELOPER_WARNING_CFLAGS="$NO_DEVELOPER_WARNING_CFLAGS $(load_gcc_arguments no-developer-8)" fi # gcc 9 if test $cc_vers_major -ge 9; then - H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments warnings-9)" + H5_CFLAGS="$H5_CFLAGS $(load_gcc_arguments 9)" fi ################# diff --git a/config/gnu-warnings-4.2-4.3 b/config/gnu-warnings-4.2-4.3 deleted file mode 100644 index 1881797..0000000 --- a/config/gnu-warnings-4.2-4.3 +++ /dev/null @@ -1,3 +0,0 @@ -# -Wvolatile-register-var was later incorporated into -Wall and -# only needs to be specified explicitly for gcc 4.2-4.3 --Wvolatile-register-var diff --git a/config/gnu-warnings-4.2-4.4 b/config/gnu-warnings-4.2-4.4 deleted file mode 100644 index ec4876f..0000000 --- a/config/gnu-warnings-4.2-4.4 +++ /dev/null @@ -1,2 +0,0 @@ -# The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4 --Wstrict-overflow diff --git a/config/gnu-warnings-4.2-4.6 b/config/gnu-warnings-4.2-4.6 deleted file mode 100644 index 37df4ab..0000000 --- a/config/gnu-warnings-4.2-4.6 +++ /dev/null @@ -1,2 +0,0 @@ -# Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier --Wno-long-long diff --git a/config/gnu-warnings-4.2-4.last b/config/gnu-warnings-4.2-4.last deleted file mode 100644 index 2db90fb..0000000 --- a/config/gnu-warnings-4.2-4.last +++ /dev/null @@ -1,3 +0,0 @@ -# -Wvla was later incorporated into -Wpedantic and -# only needs to be specified explicitly for gcc 4 --Wvla diff --git a/config/gnu-warnings-4.3 b/config/gnu-warnings-4.3 deleted file mode 100644 index 13d8558..0000000 --- a/config/gnu-warnings-4.3 +++ /dev/null @@ -1,2 +0,0 @@ --Wlarger-than=2560 --Wlogical-op diff --git a/config/gnu-warnings-4.4 b/config/gnu-warnings-4.4 deleted file mode 100644 index 42929b5..0000000 --- a/config/gnu-warnings-4.4 +++ /dev/null @@ -1,3 +0,0 @@ --Wframe-larger-than=16384 --Wpacked-bitfield-compat --Wsync-nand diff --git a/config/gnu-warnings-4.5 b/config/gnu-warnings-4.5 deleted file mode 100644 index ddb96df..0000000 --- a/config/gnu-warnings-4.5 +++ /dev/null @@ -1 +0,0 @@ --Wstrict-overflow=5 diff --git a/config/gnu-warnings-4.5-4.6 b/config/gnu-warnings-4.5-4.6 deleted file mode 100644 index d3035fe..0000000 --- a/config/gnu-warnings-4.5-4.6 +++ /dev/null @@ -1,3 +0,0 @@ -# -Wstrict-aliasing was later incorporated into -Wall and -# only needs to be specified explicitly for gcc 4.5-4.6 --Wstrict-aliasing diff --git a/config/gnu-warnings-4.6 b/config/gnu-warnings-4.6 deleted file mode 100644 index 140a20c..0000000 --- a/config/gnu-warnings-4.6 +++ /dev/null @@ -1,2 +0,0 @@ --Wdouble-promotion --Wtrampolines diff --git a/config/gnu-warnings-4.7 b/config/gnu-warnings-4.7 deleted file mode 100644 index c47fe4b..0000000 --- a/config/gnu-warnings-4.7 +++ /dev/null @@ -1,5 +0,0 @@ -# -# -Wstack-usage=8192 warnings need to be swept up on a branch so -# that we can stop burdening the whole development team. -# --Wstack-usage=8192 diff --git a/config/gnu-warnings-4.8 b/config/gnu-warnings-4.8 deleted file mode 100644 index 5dc577f..0000000 --- a/config/gnu-warnings-4.8 +++ /dev/null @@ -1 +0,0 @@ --Wmaybe-uninitialized diff --git a/config/gnu-warnings-4.9 b/config/gnu-warnings-4.9 deleted file mode 100644 index 78aa929..0000000 --- a/config/gnu-warnings-4.9 +++ /dev/null @@ -1 +0,0 @@ --Wdate-time diff --git a/config/gnu-warnings-5 b/config/gnu-warnings-5 deleted file mode 100644 index 32cb196..0000000 --- a/config/gnu-warnings-5 +++ /dev/null @@ -1,2 +0,0 @@ --Warray-bounds=2 --Wc99-c11-compat diff --git a/config/gnu-warnings-6 b/config/gnu-warnings-6 deleted file mode 100644 index 736a446..0000000 --- a/config/gnu-warnings-6 +++ /dev/null @@ -1,9 +0,0 @@ -# -# Careful! -Wduplicated-cond, combined with HDF5's heavy use of -# macros, can make a lot of noise. -# --Wduplicated-cond --Whsa --Wnormalized --Wnull-dereference --Wunused-const-variable diff --git a/config/gnu-warnings-7 b/config/gnu-warnings-7 deleted file mode 100644 index 266f5c1..0000000 --- a/config/gnu-warnings-7 +++ /dev/null @@ -1,7 +0,0 @@ --Walloca --Walloc-zero --Wduplicated-branches --Wformat-overflow=2 --Wformat-truncation=1 --Wimplicit-fallthrough=5 --Wrestrict diff --git a/config/gnu-warnings-8 b/config/gnu-warnings-8 deleted file mode 100644 index 5e7519d..0000000 --- a/config/gnu-warnings-8 +++ /dev/null @@ -1,3 +0,0 @@ --Wattribute-alias --Wcast-align=strict --Wshift-overflow=2 diff --git a/config/gnu-warnings-9 b/config/gnu-warnings-9 deleted file mode 100644 index c084350..0000000 --- a/config/gnu-warnings-9 +++ /dev/null @@ -1,2 +0,0 @@ --Wattribute-alias=2 --Wmissing-profile diff --git a/config/gnu-warnings-developer-4.5 b/config/gnu-warnings-developer-4.5 deleted file mode 100644 index 48df846..0000000 --- a/config/gnu-warnings-developer-4.5 +++ /dev/null @@ -1,7 +0,0 @@ -# -# -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? -# --Wjump-misses-init --Wunsuffixed-float-constants diff --git a/config/gnu-warnings-developer-4.6 b/config/gnu-warnings-developer-4.6 deleted file mode 100644 index 2372fbf..0000000 --- a/config/gnu-warnings-developer-4.6 +++ /dev/null @@ -1 +0,0 @@ --Wsuggest-attribute=const diff --git a/config/gnu-warnings-developer-4.7 b/config/gnu-warnings-developer-4.7 deleted file mode 100644 index a3b0781..0000000 --- a/config/gnu-warnings-developer-4.7 +++ /dev/null @@ -1,7 +0,0 @@ --Wsuggest-attribute=noreturn --Wsuggest-attribute=pure -# -# It's not clear that -Wvector-operation-performance warnings are -# actionable, so they are demoted to "developer" warnings. -# --Wvector-operation-performance diff --git a/config/gnu-warnings-developer-4.8 b/config/gnu-warnings-developer-4.8 deleted file mode 100644 index b0109e2..0000000 --- a/config/gnu-warnings-developer-4.8 +++ /dev/null @@ -1 +0,0 @@ --Wsuggest-attribute=format diff --git a/config/gnu-warnings-developer-7 b/config/gnu-warnings-developer-7 deleted file mode 100644 index 2a3ce7e..0000000 --- a/config/gnu-warnings-developer-7 +++ /dev/null @@ -1 +0,0 @@ --Wstringop-overflow=2 diff --git a/config/gnu-warnings-developer-8 b/config/gnu-warnings-developer-8 deleted file mode 100644 index a2ba7ca..0000000 --- a/config/gnu-warnings-developer-8 +++ /dev/null @@ -1,3 +0,0 @@ --Wstringop-overflow=4 --Wsuggest-attribute=cold --Wsuggest-attribute=malloc diff --git a/config/gnu-warnings-developer-general b/config/gnu-warnings-developer-general deleted file mode 100644 index b34c4b7..0000000 --- a/config/gnu-warnings-developer-general +++ /dev/null @@ -1,13 +0,0 @@ -# (suggestions from gcc, not code problems) -# NOTE: -Wformat-nonliteral added back in here (from being disabled in -# H5_CFLAGS) --Waggregate-return --Wdisabled-optimization --Wformat-nonliteral --Winline --Wmissing-format-attribute --Wmissing-noreturn --Wswitch-default --Wswitch-enum --Wunsafe-loop-optimizations --Wunused-macros diff --git a/config/gnu-warnings-general b/config/gnu-warnings-general deleted file mode 100644 index a7a20b7..0000000 --- a/config/gnu-warnings-general +++ /dev/null @@ -1,32 +0,0 @@ -# Note that some of the flags listed here really should be developer -# flags (listed in separate files, gnu-warnings-developer*) but we put -# them here because they are not raised by the current code and we'd like to -# know if they do start showing up. -# -# NOTE: Don't add -Wpadded here since we can't/won't fix the (many) -# warnings that are emitted. If you need it, add it from the -# environment variable at configure time. --Wall --Wcast-qual --Wconversion --Wextra --Wfloat-equal --Wformat=2 --Winit-self --Winvalid-pch --Wmissing-include-dirs -# -# 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. -# --Wno-c++-compat -# -# NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add -# it to the developer flags. -# --Wno-format-nonliteral --Wshadow --Wundef --Wwrite-strings --pedantic diff --git a/config/gnu-warnings-no-developer-4.5 b/config/gnu-warnings-no-developer-4.5 deleted file mode 100644 index ef7d38f..0000000 --- a/config/gnu-warnings-no-developer-4.5 +++ /dev/null @@ -1 +0,0 @@ --Wno-unsuffixed-float-constants diff --git a/config/gnu-warnings-no-developer-4.6 b/config/gnu-warnings-no-developer-4.6 deleted file mode 100644 index ea9cc66..0000000 --- a/config/gnu-warnings-no-developer-4.6 +++ /dev/null @@ -1 +0,0 @@ --Wno-suggest-attribute=const diff --git a/config/gnu-warnings-no-developer-4.7 b/config/gnu-warnings-no-developer-4.7 deleted file mode 100644 index 5b85e1f..0000000 --- a/config/gnu-warnings-no-developer-4.7 +++ /dev/null @@ -1,2 +0,0 @@ --Wno-suggest-attribute=noreturn --Wno-suggest-attribute=pure diff --git a/config/gnu-warnings-no-developer-4.8 b/config/gnu-warnings-no-developer-4.8 deleted file mode 100644 index e42e09f..0000000 --- a/config/gnu-warnings-no-developer-4.8 +++ /dev/null @@ -1 +0,0 @@ --Wno-suggest-attribute=format diff --git a/config/gnu-warnings-no-developer-8 b/config/gnu-warnings-no-developer-8 deleted file mode 100644 index 2134bad..0000000 --- a/config/gnu-warnings-no-developer-8 +++ /dev/null @@ -1,2 +0,0 @@ --Wno-suggest-attribute=cold --Wno-suggest-attribute=malloc diff --git a/config/gnu-warnings-no-developer-general b/config/gnu-warnings-no-developer-general deleted file mode 100644 index 85dc0a3..0000000 --- a/config/gnu-warnings-no-developer-general +++ /dev/null @@ -1,4 +0,0 @@ --Wno-aggregate-return --Wno-inline --Wno-missing-format-attribute --Wno-missing-noreturn diff --git a/config/gnu-warnings/4.2-4.3 b/config/gnu-warnings/4.2-4.3 new file mode 100644 index 0000000..1881797 --- /dev/null +++ b/config/gnu-warnings/4.2-4.3 @@ -0,0 +1,3 @@ +# -Wvolatile-register-var was later incorporated into -Wall and +# only needs to be specified explicitly for gcc 4.2-4.3 +-Wvolatile-register-var diff --git a/config/gnu-warnings/4.2-4.4 b/config/gnu-warnings/4.2-4.4 new file mode 100644 index 0000000..ec4876f --- /dev/null +++ b/config/gnu-warnings/4.2-4.4 @@ -0,0 +1,2 @@ +# The non-valued form of -Wstrict-overflow is used in gcc 4.2-4.4 +-Wstrict-overflow diff --git a/config/gnu-warnings/4.2-4.6 b/config/gnu-warnings/4.2-4.6 new file mode 100644 index 0000000..37df4ab --- /dev/null +++ b/config/gnu-warnings/4.2-4.6 @@ -0,0 +1,2 @@ +# Disable warnings about using the 'long long' type w/ gcc 4.6 and earlier +-Wno-long-long diff --git a/config/gnu-warnings/4.2-4.last b/config/gnu-warnings/4.2-4.last new file mode 100644 index 0000000..2db90fb --- /dev/null +++ b/config/gnu-warnings/4.2-4.last @@ -0,0 +1,3 @@ +# -Wvla was later incorporated into -Wpedantic and +# only needs to be specified explicitly for gcc 4 +-Wvla diff --git a/config/gnu-warnings/4.3 b/config/gnu-warnings/4.3 new file mode 100644 index 0000000..13d8558 --- /dev/null +++ b/config/gnu-warnings/4.3 @@ -0,0 +1,2 @@ +-Wlarger-than=2560 +-Wlogical-op diff --git a/config/gnu-warnings/4.4 b/config/gnu-warnings/4.4 new file mode 100644 index 0000000..42929b5 --- /dev/null +++ b/config/gnu-warnings/4.4 @@ -0,0 +1,3 @@ +-Wframe-larger-than=16384 +-Wpacked-bitfield-compat +-Wsync-nand diff --git a/config/gnu-warnings/4.5 b/config/gnu-warnings/4.5 new file mode 100644 index 0000000..ddb96df --- /dev/null +++ b/config/gnu-warnings/4.5 @@ -0,0 +1 @@ +-Wstrict-overflow=5 diff --git a/config/gnu-warnings/4.5-4.6 b/config/gnu-warnings/4.5-4.6 new file mode 100644 index 0000000..d3035fe --- /dev/null +++ b/config/gnu-warnings/4.5-4.6 @@ -0,0 +1,3 @@ +# -Wstrict-aliasing was later incorporated into -Wall and +# only needs to be specified explicitly for gcc 4.5-4.6 +-Wstrict-aliasing diff --git a/config/gnu-warnings/4.6 b/config/gnu-warnings/4.6 new file mode 100644 index 0000000..140a20c --- /dev/null +++ b/config/gnu-warnings/4.6 @@ -0,0 +1,2 @@ +-Wdouble-promotion +-Wtrampolines diff --git a/config/gnu-warnings/4.7 b/config/gnu-warnings/4.7 new file mode 100644 index 0000000..c47fe4b --- /dev/null +++ b/config/gnu-warnings/4.7 @@ -0,0 +1,5 @@ +# +# -Wstack-usage=8192 warnings need to be swept up on a branch so +# that we can stop burdening the whole development team. +# +-Wstack-usage=8192 diff --git a/config/gnu-warnings/4.8 b/config/gnu-warnings/4.8 new file mode 100644 index 0000000..5dc577f --- /dev/null +++ b/config/gnu-warnings/4.8 @@ -0,0 +1 @@ +-Wmaybe-uninitialized diff --git a/config/gnu-warnings/4.9 b/config/gnu-warnings/4.9 new file mode 100644 index 0000000..78aa929 --- /dev/null +++ b/config/gnu-warnings/4.9 @@ -0,0 +1 @@ +-Wdate-time diff --git a/config/gnu-warnings/5 b/config/gnu-warnings/5 new file mode 100644 index 0000000..32cb196 --- /dev/null +++ b/config/gnu-warnings/5 @@ -0,0 +1,2 @@ +-Warray-bounds=2 +-Wc99-c11-compat diff --git a/config/gnu-warnings/6 b/config/gnu-warnings/6 new file mode 100644 index 0000000..736a446 --- /dev/null +++ b/config/gnu-warnings/6 @@ -0,0 +1,9 @@ +# +# Careful! -Wduplicated-cond, combined with HDF5's heavy use of +# macros, can make a lot of noise. +# +-Wduplicated-cond +-Whsa +-Wnormalized +-Wnull-dereference +-Wunused-const-variable diff --git a/config/gnu-warnings/7 b/config/gnu-warnings/7 new file mode 100644 index 0000000..266f5c1 --- /dev/null +++ b/config/gnu-warnings/7 @@ -0,0 +1,7 @@ +-Walloca +-Walloc-zero +-Wduplicated-branches +-Wformat-overflow=2 +-Wformat-truncation=1 +-Wimplicit-fallthrough=5 +-Wrestrict diff --git a/config/gnu-warnings/8 b/config/gnu-warnings/8 new file mode 100644 index 0000000..5e7519d --- /dev/null +++ b/config/gnu-warnings/8 @@ -0,0 +1,3 @@ +-Wattribute-alias +-Wcast-align=strict +-Wshift-overflow=2 diff --git a/config/gnu-warnings/9 b/config/gnu-warnings/9 new file mode 100644 index 0000000..c084350 --- /dev/null +++ b/config/gnu-warnings/9 @@ -0,0 +1,2 @@ +-Wattribute-alias=2 +-Wmissing-profile diff --git a/config/gnu-warnings/developer-4.5 b/config/gnu-warnings/developer-4.5 new file mode 100644 index 0000000..48df846 --- /dev/null +++ b/config/gnu-warnings/developer-4.5 @@ -0,0 +1,7 @@ +# +# -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? +# +-Wjump-misses-init +-Wunsuffixed-float-constants diff --git a/config/gnu-warnings/developer-4.6 b/config/gnu-warnings/developer-4.6 new file mode 100644 index 0000000..2372fbf --- /dev/null +++ b/config/gnu-warnings/developer-4.6 @@ -0,0 +1 @@ +-Wsuggest-attribute=const diff --git a/config/gnu-warnings/developer-4.7 b/config/gnu-warnings/developer-4.7 new file mode 100644 index 0000000..a3b0781 --- /dev/null +++ b/config/gnu-warnings/developer-4.7 @@ -0,0 +1,7 @@ +-Wsuggest-attribute=noreturn +-Wsuggest-attribute=pure +# +# It's not clear that -Wvector-operation-performance warnings are +# actionable, so they are demoted to "developer" warnings. +# +-Wvector-operation-performance diff --git a/config/gnu-warnings/developer-4.8 b/config/gnu-warnings/developer-4.8 new file mode 100644 index 0000000..b0109e2 --- /dev/null +++ b/config/gnu-warnings/developer-4.8 @@ -0,0 +1 @@ +-Wsuggest-attribute=format diff --git a/config/gnu-warnings/developer-7 b/config/gnu-warnings/developer-7 new file mode 100644 index 0000000..2a3ce7e --- /dev/null +++ b/config/gnu-warnings/developer-7 @@ -0,0 +1 @@ +-Wstringop-overflow=2 diff --git a/config/gnu-warnings/developer-8 b/config/gnu-warnings/developer-8 new file mode 100644 index 0000000..a2ba7ca --- /dev/null +++ b/config/gnu-warnings/developer-8 @@ -0,0 +1,3 @@ +-Wstringop-overflow=4 +-Wsuggest-attribute=cold +-Wsuggest-attribute=malloc diff --git a/config/gnu-warnings/developer-general b/config/gnu-warnings/developer-general new file mode 100644 index 0000000..b34c4b7 --- /dev/null +++ b/config/gnu-warnings/developer-general @@ -0,0 +1,13 @@ +# (suggestions from gcc, not code problems) +# NOTE: -Wformat-nonliteral added back in here (from being disabled in +# H5_CFLAGS) +-Waggregate-return +-Wdisabled-optimization +-Wformat-nonliteral +-Winline +-Wmissing-format-attribute +-Wmissing-noreturn +-Wswitch-default +-Wswitch-enum +-Wunsafe-loop-optimizations +-Wunused-macros diff --git a/config/gnu-warnings/error-5 b/config/gnu-warnings/error-5 new file mode 100644 index 0000000..f7e1138 --- /dev/null +++ b/config/gnu-warnings/error-5 @@ -0,0 +1,12 @@ +-Werror=incompatible-pointer-types +# +# In GCC 4.4.7, the compiler gripes about shadowed global +# declarations when a local variable uses the name of a +# function that's in a system header file. For some reason, +# later versions of GCC (e.g., 5.2.0) don't complain about +# the shadowed globals. Maybe later versions are less fussy? +# Anyway, the shadowing seems to be harmless, and GCC 4.4.7 +# is not a supported compiler, so let us promote shadowed globals +# warnings to errors only for GCC 5 and later. +# +-Werror=shadow diff --git a/config/gnu-warnings/error-8 b/config/gnu-warnings/error-8 new file mode 100644 index 0000000..36c1414 --- /dev/null +++ b/config/gnu-warnings/error-8 @@ -0,0 +1,9 @@ +-Werror=cast-function-type +# +# For GCC 8, promote maybe-initialized warnings to an error. GCC 8 +# reports 0 maybe-uninitialized warnings where earlier versions +# make many false reports. GCC 8 seems to analyze calls to static +# in order to detect initializations that occur there. It's possible +# that GCC 8 only performs that analysis at -O3, though. +# +-Werror=maybe-uninitialized diff --git a/config/gnu-warnings/error-general b/config/gnu-warnings/error-general new file mode 100644 index 0000000..d0e272a --- /dev/null +++ b/config/gnu-warnings/error-general @@ -0,0 +1,24 @@ +# +# HDF5 code should not trigger the following warnings under any +# circumstances, so ask the compiler to treat them as errors: +# +-Werror=bad-function-cast +-Werror=cast-align +-Werror=declaration-after-statement +-Werror=format +-Werror=implicit-function-declaration +-Werror=missing-declarations +-Werror=missing-prototypes +-Werror=nested-externs +-Werror=old-style-definition +-Werror=packed +-Werror=pointer-sign +-Werror=pointer-to-int-cast +-Werror=redundant-decls +-Werror=strict-prototypes +-Werror=switch +-Werror=unused-but-set-variable +-Werror=unused-function +-Werror=unused-parameter +-Werror=unused-variable +#-Werror=discarded-qualifiers diff --git a/config/gnu-warnings/general b/config/gnu-warnings/general new file mode 100644 index 0000000..a7a20b7 --- /dev/null +++ b/config/gnu-warnings/general @@ -0,0 +1,32 @@ +# Note that some of the flags listed here really should be developer +# flags (listed in separate files, gnu-warnings-developer*) but we put +# them here because they are not raised by the current code and we'd like to +# know if they do start showing up. +# +# NOTE: Don't add -Wpadded here since we can't/won't fix the (many) +# warnings that are emitted. If you need it, add it from the +# environment variable at configure time. +-Wall +-Wcast-qual +-Wconversion +-Wextra +-Wfloat-equal +-Wformat=2 +-Winit-self +-Winvalid-pch +-Wmissing-include-dirs +# +# 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. +# +-Wno-c++-compat +# +# NOTE: Disable the -Wformat-nonliteral from -Wformat=2 here and re-add +# it to the developer flags. +# +-Wno-format-nonliteral +-Wshadow +-Wundef +-Wwrite-strings +-pedantic diff --git a/config/gnu-warnings/no-developer-4.5 b/config/gnu-warnings/no-developer-4.5 new file mode 100644 index 0000000..ef7d38f --- /dev/null +++ b/config/gnu-warnings/no-developer-4.5 @@ -0,0 +1 @@ +-Wno-unsuffixed-float-constants diff --git a/config/gnu-warnings/no-developer-4.6 b/config/gnu-warnings/no-developer-4.6 new file mode 100644 index 0000000..ea9cc66 --- /dev/null +++ b/config/gnu-warnings/no-developer-4.6 @@ -0,0 +1 @@ +-Wno-suggest-attribute=const diff --git a/config/gnu-warnings/no-developer-4.7 b/config/gnu-warnings/no-developer-4.7 new file mode 100644 index 0000000..5b85e1f --- /dev/null +++ b/config/gnu-warnings/no-developer-4.7 @@ -0,0 +1,2 @@ +-Wno-suggest-attribute=noreturn +-Wno-suggest-attribute=pure diff --git a/config/gnu-warnings/no-developer-4.8 b/config/gnu-warnings/no-developer-4.8 new file mode 100644 index 0000000..e42e09f --- /dev/null +++ b/config/gnu-warnings/no-developer-4.8 @@ -0,0 +1 @@ +-Wno-suggest-attribute=format diff --git a/config/gnu-warnings/no-developer-8 b/config/gnu-warnings/no-developer-8 new file mode 100644 index 0000000..2134bad --- /dev/null +++ b/config/gnu-warnings/no-developer-8 @@ -0,0 +1,2 @@ +-Wno-suggest-attribute=cold +-Wno-suggest-attribute=malloc diff --git a/config/gnu-warnings/no-developer-general b/config/gnu-warnings/no-developer-general new file mode 100644 index 0000000..85dc0a3 --- /dev/null +++ b/config/gnu-warnings/no-developer-general @@ -0,0 +1,4 @@ +-Wno-aggregate-return +-Wno-inline +-Wno-missing-format-attribute +-Wno-missing-noreturn diff --git a/config/gnu-werrors-5 b/config/gnu-werrors-5 deleted file mode 100644 index f7e1138..0000000 --- a/config/gnu-werrors-5 +++ /dev/null @@ -1,12 +0,0 @@ --Werror=incompatible-pointer-types -# -# In GCC 4.4.7, the compiler gripes about shadowed global -# declarations when a local variable uses the name of a -# function that's in a system header file. For some reason, -# later versions of GCC (e.g., 5.2.0) don't complain about -# the shadowed globals. Maybe later versions are less fussy? -# Anyway, the shadowing seems to be harmless, and GCC 4.4.7 -# is not a supported compiler, so let us promote shadowed globals -# warnings to errors only for GCC 5 and later. -# --Werror=shadow diff --git a/config/gnu-werrors-8 b/config/gnu-werrors-8 deleted file mode 100644 index 36c1414..0000000 --- a/config/gnu-werrors-8 +++ /dev/null @@ -1,9 +0,0 @@ --Werror=cast-function-type -# -# For GCC 8, promote maybe-initialized warnings to an error. GCC 8 -# reports 0 maybe-uninitialized warnings where earlier versions -# make many false reports. GCC 8 seems to analyze calls to static -# in order to detect initializations that occur there. It's possible -# that GCC 8 only performs that analysis at -O3, though. -# --Werror=maybe-uninitialized diff --git a/config/gnu-werrors-general b/config/gnu-werrors-general deleted file mode 100644 index d0e272a..0000000 --- a/config/gnu-werrors-general +++ /dev/null @@ -1,24 +0,0 @@ -# -# HDF5 code should not trigger the following warnings under any -# circumstances, so ask the compiler to treat them as errors: -# --Werror=bad-function-cast --Werror=cast-align --Werror=declaration-after-statement --Werror=format --Werror=implicit-function-declaration --Werror=missing-declarations --Werror=missing-prototypes --Werror=nested-externs --Werror=old-style-definition --Werror=packed --Werror=pointer-sign --Werror=pointer-to-int-cast --Werror=redundant-decls --Werror=strict-prototypes --Werror=switch --Werror=unused-but-set-variable --Werror=unused-function --Werror=unused-parameter --Werror=unused-variable -#-Werror=discarded-qualifiers -- cgit v0.12 From b51585a9110c4322c52f9dcdc60cd26c3ea44546 Mon Sep 17 00:00:00 2001 From: Quincey Koziol Date: Fri, 20 Mar 2020 16:39:55 -0500 Subject: Revise API for H5get_alloc_stats() to take a struct instead of separate values. --- bin/trace | 1 + src/H5.c | 20 ++++------------ src/H5MM.c | 53 ++++++++++++------------------------------- src/H5MMprivate.h | 4 +--- src/H5public.h | 17 +++++++++++--- test/tmisc.c | 68 ++++++++++++++++++++++++------------------------------- 6 files changed, 64 insertions(+), 99 deletions(-) diff --git a/bin/trace b/bin/trace index de6a83f..15baa8a 100755 --- a/bin/trace +++ b/bin/trace @@ -132,6 +132,7 @@ $Source = ""; "H5VL_blob_optional_t" => "VA", "void" => "x", "FILE" => "x", + "H5_alloc_stats_t" => "x", "H5A_operator_t" => "x", "H5A_operator1_t" => "x", "H5A_operator2_t" => "x", diff --git a/src/H5.c b/src/H5.c index bfb0f28..59882e3 100644 --- a/src/H5.c +++ b/src/H5.c @@ -611,13 +611,7 @@ done: * filters or non-native VOL connectors. * * Parameters: - * unsigned long long *total_alloc_bytes; OUT: Running count of total # of bytes allocated - * size_t *curr_alloc_bytes; OUT: Current # of bytes allocated - * size_t *peak_alloc_bytes; OUT: Peak # of bytes allocated - * size_t *max_block_size; OUT: Largest block allocated - * size_t *total_alloc_blocks_count; OUT: Running count of total # of blocks allocated - * size_t *curr_alloc_blocks_count; OUT: Current # of blocks allocated - * size_t *peak_alloc_blocks_count; OUT: Peak # of blocks allocated + * H5_alloc_stats_t *stats; OUT: Memory allocation statistics * * Return: Success: non-negative * Failure: negative @@ -628,21 +622,15 @@ done: *------------------------------------------------------------------------- */ herr_t -H5get_alloc_stats(unsigned long long *total_alloc_bytes, size_t *curr_alloc_bytes, - size_t *peak_alloc_bytes, size_t *max_block_size, size_t *total_alloc_blocks_count, - size_t *curr_alloc_blocks_count, size_t *peak_alloc_blocks_count) +H5get_alloc_stats(H5_alloc_stats_t *stats) { herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "*UL*z*z*z*z*z*z", total_alloc_bytes, curr_alloc_bytes, - peak_alloc_bytes, max_block_size, total_alloc_blocks_count, - curr_alloc_blocks_count, peak_alloc_blocks_count); + H5TRACE1("e", "*x", stats); /* Call the internal allocation stat routine to get the values */ - if(H5MM_get_alloc_stats(total_alloc_bytes, curr_alloc_bytes, peak_alloc_bytes, - max_block_size, total_alloc_blocks_count, curr_alloc_blocks_count, - peak_alloc_blocks_count) < 0) + if(H5MM_get_alloc_stats(stats) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "can't get allocation stats") done: diff --git a/src/H5MM.c b/src/H5MM.c index 4fbecd4..0add640 100644 --- a/src/H5MM.c +++ b/src/H5MM.c @@ -635,13 +635,7 @@ H5MM_memcpy(void *dest, const void *src, size_t n) * entire library. * * Parameters: - * unsigned long long *total_alloc_bytes; OUT: Running count of total # of bytes allocated - * size_t *curr_alloc_bytes; OUT: Current # of bytes allocated - * size_t *peak_alloc_bytes; OUT: Peak # of bytes allocated - * size_t *max_block_size; OUT: Largest block allocated - * size_t *total_alloc_blocks_count; OUT: Running count of total # of blocks allocated - * size_t *curr_alloc_blocks_count; OUT: Current # of blocks allocated - * size_t *peak_alloc_blocks_count; OUT: Peak # of blocks allocated + * H5_alloc_stats_t *stats; OUT: Memory allocation statistics * * Return: Success: non-negative * Failure: negative @@ -652,44 +646,25 @@ H5MM_memcpy(void *dest, const void *src, size_t n) *------------------------------------------------------------------------- */ herr_t -H5MM_get_alloc_stats(unsigned long long *total_alloc_bytes, size_t *curr_alloc_bytes, - size_t *peak_alloc_bytes, size_t *max_block_size, size_t *total_alloc_blocks_count, - size_t *curr_alloc_blocks_count, size_t *peak_alloc_blocks_count) +H5MM_get_alloc_stats(H5_alloc_stats_t *stats) { FUNC_ENTER_NOAPI_NOERR #if defined H5_MEMORY_ALLOC_SANITY_CHECK - if(total_alloc_bytes) - *total_alloc_bytes = H5MM_total_alloc_bytes_s; - if(curr_alloc_bytes) - *curr_alloc_bytes = H5MM_curr_alloc_bytes_s; - if(peak_alloc_bytes) - *peak_alloc_bytes = H5MM_peak_alloc_bytes_s; - if(max_block_size) - *max_block_size = H5MM_max_block_size_s; - if(total_alloc_blocks_count) - *total_alloc_blocks_count = H5MM_total_alloc_blocks_count_s; - if(curr_alloc_blocks_count) - *curr_alloc_blocks_count = H5MM_curr_alloc_blocks_count_s; - if(peak_alloc_blocks_count) - *peak_alloc_blocks_count = H5MM_peak_alloc_blocks_count_s; + if(stats) { + stats->total_alloc_bytes = H5MM_total_alloc_bytes_s; + stats->curr_alloc_bytes = H5MM_curr_alloc_bytes_s; + stats->peak_alloc_bytes = H5MM_peak_alloc_bytes_s; + stats->max_block_size = H5MM_max_block_size_s; + stats->total_alloc_blocks_count = H5MM_total_alloc_blocks_count_s; + stats->curr_alloc_blocks_count = H5MM_curr_alloc_blocks_count_s; + stats->peak_alloc_blocks_count = H5MM_peak_alloc_blocks_count_s; + } /* end if */ #else /* H5_MEMORY_ALLOC_SANITY_CHECK */ - if(total_alloc_bytes) - *total_alloc_bytes = 0; - if(curr_alloc_bytes) - *curr_alloc_bytes = 0; - if(peak_alloc_bytes) - *peak_alloc_bytes = 0; - if(max_block_size) - *max_block_size = 0; - if(total_alloc_blocks_count) - *total_alloc_blocks_count = 0; - if(curr_alloc_blocks_count) - *curr_alloc_blocks_count = 0; - if(peak_alloc_blocks_count) - *peak_alloc_blocks_count = 0; + if(stats) + HDmemset(stats, 0, sizeof(H5_alloc_stats_t)); #endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ FUNC_LEAVE_NOAPI(SUCCEED) -} /* end H5get_alloc_stats() */ +} /* end H5MM_get_alloc_stats() */ diff --git a/src/H5MMprivate.h b/src/H5MMprivate.h index 3bf8c49..0787eb2 100644 --- a/src/H5MMprivate.h +++ b/src/H5MMprivate.h @@ -47,9 +47,7 @@ H5_DLL char *H5MM_strdup(const char *s); H5_DLL void *H5MM_xfree(void *mem); H5_DLL void *H5MM_xfree_const(const void *mem); H5_DLL void *H5MM_memcpy(void *dest, const void *src, size_t n); -H5_DLL herr_t H5MM_get_alloc_stats(unsigned long long *total_alloc_bytes, size_t *curr_alloc_bytes, - size_t *peak_alloc_bytes, size_t *max_block_size, size_t *total_alloc_blocks_count, - size_t *curr_alloc_blocks_count, size_t *peak_alloc_blocks_count); +H5_DLL herr_t H5MM_get_alloc_stats(H5_alloc_stats_t *stats); #if defined H5_MEMORY_ALLOC_SANITY_CHECK H5_DLL void H5MM_sanity_check_all(void); H5_DLL void H5MM_final_sanity_check(void); diff --git a/src/H5public.h b/src/H5public.h index 60bad93..f592ab9 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -378,6 +378,19 @@ typedef struct H5O_token_t { uint8_t __data[H5O_MAX_TOKEN_SIZE]; } H5O_token_t; +/* + * Allocation statistics info struct + */ +typedef struct H5_alloc_stats_t { + unsigned long long total_alloc_bytes; /* Running count of total # of bytes allocated */ + size_t curr_alloc_bytes; /* Current # of bytes allocated */ + size_t peak_alloc_bytes; /* Peak # of bytes allocated */ + size_t max_block_size; /* Largest block allocated */ + size_t total_alloc_blocks_count; /* Running count of total # of blocks allocated */ + size_t curr_alloc_blocks_count; /* Current # of blocks allocated */ + size_t peak_alloc_blocks_count; /* Peak # of blocks allocated */ +} H5_alloc_stats_t; + /* Functions in H5.c */ H5_DLL herr_t H5open(void); H5_DLL herr_t H5close(void); @@ -388,9 +401,7 @@ H5_DLL herr_t H5set_free_list_limits (int reg_global_lim, int reg_list_lim, int blk_list_lim); H5_DLL herr_t H5get_free_list_sizes(size_t *reg_size, size_t *arr_size, size_t *blk_size, size_t *fac_size); -H5_DLL herr_t H5get_alloc_stats(unsigned long long *total_alloc_bytes, size_t *curr_alloc_bytes, - size_t *peak_alloc_bytes, size_t *max_block_size, size_t *total_alloc_blocks_count, - size_t *curr_alloc_blocks_count, size_t *peak_alloc_blocks_count); +H5_DLL herr_t H5get_alloc_stats(H5_alloc_stats_t *stats); H5_DLL herr_t H5get_libversion(unsigned *majnum, unsigned *minnum, unsigned *relnum); H5_DLL herr_t H5check_version(unsigned majnum, unsigned minnum, diff --git a/test/tmisc.c b/test/tmisc.c index a555b3e..bd9ae53 100644 --- a/test/tmisc.c +++ b/test/tmisc.c @@ -5709,13 +5709,7 @@ test_misc35(void) size_t arr_size_final; /* Final amount of array memory allocated */ size_t blk_size_final; /* Final amount of block memory allocated */ size_t fac_size_final; /* Final amount of factory memory allocated */ - unsigned long long total_alloc_bytes; /* Running count of total # of bytes allocated */ - size_t curr_alloc_bytes; /* Current # of bytes allocated */ - size_t peak_alloc_bytes; /* Peak # of bytes allocated */ - size_t max_block_size; /* Largest block allocated */ - size_t total_alloc_blocks_count; /* Running count of total # of blocks allocated */ - size_t curr_alloc_blocks_count; /* Current # of blocks allocated */ - size_t peak_alloc_blocks_count; /* Peak # of blocks allocated */ + H5_alloc_stats_t alloc_stats; /* Memory stats */ herr_t ret; /* Return value */ /* Output message about test being performed */ @@ -5778,43 +5772,41 @@ test_misc35(void) ERROR("fac_size_final > fac_size_start"); /* Retrieve memory allocation statistics */ - ret = H5get_alloc_stats(&total_alloc_bytes, &curr_alloc_bytes, - &peak_alloc_bytes, &max_block_size, &total_alloc_blocks_count, - &curr_alloc_blocks_count, &peak_alloc_blocks_count); + ret = H5get_alloc_stats(&alloc_stats); CHECK(ret, FAIL, "H5get_alloc_stats"); #if defined H5_MEMORY_ALLOC_SANITY_CHECK /* All the values should be >0 */ - if(0 == total_alloc_bytes) - ERROR("total_alloc_bytes == 0"); - if(0 == curr_alloc_bytes) - ERROR("curr_alloc_bytes == 0"); - if(0 == peak_alloc_bytes) - ERROR("peak_alloc_bytes == 0"); - if(0 == max_block_size) - ERROR("max_block_size == 0"); - if(0 == total_alloc_blocks_count) - ERROR("total_alloc_blocks_count == 0"); - if(0 == curr_alloc_blocks_count) - ERROR("curr_alloc_blocks_count == 0"); - if(0 == peak_alloc_blocks_count) - ERROR("peak_alloc_blocks_count == 0"); + if(0 == alloc_stats.total_alloc_bytes) + ERROR("alloc_stats.total_alloc_bytes == 0"); + if(0 == alloc_stats.curr_alloc_bytes) + ERROR("alloc_stats.curr_alloc_bytes == 0"); + if(0 == alloc_stats.peak_alloc_bytes) + ERROR("alloc_stats.peak_alloc_bytes == 0"); + if(0 == alloc_stats.max_block_size) + ERROR("alloc_stats.max_block_size == 0"); + if(0 == alloc_stats.total_alloc_blocks_count) + ERROR("alloc_stats.total_alloc_blocks_count == 0"); + if(0 == alloc_stats.curr_alloc_blocks_count) + ERROR("alloc_stats.curr_alloc_blocks_count == 0"); + if(0 == alloc_stats.peak_alloc_blocks_count) + ERROR("alloc_stats.peak_alloc_blocks_count == 0"); #else /* H5_MEMORY_ALLOC_SANITY_CHECK */ /* All the values should be == 0 */ - if(0 != total_alloc_bytes) - ERROR("total_alloc_bytes != 0"); - if(0 != curr_alloc_bytes) - ERROR("curr_alloc_bytes != 0"); - if(0 != peak_alloc_bytes) - ERROR("peak_alloc_bytes != 0"); - if(0 != max_block_size) - ERROR("max_block_size != 0"); - if(0 != total_alloc_blocks_count) - ERROR("total_alloc_blocks_count != 0"); - if(0 != curr_alloc_blocks_count) - ERROR("curr_alloc_blocks_count != 0"); - if(0 != peak_alloc_blocks_count) - ERROR("peak_alloc_blocks_count != 0"); + if(0 != alloc_stats.total_alloc_bytes) + ERROR("alloc_stats.total_alloc_bytes != 0"); + if(0 != alloc_stats.curr_alloc_bytes) + ERROR("alloc_stats.curr_alloc_bytes != 0"); + if(0 != alloc_stats.peak_alloc_bytes) + ERROR("alloc_stats.peak_alloc_bytes != 0"); + if(0 != alloc_stats.max_block_size) + ERROR("alloc_stats.max_block_size != 0"); + if(0 != alloc_stats.total_alloc_blocks_count) + ERROR("alloc_stats.total_alloc_blocks_count != 0"); + if(0 != alloc_stats.curr_alloc_blocks_count) + ERROR("alloc_stats.curr_alloc_blocks_count != 0"); + if(0 != alloc_stats.peak_alloc_blocks_count) + ERROR("alloc_stats.peak_alloc_blocks_count != 0"); #endif /* H5_MEMORY_ALLOC_SANITY_CHECK */ } /* end test_misc35() */ -- cgit v0.12