Sitelet https://github.com/HDFGroup/hdf5/commit/3a21ee0877ecea5593112b7c8370cb8571a7e627
Skip to content

Commit 3a21ee0

Browse files
authored
Add 'warning density' computation to the warnhist script (#3910)
* Add 'warning density' computation to the warnhist script, along with several cleanups to it. Add "--enable-show-all-warnings" configure (and CMake) option to disable compiler diagnostic suppression (and therefore show all the otherwise suppressed compiler diagnostics), disabled by default. Clean up a buncn of misc. warnings. Signed-off-by: Quincey Koziol <qkoziol@amazon.com>
1 parent 6ffc55c commit 3a21ee0

18 files changed

Lines changed: 414 additions & 136 deletions

File tree

‎bin/warnhist‎

Lines changed: 269 additions & 32 deletions
Large diffs are not rendered by default.

‎config/cmake/ConfigureChecks.cmake‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,17 @@ if (HDF5_ENABLE_CODESTACK)
594594
endif ()
595595
MARK_AS_ADVANCED (HDF5_ENABLE_CODESTACK)
596596

597+
# ----------------------------------------------------------------------
598+
# Check if they would like to show all warnings (not suppressed internally)
599+
#-----------------------------------------------------------------------------
600+
option (HDF5_SHOW_ALL_WARNINGS "Show all warnings (not suppressed internally)." OFF)
601+
mark_as_advanced (HDF5_SHOW_ALL_WARNINGS)
602+
if (HDF5_SHOW_ALL_WARNINGS)
603+
message (STATUS "....All warnings will be displayed")
604+
set (${HDF_PREFIX}_SHOW_ALL_WARNINGS 1)
605+
endif ()
606+
MARK_AS_ADVANCED (HDF5_SHOW_ALL_WARNINGS)
607+
597608
# ----------------------------------------------------------------------
598609
# Check if they would like to use file locking by default
599610
#-----------------------------------------------------------------------------

‎config/cmake/H5pubconf.h.in‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -631,6 +631,9 @@
631631
/* Check exception handling functions during data conversions */
632632
#cmakedefine H5_WANT_DCONV_EXCEPTION @H5_WANT_DCONV_EXCEPTION@
633633

634+
/* Define if showing all compiler warnings are desired (i.e. don't suppress them internally) */
635+
#cmakedefine H5_SHOW_ALL_WARNINGS @H5_SHOW_ALL_WARNINGS@
636+
634637
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
635638
significant byte first (like Motorola and SPARC, unlike Intel). */
636639
#if !defined(__APPLE__)

‎configure.ac‎

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2311,6 +2311,45 @@ case "X-$DEV_WARNINGS" in
23112311
;;
23122312
esac
23132313

2314+
## ----------------------------------------------------------------------
2315+
## Check if they would like suppessed compiler diagnostics displayed
2316+
## (i.e. not suppressed)
2317+
##
2318+
## NOTE: Compiler diagnostics (i.e. warnings) are suppressed for some
2319+
## "noisy" warnings that are harmless (in the opinion of the primary
2320+
## HDF5 development team), but this option is provided to allow
2321+
## developers to see those warnings.
2322+
##
2323+
AC_MSG_CHECKING([whether showing all compiler warnings is enabled])
2324+
AC_ARG_ENABLE([show-all-warnings],
2325+
[AS_HELP_STRING([--enable-show-all-warnings],
2326+
[Enable showing all compiler warnings (for developer debugging).
2327+
[default=no]
2328+
])],
2329+
[SHOW_ALL_WARNINGS=$enableval])
2330+
2331+
## Set the default level.
2332+
if test "X-$SHOW_ALL_WARNINGS" = X- ; then
2333+
SHOW_ALL_WARNINGS=no
2334+
fi
2335+
2336+
## Allow this variable to be substituted in
2337+
## other files (src/libhdf5.settings.in, etc.)
2338+
AC_SUBST([SHOW_ALL_WARNINGS])
2339+
2340+
case "X-$SHOW_ALL_WARNINGS" in
2341+
X-yes)
2342+
AC_MSG_RESULT([yes])
2343+
AC_DEFINE([SHOW_ALL_WARNINGS], [1], [Define if showing all warnings is desired (i.e. not suppressed internally with H5_DIAG_OFF)])
2344+
;;
2345+
X-no)
2346+
AC_MSG_RESULT([no])
2347+
;;
2348+
*)
2349+
AC_MSG_ERROR([Unrecognized value: $SHOW_ALL_WARNINGS])
2350+
;;
2351+
esac
2352+
23142353
## ----------------------------------------------------------------------
23152354
## Check if the compiler should use profiling flags/settings
23162355
##

‎fortran/src/H5config_f.inc.cmake‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,8 @@
2828
#endif
2929

3030
! Define if on APPLE
31-
#cmakedefine01 H5_HAVE_DARWIN
32-
#if H5_HAVE_DARWIN == 0
31+
#cmakedefine01 CMAKE_H5_HAVE_DARWIN
32+
#if CMAKE_H5_HAVE_DARWIN == 0
3333
#undef H5_HAVE_DARWIN
3434
#else
3535
#define H5_HAVE_DARWIN

