Skip to content

Commit

Permalink
Fix bad private FUNC_ENTER macros
Browse files Browse the repository at this point in the history
The name check in the FUNC_ENTER checks for private FUNC_ENTER macros
(which have NOAPI in the name) only checked for not having the
public form (H5Xfoo), so they could be inappropriately applied to
package-level functions (H5X__foo).

This PR fixes the bug and updates the inappropriate macros.
  • Loading branch information
derobins committed Oct 28, 2024
1 parent b8a06b5 commit e01fce4
Show file tree
Hide file tree
Showing 33 changed files with 65 additions and 57 deletions.
2 changes: 1 addition & 1 deletion src/H5.c
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ H5__init_package(void)
{
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE

/* Run the library initialization routine, if it hasn't already ran */
if (!H5_INIT_GLOBAL && !H5_TERM_GLOBAL)
Expand Down
2 changes: 1 addition & 1 deletion src/H5Aint.c
Original file line number Diff line number Diff line change
Expand Up @@ -1984,7 +1984,7 @@ H5A__get_ainfo(H5F_t *f, H5O_t *oh, H5O_ainfo_t *ainfo)
H5B2_t *bt2_name = NULL; /* v2 B-tree handle for name index */
htri_t ret_value = FAIL; /* Return value */

FUNC_ENTER_NOAPI_TAG(oh->cache_info.addr, FAIL)
FUNC_ENTER_PACKAGE_TAG(oh->cache_info.addr)

/* check arguments */
assert(f);
Expand Down
4 changes: 2 additions & 2 deletions src/H5B2hdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ H5B2__hdr_decr(H5B2_hdr_t *hdr)
herr_t
H5B2__hdr_fuse_incr(H5B2_hdr_t *hdr)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_PACKAGE_NOERR

/* Sanity check */
assert(hdr);
Expand All @@ -427,7 +427,7 @@ H5B2__hdr_fuse_incr(H5B2_hdr_t *hdr)
size_t
H5B2__hdr_fuse_decr(H5B2_hdr_t *hdr)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_PACKAGE_NOERR

/* Sanity check */
assert(hdr);
Expand Down
4 changes: 2 additions & 2 deletions src/H5B2int.c
Original file line number Diff line number Diff line change
Expand Up @@ -1847,7 +1847,7 @@ H5B2__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
{
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE

/* Sanity check */
assert(parent_entry);
Expand Down Expand Up @@ -2006,7 +2006,7 @@ H5B2__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
{
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE

/* Sanity check */
assert(parent_entry);
Expand Down
2 changes: 1 addition & 1 deletion src/H5B2test.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ H5B2__test2_debug(FILE *stream, int indent, int fwidth, const void *record, cons
herr_t
H5B2__get_root_addr_test(H5B2_t *bt2, haddr_t *root_addr)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_PACKAGE_NOERR

/* Check arguments. */
assert(bt2);
Expand Down
4 changes: 2 additions & 2 deletions src/H5Dchunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,7 @@ H5D__chunk_set_sizes(H5D_t *dset)
unsigned u; /* Iterator */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE

/* Sanity checks */
assert(dset);
Expand Down Expand Up @@ -8229,7 +8229,7 @@ H5D__chunk_get_offset_copy(const H5D_t *dset, const hsize_t *offset, hsize_t *of
unsigned u;
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE

assert(dset);
assert(offset);
Expand Down
4 changes: 2 additions & 2 deletions src/H5Dio.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ H5D__read(size_t count, H5D_dset_io_info_t *dset_info)
char fake_char; /* Temporary variable for NULL buffer pointers */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE

#ifdef H5_HAVE_PARALLEL
/* Reset the actual io mode properties to the default values in case
Expand Down Expand Up @@ -530,7 +530,7 @@ H5D__write(size_t count, H5D_dset_io_info_t *dset_info)
char fake_char; /* Temporary variable for NULL buffer pointers */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE

#ifdef H5_HAVE_PARALLEL
/* Reset the actual io mode properties to the default values in case
Expand Down
2 changes: 1 addition & 1 deletion src/H5Dlayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ H5D__layout_set_version(H5F_t *f, H5O_layout_t *layout)
unsigned version; /* Message version */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE

/* Sanity check */
assert(layout);
Expand Down
4 changes: 2 additions & 2 deletions src/H5FDint.c
Original file line number Diff line number Diff line change
Expand Up @@ -850,7 +850,7 @@ H5FD__read_selection_translate(uint32_t skip_vector_cb, H5FD_t *file, H5FD_mem_t
size_t vec_arr_nused = 0;
herr_t ret_value = SUCCEED;

FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE

/* Sanity checks */
assert(file);
Expand Down Expand Up @@ -1542,7 +1542,7 @@ H5FD__write_selection_translate(uint32_t skip_vector_cb, H5FD_t *file, H5FD_mem_
size_t vec_arr_nused = 0;
herr_t ret_value = SUCCEED;

FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE

/* Sanity checks */
assert(file);
Expand Down
2 changes: 1 addition & 1 deletion src/H5FDmpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -3904,7 +3904,7 @@ H5FD__mpio_ctl(H5FD_t *_file, uint64_t op_code, uint64_t flags, const void H5_AT
H5FD_mpio_t *file = (H5FD_mpio_t *)_file;
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE

/* Sanity checks */
assert(file);
Expand Down
2 changes: 1 addition & 1 deletion src/H5FDtest.c
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ H5FD__supports_swmr_test(const char *vfd_name)
{
bool ret_value = false;

FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_PACKAGE_NOERR

if (!vfd_name)
vfd_name = getenv("HDF5_TEST_DRIVER");
Expand Down
2 changes: 1 addition & 1 deletion src/H5FL.c
Original file line number Diff line number Diff line change
Expand Up @@ -1941,7 +1941,7 @@ H5FL__fac_gc(void)
H5FL_fac_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_PACKAGE

/* Walk through all the free lists, free()'ing the nodes */
gc_node = H5FL_fac_gc_head.first;
Expand Down
2 changes: 1 addition & 1 deletion src/H5FScache.c
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ H5FS__cache_hdr_notify(H5AC_notify_action_t action, void *_thing)
H5FS_t *fspace = (H5FS_t *)_thing; /* Pointer to the object */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE

/* Sanity check */
assert(fspace);
Expand Down
4 changes: 2 additions & 2 deletions src/H5FSint.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ H5FS__create_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
{
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE

/* Sanity check */
assert(parent_entry);
Expand Down Expand Up @@ -128,7 +128,7 @@ H5FS__destroy_flush_depend(H5AC_info_t *parent_entry, H5AC_info_t *child_entry)
{
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE

/* Sanity check */
assert(parent_entry);
Expand Down
4 changes: 2 additions & 2 deletions src/H5Faccum.c
Original file line number Diff line number Diff line change
Expand Up @@ -405,7 +405,7 @@ H5F__accum_write(H5F_shared_t *f_sh, H5FD_mem_t map_type, haddr_t addr, size_t s
H5FD_t *file; /* File driver pointer */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE

/* Sanity checks */
assert(f_sh);
Expand Down Expand Up @@ -1004,7 +1004,7 @@ H5F__accum_flush(H5F_shared_t *f_sh)
{
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE

/* Sanity checks */
assert(f_sh);
Expand Down
4 changes: 2 additions & 2 deletions src/H5Fprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ typedef struct H5F_t H5F_t;
#define H5F_HAS_FEATURE(F, FL) (H5F_has_feature(F, FL))
#define H5F_BASE_ADDR(F) (H5F_get_base_addr(F))
#define H5F_SYM_LEAF_K(F) (H5F_sym_leaf_k(F))
#define H5F_KVALUE(F, T) (H5F_Kvalue(F, T))
#define H5F_KVALUE(F, T) (H5F_kvalue(F, T))
#define H5F_NREFS(F) (H5F_get_nrefs(F))
#define H5F_SIZEOF_ADDR(F) (H5F_sizeof_addr(F))
#define H5F_SIZEOF_SIZE(F) (H5F_sizeof_size(F))
Expand Down Expand Up @@ -532,7 +532,7 @@ H5_DLL uint64_t H5F_get_rfic_flags(const H5F_t *f);
/* Functions than retrieve values set/cached from the superblock/FCPL */
H5_DLL haddr_t H5F_get_base_addr(const H5F_t *f);
H5_DLL unsigned H5F_sym_leaf_k(const H5F_t *f);
H5_DLL unsigned H5F_Kvalue(const H5F_t *f, const struct H5B_class_t *type);
H5_DLL unsigned H5F_kvalue(const H5F_t *f, const struct H5B_class_t *type);
H5_DLL unsigned H5F_get_nrefs(const H5F_t *f);
H5_DLL uint8_t H5F_sizeof_addr(const H5F_t *f);
H5_DLL uint8_t H5F_sizeof_size(const H5F_t *f);
Expand Down
6 changes: 3 additions & 3 deletions src/H5Fquery.c
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,7 @@ H5F_get_min_dset_ohdr(const H5F_t *f)
} /* end H5F_get_min_dset_ohdr */

/*-------------------------------------------------------------------------
* Function: H5F_Kvalue
* Function: H5F_kvalue
*
* Purpose: Replaced a macro to retrieve a B-tree key value for a certain
* type, now that the generic properties are being used to store
Expand All @@ -527,7 +527,7 @@ H5F_get_min_dset_ohdr(const H5F_t *f)
*-------------------------------------------------------------------------
*/
unsigned
H5F_Kvalue(const H5F_t *f, const H5B_class_t *type)
H5F_kvalue(const H5F_t *f, const H5B_class_t *type)
{
/* Use FUNC_ENTER_NOAPI_NOINIT_NOERR here to avoid performance issues */
FUNC_ENTER_NOAPI_NOINIT_NOERR
Expand All @@ -538,7 +538,7 @@ H5F_Kvalue(const H5F_t *f, const H5B_class_t *type)
assert(type);

FUNC_LEAVE_NOAPI(f->shared->sblock->btree_k[type->id])
} /* end H5F_Kvalue() */
} /* end H5F_kvalue() */

/*-------------------------------------------------------------------------
* Function: H5F_get_nrefs
Expand Down
2 changes: 1 addition & 1 deletion src/H5Gstab.c
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ H5G__stab_get_name_by_idx(const H5O_loc_t *oloc, H5_iter_order_t order, hsize_t
/* Portably clear udata struct (before FUNC_ENTER) */
memset(&udata, 0, sizeof(udata));

FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE

/* Sanity check */
assert(oloc);
Expand Down
2 changes: 1 addition & 1 deletion src/H5HG.c
Original file line number Diff line number Diff line change
Expand Up @@ -841,7 +841,7 @@ H5HG__free(H5HG_heap_t *heap)
{
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI(FAIL)
FUNC_ENTER_PACKAGE

/* Check arguments */
assert(heap);
Expand Down
2 changes: 1 addition & 1 deletion src/H5Oattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -564,7 +564,7 @@ H5O__attr_delete(H5F_t *f, H5O_t *oh, void *_mesg)
H5A_t *attr = (H5A_t *)_mesg;
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE

/* check args */
assert(f);
Expand Down
2 changes: 1 addition & 1 deletion src/H5Oattribute.c
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ H5O__attr_create(const H5O_loc_t *loc, H5A_t *attr)
htri_t shared_mesg; /* Should this message be stored in the Shared Message table? */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE

/* Check arguments */
assert(loc);
Expand Down
18 changes: 13 additions & 5 deletions src/H5Oshared.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ H5O_SHARED_DECODE(H5F_t *f, H5O_t *open_oh, unsigned mesg_flags, unsigned *iofla
{
void *ret_value = NULL; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
/* H5O_SHARED_ENCODE will be defined as a package function */
FUNC_ENTER_PACKAGE

#ifndef H5O_SHARED_TYPE
#error "Need to define H5O_SHARED_TYPE macro!"
Expand Down Expand Up @@ -97,7 +98,8 @@ H5O_SHARED_ENCODE(H5F_t *f, bool disable_shared, size_t H5_ATTR_UNUSED p_size, u
(const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
/* H5O_SHARED_ENCODE will be defined as a package function */
FUNC_ENTER_PACKAGE

#ifndef H5O_SHARED_TYPE
#error "Need to define H5O_SHARED_TYPE macro!"
Expand Down Expand Up @@ -148,7 +150,8 @@ H5O_SHARED_SIZE(const H5F_t *f, bool disable_shared, const void *_mesg)
(const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
size_t ret_value = 0; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
/* H5O_SHARED_SIZE will be defined as a package function */
FUNC_ENTER_PACKAGE

#ifndef H5O_SHARED_TYPE
#error "Need to define H5O_SHARED_TYPE macro!"
Expand Down Expand Up @@ -195,6 +198,7 @@ H5O_SHARED_DELETE(H5F_t *f, H5O_t *open_oh, void *_mesg)
H5O_shared_t *sh_mesg = (H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
herr_t ret_value = SUCCEED; /* Return value */

/* H5O_SHARED_DELETE will be defined as a package function */
FUNC_ENTER_PACKAGE

#ifndef H5O_SHARED_TYPE
Expand Down Expand Up @@ -241,6 +245,7 @@ H5O_SHARED_LINK(H5F_t *f, H5O_t *open_oh, void *_mesg)
H5O_shared_t *sh_mesg = (H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
herr_t ret_value = SUCCEED; /* Return value */

/* H5O_SHARED_LINK will be defined as a package function */
FUNC_ENTER_PACKAGE

#ifndef H5O_SHARED_TYPE
Expand Down Expand Up @@ -287,6 +292,7 @@ H5O_SHARED_COPY_FILE(H5F_t *file_src, void *_native_src, H5F_t *file_dst, bool *
void *dst_mesg = NULL; /* Destination message */
void *ret_value = NULL; /* Return value */

/* H5O_SHARED_COPY_FILE will be defined as a package function */
FUNC_ENTER_PACKAGE

#ifndef H5O_SHARED_TYPE
Expand Down Expand Up @@ -347,7 +353,8 @@ H5O_SHARED_POST_COPY_FILE(const H5O_loc_t H5_ATTR_NDEBUG_UNUSED *oloc_src, const
H5O_shared_t *shared_dst = (H5O_shared_t *)mesg_dst; /* Alias to shared info in native destination */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
/* H5O_SHARED_POST_COPY_FILE will be defined as a package function */
FUNC_ENTER_PACKAGE

assert(oloc_src->file);
assert(oloc_dst->file);
Expand Down Expand Up @@ -409,7 +416,8 @@ H5O_SHARED_DEBUG(H5F_t *f, const void *_mesg, FILE *stream, int indent, int fwid
(const H5O_shared_t *)_mesg; /* Pointer to shared message portion of actual message */
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
/* H5O_SHARED_DEBUG will be defined as a package function */
FUNC_ENTER_PACKAGE

#ifndef H5O_SHARED_TYPE
#error "Need to define H5O_SHARED_TYPE macro!"
Expand Down
2 changes: 1 addition & 1 deletion src/H5Pint.c
Original file line number Diff line number Diff line change
Expand Up @@ -5524,7 +5524,7 @@ H5P__close_class(H5P_genclass_t *pclass)
{
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE

assert(pclass);

Expand Down
2 changes: 1 addition & 1 deletion src/H5Rint.c
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ DESCRIPTION
herr_t
H5R__init_package(void)
{
FUNC_ENTER_NOAPI_NOINIT_NOERR
FUNC_ENTER_PACKAGE_NOERR

/* Sanity check, if assert fails, H5R_REF_BUF_SIZE must be increased */
HDcompile_assert(sizeof(H5R_ref_priv_t) <= H5R_REF_BUF_SIZE);
Expand Down
2 changes: 1 addition & 1 deletion src/H5T.c
Original file line number Diff line number Diff line change
Expand Up @@ -880,7 +880,7 @@ H5T__init_package(void)
#endif
herr_t ret_value = SUCCEED; /* Return value */

FUNC_ENTER_NOAPI_NOINIT
FUNC_ENTER_PACKAGE

/* Initialize the ID group for the file IDs */
if (H5I_register_type(H5I_DATATYPE_CLS) < 0)
Expand Down
2 changes: 1 addition & 1 deletion src/H5TSc11.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
void
H5TS__c11_first_thread_init(void)
{
FUNC_ENTER_NOAPI_NAMECHECK_ONLY
FUNC_ENTER_PACKAGE_NAMECHECK_ONLY

/* Initialize H5TS package */
H5TS__init();
Expand Down
2 changes: 1 addition & 1 deletion src/H5TSint.c
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ H5TS__api_mutex_release(unsigned *lock_count)
{
herr_t ret_value = SUCCEED;

FUNC_ENTER_NOAPI_NAMECHECK_ONLY
FUNC_ENTER_PACKAGE_NAMECHECK_ONLY

/* Return the current lock count */
*lock_count = H5TS_api_info_p.lock_count;
Expand Down
Loading

0 comments on commit e01fce4

Please sign in to comment.