‎release_docs/INSTALL_CMake.txt‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -826,6 +826,7 @@ ALLOW_UNSUPPORTED "Allow unsupported combinations of configure opti
826826
HDF5_EXTERNAL_LIB_PREFIX "Use prefix for custom library naming." ""
827827
HDF5_DISABLE_COMPILER_WARNINGS "Disable compiler warnings" OFF
828828
HDF5_ENABLE_ALL_WARNINGS "Enable all warnings" OFF
829+
HDF5_SHOW_ALL_WARNINGS "Show all warnings (i.e. not suppress "noisy" ones internally)" OFF
829830
HDF5_ENABLE_CODESTACK "Enable the function stack tracing (for developer debugging)." OFF
830831
HDF5_ENABLE_COVERAGE "Enable code coverage for Libraries and Programs" OFF
831832
HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF

‎src/H5Dpkg.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ H5_DLL herr_t H5D__chunk_allocated(const H5D_t *dset, hsize_t *nbytes);
727727
H5_DLL herr_t H5D__chunk_allocate(const H5D_t *dset, bool full_overwrite, const hsize_t old_dim[]);
728728
H5_DLL herr_t H5D__chunk_file_alloc(const H5D_chk_idx_info_t *idx_info, const H5F_block_t *old_chunk,
729729
H5F_block_t *new_chunk, bool *need_insert, const hsize_t *scaled);
730-
H5_DLL void *H5D__chunk_mem_alloc(size_t size, void *pline);
730+
H5_DLL void *H5D__chunk_mem_alloc(size_t size, void *pline) H5_ATTR_MALLOC;
731731
H5_DLL void H5D__chunk_mem_free(void *chk, void *pline);
732732
H5_DLL void *H5D__chunk_mem_xfree(void *chk, const void *pline);
733733
H5_DLL void *H5D__chunk_mem_realloc(void *chk, size_t size, const H5O_pline_t *pline);

‎src/H5EApkg.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ H5_DLL herr_t H5EA__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t
389389
H5_DLL H5EA_hdr_t *H5EA__hdr_alloc(H5F_t *f);
390390
H5_DLL herr_t H5EA__hdr_init(H5EA_hdr_t *hdr, void *ctx_udata);
391391
H5_DLL haddr_t H5EA__hdr_create(H5F_t *f, const H5EA_create_t *cparam, void *ctx_udata);
392-
H5_DLL void *H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts);
392+
H5_DLL void *H5EA__hdr_alloc_elmts(H5EA_hdr_t *hdr, size_t nelmts) H5_ATTR_MALLOC;
393393
H5_DLL herr_t H5EA__hdr_free_elmts(H5EA_hdr_t *hdr, size_t nelmts, void *elmts);
394394
H5_DLL herr_t H5EA__hdr_incr(H5EA_hdr_t *hdr);
395395
H5_DLL herr_t H5EA__hdr_decr(H5EA_hdr_t *hdr);

‎src/H5ESpkg.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ typedef int (*H5ES_list_iter_func_t)(H5ES_event_t *ev, void *ctx);
7575
/******************************/
7676
/* Package Private Prototypes */
7777
/******************************/
78-
H5_DLL H5ES_t *H5ES__create(void);
78+
H5_DLL H5ES_t *H5ES__create(void) H5_ATTR_MALLOC;
7979
H5_DLL herr_t H5ES__insert_request(H5ES_t *es, H5VL_t *connector, void *token);
8080
H5_DLL herr_t H5ES__wait(H5ES_t *es, uint64_t timeout, size_t *num_in_progress, bool *op_failed);
8181
H5_DLL herr_t H5ES__get_requests(H5ES_t *es, H5_iter_order_t order, hid_t *connector_ids, void **requests,

‎src/H5Idbg.c‎

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -83,13 +83,13 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
8383

8484
fprintf(stderr, " id = %" PRIdHID "\n", info->id);
8585
fprintf(stderr, " count = %u\n", info->count);
86-
fprintf(stderr, " obj = 0x%8p\n", info->object);
86+
fprintf(stderr, " obj = 0x%8p\n", info->u.c_object);
8787
fprintf(stderr, " marked = %d\n", info->marked);
8888

8989
/* Get the group location, so we get get the name */
9090
switch (type) {
9191
case H5I_GROUP: {
92-
const H5VL_object_t *vol_obj = (const H5VL_object_t *)info->object;
92+
const H5VL_object_t *vol_obj = (const H5VL_object_t *)info->u.c_object;
9393

9494
object = H5VL_object_data(vol_obj);
9595
if (H5_VOL_NATIVE == vol_obj->connector->cls->value)
@@ -98,7 +98,7 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
9898
}
9999

100100
case H5I_DATASET: {
101-
const H5VL_object_t *vol_obj = (const H5VL_object_t *)info->object;
101+
const H5VL_object_t *vol_obj = (const H5VL_object_t *)info->u.c_object;
102102

103103
object = H5VL_object_data(vol_obj);
104104
if (H5_VOL_NATIVE == vol_obj->connector->cls->value)
@@ -107,13 +107,10 @@ H5I__id_dump_cb(void *_item, void H5_ATTR_UNUSED *_key, void *_udata)
107107
}
108108

109109
case H5I_DATATYPE: {
110-
const H5T_t *dt = (const H5T_t *)info->object;
110+
H5T_t *dt = info->u.object;
111111

112-
H5_GCC_CLANG_DIAG_OFF("cast-qual")
113-
object = (void *)H5T_get_actual_type((H5T_t *)dt);
114-
H5_GCC_CLANG_DIAG_ON("cast-qual")
115-
116-
path = H5T_nameof(object);
112+
object = H5T_get_actual_type((H5T_t *)dt);
113+
path = H5T_nameof(object);
117114
break;
118115
}
119116

0 commit comments

Comments
 (0)