diff options
Diffstat (limited to 'src')
40 files changed, 1097 insertions, 1262 deletions
@@ -276,7 +276,7 @@ H5Acreate_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, attr_name, type_id, space_id, acpl_id, aapl_id, es_id)) < 0) { + H5ARG_TRACE10(__func__, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, attr_name, type_id, space_id, acpl_id, aapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") @@ -425,7 +425,7 @@ H5Acreate_by_name_async(const char *app_file, const char *app_func, unsigned app if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE12(FUNC, "*s*sIui*s*siiiiii", app_file, app_func, app_line, loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id, es_id)) < 0) { + H5ARG_TRACE12(__func__, "*s*sIui*s*siiiiii", app_file, app_func, app_line, loc_id, obj_name, attr_name, type_id, space_id, acpl_id, aapl_id, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") @@ -588,7 +588,7 @@ H5Aopen_async(const char *app_file, const char *app_func, unsigned app_line, hid if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, attr_name, aapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, attr_name, aapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") @@ -719,7 +719,7 @@ H5Aopen_by_name_async(const char *app_file, const char *app_func, unsigned app_l if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(FUNC, "*s*sIui*s*siii", app_file, app_func, app_line, loc_id, obj_name, attr_name, aapl_id, lapl_id, es_id)) < 0) { + H5ARG_TRACE9(__func__, "*s*sIui*s*siii", app_file, app_func, app_line, loc_id, obj_name, attr_name, aapl_id, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") @@ -859,7 +859,7 @@ H5Aopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_li if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE11(FUNC, "*s*sIui*sIiIohiii", app_file, app_func, app_line, loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id, es_id)) < 0) { + H5ARG_TRACE11(__func__, "*s*sIui*sIiIohiii", app_file, app_func, app_line, loc_id, obj_name, idx_type, order, n, aapl_id, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_ATTR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on attribute ID") @@ -971,7 +971,7 @@ H5Awrite_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0) + H5ARG_TRACE7(__func__, "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1079,7 +1079,7 @@ H5Aread_async(const char *app_file, const char *app_func, unsigned app_line, hid if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0) + H5ARG_TRACE7(__func__, "*s*sIuii*xi", app_file, app_func, app_line, attr_id, dtype_id, buf, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1657,7 +1657,7 @@ H5Arename_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIui*s*si", app_file, app_func, app_line, loc_id, old_name, new_name, es_id)) < 0) + H5ARG_TRACE7(__func__, "*s*sIui*s*si", app_file, app_func, app_line, loc_id, old_name, new_name, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1777,7 +1777,7 @@ H5Arename_by_name_async(const char *app_file, const char *app_func, unsigned app if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(FUNC, "*s*sIui*s*s*sii", app_file, app_func, app_line, loc_id, obj_name, old_attr_name, new_attr_name, lapl_id, es_id)) < 0) + H5ARG_TRACE9(__func__, "*s*sIui*s*s*sii", app_file, app_func, app_line, loc_id, obj_name, old_attr_name, new_attr_name, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -2210,7 +2210,7 @@ H5Aclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, attr_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, attr_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -2361,7 +2361,7 @@ H5Aexists_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIui*s*bi", app_file, app_func, app_line, obj_id, attr_name, attr_exists, es_id)) < 0) + H5ARG_TRACE7(__func__, "*s*sIui*s*bi", app_file, app_func, app_line, obj_id, attr_name, attr_exists, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -2480,7 +2480,7 @@ H5Aexists_by_name_async(const char *app_file, const char *app_func, unsigned app if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(FUNC, "*s*sIui*s*s*bii", app_file, app_func, app_line, loc_id, obj_name, attr_name, attr_exists, lapl_id, es_id)) < 0) + H5ARG_TRACE9(__func__, "*s*sIui*s*s*bii", app_file, app_func, app_line, loc_id, obj_name, attr_name, attr_exists, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_ATTR, H5E_CANTINSERT, FAIL, "can't insert token into event set") diff --git a/src/H5Cmpio.c b/src/H5Cmpio.c index d6da9b7..35d8dd0 100644 --- a/src/H5Cmpio.c +++ b/src/H5Cmpio.c @@ -195,7 +195,7 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha HDmemset(entries_to_clear, 0, sizeof(entries_to_clear)); #if H5C_APPLY_CANDIDATE_LIST__DEBUG - HDfprintf(stdout, "%s:%d: setting up candidate assignment table.\n", FUNC, mpi_rank); + HDfprintf(stdout, "%s:%d: setting up candidate assignment table.\n", __func__, mpi_rank); HDmemset(tbl_buf, 0, sizeof(tbl_buf)); @@ -272,10 +272,10 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha HDsprintf(&(tbl_buf[HDstrlen(tbl_buf)]), "\n"); HDfprintf(stdout, "%s", tbl_buf); - HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n", FUNC, mpi_rank, first_entry_to_flush, + HDfprintf(stdout, "%s:%d: flush entries [%u, %u].\n", __func__, mpi_rank, first_entry_to_flush, last_entry_to_flush); - HDfprintf(stdout, "%s:%d: marking entries.\n", FUNC, mpi_rank); + HDfprintf(stdout, "%s:%d: marking entries.\n", __func__, mpi_rank); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ for (u = 0; u < num_candidates; u++) { @@ -353,8 +353,8 @@ H5C_apply_candidate_list(H5F_t *f, H5C_t *cache_ptr, unsigned num_candidates, ha #endif /* H5C_DO_SANITY_CHECKS */ #if H5C_APPLY_CANDIDATE_LIST__DEBUG - HDfprintf(stdout, "%s:%d: num candidates/to clear/to flush = %u/%u/%u.\n", FUNC, mpi_rank, num_candidates, - total_entries_to_clear, total_entries_to_flush); + HDfprintf(stdout, "%s:%d: num candidates/to clear/to flush = %u/%u/%u.\n", __func__, mpi_rank, + num_candidates, total_entries_to_clear, total_entries_to_flush); #endif /* H5C_APPLY_CANDIDATE_LIST__DEBUG */ /* We have now marked all the entries on the candidate list for @@ -228,7 +228,7 @@ H5Dcreate_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE11(FUNC, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id, es_id)) < 0) { + H5ARG_TRACE11(__func__, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, type_id, space_id, lcpl_id, dcpl_id, dapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on dataset ID") @@ -437,7 +437,7 @@ H5Dopen_async(const char *app_file, const char *app_func, unsigned app_line, hid if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, dapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, dapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on dataset ID") @@ -531,7 +531,7 @@ H5Dclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -640,7 +640,7 @@ H5Dget_space_async(const char *app_file, const char *app_func, unsigned app_line if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0) { + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, dset_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_DATASET, H5E_CANTDEC, H5I_INVALID_HID, @@ -1011,7 +1011,7 @@ H5Dread_async(const char *app_file, const char *app_func, unsigned app_line, hid if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIuiiiiixi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIuiiiiixi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1198,7 +1198,7 @@ H5Dwrite_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIuiiiii*xi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIuiiiii*xi", app_file, app_func, app_line, dset_id, mem_type_id, mem_space_id, file_space_id, dxpl_id, buf, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1755,7 +1755,7 @@ H5Dset_extent_async(const char *app_file, const char *app_func, unsigned app_lin if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE6(FUNC, "*s*sIui*hi", app_file, app_func, app_line, dset_id, size, es_id)) < 0) + H5ARG_TRACE6(__func__, "*s*sIui*hi", app_file, app_func, app_line, dset_id, size, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_DATASET, H5E_CANTINSERT, FAIL, "can't insert token into event set") diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index cd567aa..a30cb6a 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -31,7 +31,7 @@ typedef struct H5E_t H5E_t; * error number, the minor error number, and a description of the error. */ #define HERROR(maj_id, min_id, ...) \ - H5E_printf_stack(NULL, __FILE__, FUNC, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__) + H5E_printf_stack(NULL, __FILE__, __func__, __LINE__, H5E_ERR_CLS_g, maj_id, min_id, __VA_ARGS__) /* * HCOMMON_ERROR macro, used by HDONE_ERROR and HGOTO_ERROR @@ -651,7 +651,7 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE8(FUNC, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) { + H5ARG_TRACE8(__func__, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") @@ -670,7 +670,7 @@ H5Fcreate_async(const char *app_file, const char *app_func, unsigned app_line, c if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE8(FUNC, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) + H5ARG_TRACE8(__func__, "*s*sIu*sIuiii", app_file, app_func, app_line, filename, flags, fcpl_id, fapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") @@ -828,7 +828,7 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") @@ -847,7 +847,7 @@ H5Fopen_async(const char *app_file, const char *app_func, unsigned app_line, con if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) + H5ARG_TRACE7(__func__, "*s*sIu*sIuii", app_file, app_func, app_line, filename, flags, fapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") @@ -955,7 +955,7 @@ H5Fflush_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE6(FUNC, "*s*sIuiFsi", app_file, app_func, app_line, object_id, scope, es_id)) < 0) + H5ARG_TRACE6(__func__, "*s*sIuiFsi", app_file, app_func, app_line, object_id, scope, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1049,7 +1049,7 @@ H5Fclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1351,7 +1351,7 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) { + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref(ret_value) < 0) HDONE_ERROR(H5E_FILE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on file ID") @@ -1370,7 +1370,7 @@ H5Freopen_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, file_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_FILE, H5E_CANTINSERT, H5I_INVALID_HID, "can't insert token into event set") diff --git a/src/H5FAdblkpage.c b/src/H5FAdblkpage.c index 1dca0fb..713bd67 100644 --- a/src/H5FAdblkpage.c +++ b/src/H5FAdblkpage.c @@ -147,7 +147,7 @@ H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts) FUNC_ENTER_PACKAGE #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: Called, addr = %a\n", FUNC, addr); + HDfprintf(stderr, "%s: Called, addr = %a\n", __func__, addr); #endif /* H5FA_DEBUG */ /* Sanity check */ @@ -162,7 +162,7 @@ H5FA__dblk_page_create(H5FA_hdr_t *hdr, haddr_t addr, size_t nelmts) dblk_page->addr = addr; dblk_page->size = H5FA_DBLK_PAGE_SIZE(hdr, nelmts); #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", FUNC, dblk_page->size); + HDfprintf(stderr, "%s: dblk_page->size = %Zu\n", __func__, dblk_page->size); #endif /* H5FA_DEBUG */ /* Clear any elements in data block page to fill value */ @@ -223,7 +223,7 @@ H5FA__dblk_page_protect(H5FA_hdr_t *hdr, haddr_t dblk_page_addr, size_t dblk_pag FUNC_ENTER_PACKAGE #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: Called\n", FUNC); + HDfprintf(stderr, "%s: Called\n", __func__); #endif /* H5FA_DEBUG */ /* Sanity check */ @@ -293,7 +293,7 @@ H5FA__dblk_page_unprotect(H5FA_dblk_page_t *dblk_page, unsigned cache_flags) FUNC_ENTER_PACKAGE #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: Called\n", FUNC); + HDfprintf(stderr, "%s: Called\n", __func__); #endif /* H5FA_DEBUG */ /* Sanity check */ diff --git a/src/H5FAstat.c b/src/H5FAstat.c index 98f7195..f7d1b90 100644 --- a/src/H5FAstat.c +++ b/src/H5FAstat.c @@ -84,7 +84,7 @@ H5FA_get_stats(const H5FA_t *fa, H5FA_stat_t *stats) FUNC_ENTER_NOAPI_NOERR #ifdef H5FA_DEBUG - HDfprintf(stderr, "%s: Called\n", FUNC); + HDfprintf(stderr, "%s: Called\n", __func__); #endif /* H5FA_DEBUG */ /* Check arguments */ diff --git a/src/H5FDhdfs.c b/src/H5FDhdfs.c index 50e02a4..b308f17 100644 --- a/src/H5FDhdfs.c +++ b/src/H5FDhdfs.c @@ -364,7 +364,7 @@ H5FD_hdfs_init(void) FUNC_ENTER_NOAPI(H5I_INVALID_HID) #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif if (H5I_VFL != H5I_get_type(H5FD_HDFS_g)) @@ -405,7 +405,7 @@ H5FD__hdfs_term(void) FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif /* Reset VFL ID */ @@ -439,7 +439,7 @@ H5FD__hdfs_handle_open(const char *path, const char *namenode_name, const int32_ FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif if (path == NULL || path[0] == '\0') @@ -524,7 +524,7 @@ H5FD__hdfs_handle_close(hdfs_t *handle) FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif if (handle == NULL) @@ -615,7 +615,7 @@ H5Pset_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa) HDassert(fa != NULL); #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); @@ -656,7 +656,7 @@ H5Pget_fapl_hdfs(hid_t fapl_id, H5FD_hdfs_fapl_t *fa_dst /*out*/) H5TRACE2("e", "ix", fapl_id, fa_dst); #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif if (fa_dst == NULL) @@ -813,7 +813,7 @@ hdfs__reset_stats(H5FD_hdfs_t *file) FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif if (file == NULL) @@ -871,7 +871,7 @@ H5FD__hdfs_open(const char *path, unsigned flags, hid_t fapl_id, haddr_t maxaddr FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif /* HDFS_DEBUG */ /* Sanity check on file offsets */ @@ -1209,7 +1209,7 @@ H5FD__hdfs_close(H5FD_t *_file) FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif /* Sanity checks */ @@ -1265,7 +1265,7 @@ H5FD__hdfs_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif /* HDFS_DEBUG */ HDassert(f1->hdfs_handle != NULL); @@ -1338,7 +1338,7 @@ H5FD__hdfs_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif if (flags) { @@ -1376,7 +1376,7 @@ H5FD__hdfs_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif FUNC_LEAVE_NOAPI(file->eoa) @@ -1407,7 +1407,7 @@ H5FD__hdfs_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t addr) FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif file->eoa = addr; @@ -1441,7 +1441,7 @@ H5FD__hdfs_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_STATIC_NOERR #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif HDassert(file->hdfs_handle != NULL); @@ -1476,7 +1476,7 @@ H5FD__hdfs_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_hand FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif /* HDFS_DEBUG */ if (!file_handle) @@ -1526,7 +1526,7 @@ H5FD__hdfs_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif /* HDFS_DEBUG */ HDassert(file != NULL); @@ -1598,7 +1598,7 @@ H5FD__hdfs_write(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, h FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot write to read-only file") @@ -1636,7 +1636,7 @@ H5FD__hdfs_truncate(H5FD_t H5_ATTR_UNUSED *_file, hid_t H5_ATTR_UNUSED dxpl_id, FUNC_ENTER_STATIC #if HDFS_DEBUG - HDfprintf(stdout, "called %s.\n", FUNC); + HDfprintf(stdout, "called %s.\n", __func__); #endif HGOTO_ERROR(H5E_VFL, H5E_UNSUPPORTED, FAIL, "cannot truncate read-only file") diff --git a/src/H5FDmirror.c b/src/H5FDmirror.c index 3ea71ce..1886714 100644 --- a/src/H5FDmirror.c +++ b/src/H5FDmirror.c @@ -220,7 +220,7 @@ H5FD__init_package(void) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); if (H5FD_mirror_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize mirror VFD"); @@ -246,7 +246,7 @@ H5FD_mirror_init(void) FUNC_ENTER_NOAPI(H5I_INVALID_HID) - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); if (H5I_VFL != H5I_get_type(H5FD_MIRROR_g)) H5FD_MIRROR_g = H5FD_register(&H5FD_mirror_g, sizeof(H5FD_class_t), FALSE); @@ -273,7 +273,7 @@ H5FD__mirror_term(void) /* Reset VFL ID */ H5FD_MIRROR_g = 0; - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); FUNC_LEAVE_NOAPI(SUCCEED) } /* end H5FD__mirror_term() */ @@ -1129,7 +1129,7 @@ H5FD__mirror_verify_reply(H5FD_mirror_t *file) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); HDassert(file && file->sock_fd); @@ -1184,7 +1184,7 @@ H5FD__mirror_fapl_get(H5FD_t *_file) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); fa = (H5FD_mirror_fapl_t *)H5MM_calloc(sizeof(H5FD_mirror_fapl_t)); if (NULL == fa) @@ -1220,7 +1220,7 @@ H5FD__mirror_fapl_copy(const void *_old_fa) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); new_fa = (H5FD_mirror_fapl_t *)H5MM_malloc(sizeof(H5FD_mirror_fapl_t)); if (new_fa == NULL) @@ -1252,7 +1252,7 @@ H5FD__mirror_fapl_free(void *_fa) FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); /* sanity check */ HDassert(fa != NULL); @@ -1283,7 +1283,7 @@ H5Pget_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa_dst /*out*/) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", fapl_id, fa_dst); - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); if (NULL == fa_dst) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "fa_dst is NULL"); @@ -1324,7 +1324,7 @@ H5Pset_fapl_mirror(hid_t fapl_id, H5FD_mirror_fapl_t *fa) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*#", fapl_id, fa); - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); plist = H5P_object_verify(fapl_id, H5P_FILE_ACCESS); if (NULL == plist) @@ -1370,7 +1370,7 @@ H5FD__mirror_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t maxad FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); /* --------------- */ /* Check arguments */ @@ -1495,7 +1495,7 @@ H5FD__mirror_close(H5FD_t *_file) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); /* Sanity check */ HDassert(file); @@ -1567,7 +1567,7 @@ H5FD__mirror_query(const H5FD_t H5_ATTR_UNUSED *_file, unsigned long *flags) { FUNC_ENTER_STATIC_NOERR; - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); /* Notice: the Mirror VFD Writer currently uses only the Sec2 driver as * the underying driver -- as such, the Mirror VFD implementation copies @@ -1604,7 +1604,7 @@ H5FD__mirror_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); HDassert(file); @@ -1631,7 +1631,7 @@ H5FD__mirror_set_eoa(H5FD_t *_file, H5FD_mem_t type, haddr_t addr) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); HDassert(file); @@ -1686,7 +1686,7 @@ H5FD__mirror_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); HDassert(file); @@ -1707,7 +1707,7 @@ H5FD__mirror_read(H5FD_t H5_ATTR_UNUSED *_file, H5FD_mem_t H5_ATTR_UNUSED type, { FUNC_ENTER_STATIC_NOERR - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); FUNC_LEAVE_NOAPI(FAIL) } /* end H5FD__mirror_read() */ @@ -1740,7 +1740,7 @@ H5FD__mirror_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); HDassert(file); HDassert(buf); @@ -1803,7 +1803,7 @@ H5FD__mirror_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_AT FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_TRUNCATE; @@ -1851,7 +1851,7 @@ H5FD__mirror_lock(H5FD_t *_file, hbool_t rw) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_LOCK; @@ -1898,7 +1898,7 @@ H5FD__mirror_unlock(H5FD_t *_file) FUNC_ENTER_STATIC - LOG_OP_CALL(FUNC); + LOG_OP_CALL(__func__); file->xmit.xmit_count = (file->xmit_i)++; file->xmit.op = H5FD_MIRROR_OP_UNLOCK; diff --git a/src/H5FDmpio.c b/src/H5FDmpio.c index 5f1caa8..2d86eed 100644 --- a/src/H5FDmpio.c +++ b/src/H5FDmpio.c @@ -702,7 +702,7 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* set atomicity value */ @@ -712,7 +712,7 @@ H5FD_set_mpio_atomicity(H5FD_t *_file, hbool_t flag) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -745,7 +745,7 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Get atomicity value */ @@ -760,7 +760,7 @@ H5FD_get_mpio_atomicity(H5FD_t *_file, hbool_t *flag) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -826,7 +826,7 @@ H5FD__mpio_open(const char *name, unsigned flags, hid_t fapl_id, haddr_t H5_ATTR (H5FD_mpio_debug_rank_s < 0 || H5FD_mpio_debug_rank_s == mpi_rank)); if (H5FD_mpio_debug_t_flag) HDfprintf(stderr, "%s: (%d) Entering - name = \"%s\", flags = 0x%x, fapl_id = %d, maxaddr = %lu\n", - FUNC, mpi_rank, name, flags, (int)fapl_id, (unsigned long)maxaddr); + __func__, mpi_rank, name, flags, (int)fapl_id, (unsigned long)maxaddr); #endif /* Convert HDF5 flags to MPI-IO flags */ @@ -906,7 +906,7 @@ done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -939,7 +939,7 @@ H5FD__mpio_close(H5FD_t *_file) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ @@ -958,7 +958,7 @@ H5FD__mpio_close(H5FD_t *_file) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1178,7 +1178,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ @@ -1240,7 +1240,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", __func__, file->mpi_rank); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ if (H5CX_get_mpio_coll_opt(&coll_opt_mode) < 0) @@ -1249,13 +1249,13 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", __func__, file->mpi_rank); #endif /* Check whether we should read from rank 0 and broadcast to other ranks */ if (H5CX_get_mpio_rank0_bcast()) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) doing read-rank0-and-MPI_Bcast\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing read-rank0-and-MPI_Bcast\n", __func__, file->mpi_rank); #endif /* Indicate path we've taken */ rank0_bcast = TRUE; @@ -1277,7 +1277,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU else { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); #endif /* Perform independent read operation */ @@ -1296,7 +1296,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU else { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); #endif /* Perform independent read operation */ @@ -1346,8 +1346,8 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_r_flag) - HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_read = %lld\n", FUNC, file->mpi_rank, (long)mpi_off, - bytes_read); + HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_read = %lld\n", __func__, file->mpi_rank, + (long)mpi_off, bytes_read); #endif /* @@ -1359,7 +1359,7 @@ H5FD__mpio_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR_UNU done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1418,7 +1418,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ @@ -1490,7 +1490,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) using MPIO collective mode\n", __func__, file->mpi_rank); #endif /* Get the collective_opt property to check whether the application wants to do IO individually. */ @@ -1500,7 +1500,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h if (coll_opt_mode == H5FD_MPIO_COLLECTIVE_IO) { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing MPI collective IO\n", __func__, file->mpi_rank); #endif /* Perform collective write operation */ if (MPI_SUCCESS != @@ -1514,7 +1514,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); #endif /* Perform independent write operation */ if (MPI_SUCCESS != @@ -1530,7 +1530,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h else { #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) doing MPI independent IO\n", __func__, file->mpi_rank); #endif /* Perform independent write operation */ @@ -1563,7 +1563,7 @@ H5FD__mpio_write(H5FD_t *_file, H5FD_mem_t type, hid_t H5_ATTR_UNUSED dxpl_id, h #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_w_flag) - HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_written = %lld\n", FUNC, file->mpi_rank, + HDfprintf(stderr, "%s: (%d) mpi_off = %ld bytes_written = %lld\n", __func__, file->mpi_rank, (long)mpi_off, bytes_written); #endif @@ -1584,7 +1584,7 @@ done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving: ret_value = %d\n", FUNC, file->mpi_rank, ret_value); + HDfprintf(stderr, "%s: (%d) Leaving: ret_value = %d\n", __func__, file->mpi_rank, ret_value); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1616,7 +1616,7 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ @@ -1631,7 +1631,7 @@ H5FD__mpio_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closing) done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -1673,7 +1673,7 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Entering\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Entering\n", __func__, file->mpi_rank); #endif /* Sanity checks */ @@ -1742,7 +1742,7 @@ H5FD__mpio_truncate(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t H5_ATTR done: #ifdef H5FDmpio_DEBUG if (H5FD_mpio_debug_t_flag) - HDfprintf(stderr, "%s: (%d) Leaving\n", FUNC, file->mpi_rank); + HDfprintf(stderr, "%s: (%d) Leaving\n", __func__, file->mpi_rank); #endif FUNC_LEAVE_NOAPI(ret_value) diff --git a/src/H5FDspace.c b/src/H5FDspace.c index 339c413..de52dc3 100644 --- a/src/H5FDspace.c +++ b/src/H5FDspace.c @@ -148,7 +148,7 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr FUNC_ENTER_PACKAGE #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); + HDfprintf(stderr, "%s: type = %u, size = %Hu\n", __func__, (unsigned)type, size); #endif /* H5FD_ALLOC_DEBUG */ /* check args */ @@ -211,7 +211,7 @@ H5FD__alloc_real(H5FD_t *file, H5FD_mem_t type, hsize_t size, haddr_t *frag_addr done: #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value); + HDfprintf(stderr, "%s: ret_value = %a\n", __func__, ret_value); #endif /* H5FD_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5FD__alloc_real() */ @@ -287,7 +287,7 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) HDassert(size > 0); #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type, addr, size); + HDfprintf(stderr, "%s: type = %u, addr = %a, size = %Hu\n", __func__, (unsigned)type, addr, size); #endif /* H5FD_ALLOC_DEBUG */ /* Sanity checking */ @@ -304,7 +304,7 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) /* Check for file driver 'free' callback and call it if available */ if (file->cls->free) { #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: Letting VFD free space\n", FUNC); + HDfprintf(stderr, "%s: Letting VFD free space\n", __func__); #endif /* H5FD_ALLOC_DEBUG */ if ((file->cls->free)(file, type, H5CX_get_dxpl(), addr, size) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "driver free request failed") @@ -317,11 +317,11 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) eoa = file->cls->get_eoa(file, type); #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: eoa = %a\n", FUNC, eoa); + HDfprintf(stderr, "%s: eoa = %a\n", __func__, eoa); #endif /* H5FD_ALLOC_DEBUG */ if (eoa == (addr + size)) { #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: Reducing file size to = %a\n", FUNC, addr); + HDfprintf(stderr, "%s: Reducing file size to = %a\n", __func__, addr); #endif /* H5FD_ALLOC_DEBUG */ if (file->cls->set_eoa(file, type, addr) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "set end of space allocation request failed") @@ -330,7 +330,7 @@ H5FD__free_real(H5FD_t *file, H5FD_mem_t type, haddr_t addr, hsize_t size) else { /* leak memory */ #ifdef H5FD_ALLOC_DEBUG - HDfprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)type, + HDfprintf(stderr, "%s: LEAKED MEMORY!!! type = %u, addr = %a, size = %Hu\n", __func__, (unsigned)type, addr, size); #endif /* H5FD_ALLOC_DEBUG */ } /* end else */ diff --git a/src/H5FDsplitter.c b/src/H5FDsplitter.c index 99d7100..91a8e84 100644 --- a/src/H5FDsplitter.c +++ b/src/H5FDsplitter.c @@ -188,7 +188,7 @@ H5FD__init_package(void) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); if (H5FD_splitter_init() < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, FAIL, "unable to initialize splitter VFD") @@ -214,7 +214,7 @@ H5FD_splitter_init(void) FUNC_ENTER_NOAPI(H5I_INVALID_HID) - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); if (H5I_VFL != H5I_get_type(H5FD_SPLITTER_g)) H5FD_SPLITTER_g = H5FDregister(&H5FD_splitter_g); @@ -238,7 +238,7 @@ H5FD__splitter_term(void) { FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Reset VFL ID */ H5FD_SPLITTER_g = 0; @@ -263,7 +263,7 @@ H5FD__copy_plist(hid_t fapl_id, hid_t *id_out_ptr) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); HDassert(id_out_ptr != NULL); @@ -301,7 +301,7 @@ H5Pset_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *vfd_config) FUNC_ENTER_API(FAIL) H5TRACE2("e", "i*#", fapl_id, vfd_config); - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); if (H5FD_SPLITTER_MAGIC != vfd_config->magic) HGOTO_ERROR(H5E_ARGS, H5E_BADVALUE, FAIL, "invalid configuration (magic number mismatch)") @@ -389,7 +389,7 @@ H5Pget_fapl_splitter(hid_t fapl_id, H5FD_splitter_vfd_config_t *config /*out*/) FUNC_ENTER_API(FAIL) H5TRACE2("e", "ix", fapl_id, config); - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ if (TRUE != H5P_isa_class(fapl_id, H5P_FILE_ACCESS)) @@ -443,13 +443,13 @@ H5FD__splitter_flush(H5FD_t *_file, hid_t H5_ATTR_UNUSED dxpl_id, hbool_t closin FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Public API for dxpl "context" */ if (H5FDflush(file->rw_file, dxpl_id, closing) < 0) HGOTO_ERROR(H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush R/W file") if (H5FDflush(file->wo_file, dxpl_id, closing) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTFLUSH, FAIL, "unable to flush W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -478,7 +478,7 @@ H5FD__splitter_read(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, hid_t H5_ATTR FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); HDassert(file && file->pub.cls); HDassert(buf); @@ -518,7 +518,7 @@ H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); if (NULL == (plist_ptr = (H5P_genplist_t *)H5I_object(dxpl_id))) HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list") @@ -528,7 +528,7 @@ H5FD__splitter_write(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr if (H5FDwrite(file->rw_file, type, dxpl_id, addr, size, buf) < 0) HGOTO_ERROR(H5E_VFL, H5E_WRITEERROR, FAIL, "R/W file write failed") if (H5FDwrite(file->wo_file, type, dxpl_id, addr, size, buf) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_WRITEERROR, FAIL, "unable to write W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -554,7 +554,7 @@ H5FD__splitter_fapl_get(H5FD_t *_file) FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); ret_value = H5FD__splitter_fapl_copy(&(file->fa)); @@ -579,7 +579,7 @@ H5FD__splitter_fapl_copy(const void *_old_fa) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); HDassert(old_fa_ptr); @@ -623,7 +623,7 @@ H5FD__splitter_fapl_free(void *_fapl) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(fapl); @@ -661,7 +661,7 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ if (!name || !*name) @@ -717,7 +717,7 @@ H5FD__splitter_open(const char *name, unsigned flags, hid_t splitter_fapl_id, ha file_ptr->wo_file = H5FD_open(fapl_ptr->wo_path, flags, fapl_ptr->wo_fapl_id, HADDR_UNDEF); if (!file_ptr->wo_file) - H5FD_SPLITTER_WO_ERROR(file_ptr, FUNC, H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open W/O file") + H5FD_SPLITTER_WO_ERROR(file_ptr, __func__, H5E_VFL, H5E_CANTOPENFILE, NULL, "unable to open W/O file") ret_value = (H5FD_t *)file_ptr; @@ -758,7 +758,7 @@ H5FD__splitter_close(H5FD_t *_file) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ HDassert(file); @@ -773,7 +773,8 @@ H5FD__splitter_close(H5FD_t *_file) HGOTO_ERROR(H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close R/W file") if (file->wo_file) if (H5FD_close(file->wo_file) == FAIL) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTCLOSEFILE, FAIL, "unable to close W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTCLOSEFILE, FAIL, + "unable to close W/O file") if (file->logfp) { HDfclose(file->logfp); @@ -808,7 +809,7 @@ H5FD__splitter_get_eoa(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ HDassert(file); @@ -839,7 +840,7 @@ H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t ad FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC) + H5FD_SPLITTER_LOG_CALL(__func__) /* Sanity check */ HDassert(file); @@ -850,7 +851,7 @@ H5FD__splitter_set_eoa(H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type, haddr_t ad HGOTO_ERROR(H5E_VFL, H5E_CANTSET, FAIL, "H5FDset_eoa failed for R/W file") if (H5FD_set_eoa(file->wo_file, type, addr) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTSET, FAIL, "unable to set EOA for W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTSET, FAIL, "unable to set EOA for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -876,7 +877,7 @@ H5FD__splitter_get_eof(const H5FD_t *_file, H5FD_mem_t H5_ATTR_UNUSED type) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ HDassert(file); @@ -905,7 +906,7 @@ H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); HDassert(file); HDassert(file->rw_file); @@ -915,7 +916,7 @@ H5FD__splitter_truncate(H5FD_t *_file, hid_t dxpl_id, hbool_t closing) HGOTO_ERROR(H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate R/W file") if (H5FDtruncate(file->wo_file, dxpl_id, closing) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTUPDATE, FAIL, "unable to truncate W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -943,7 +944,7 @@ H5FD__splitter_sb_size(H5FD_t *_file) FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ HDassert(file); @@ -971,7 +972,7 @@ H5FD__splitter_sb_encode(H5FD_t *_file, char *name /*out*/, unsigned char *buf / FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ HDassert(file); @@ -1002,7 +1003,7 @@ H5FD__splitter_sb_decode(H5FD_t *_file, const char *name, const unsigned char *b FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Sanity check */ HDassert(file); @@ -1033,7 +1034,7 @@ H5FD__splitter_cmp(const H5FD_t *_f1, const H5FD_t *_f2) FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); HDassert(f1); HDassert(f2); @@ -1060,7 +1061,7 @@ H5FD__splitter_get_handle(H5FD_t *_file, hid_t H5_ATTR_UNUSED fapl, void **file_ FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(file); @@ -1091,7 +1092,7 @@ H5FD__splitter_lock(H5FD_t *_file, hbool_t rw) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); HDassert(file); HDassert(file->rw_file); @@ -1102,7 +1103,7 @@ H5FD__splitter_lock(H5FD_t *_file, hbool_t rw) if (file->wo_file != NULL) if (H5FD_lock(file->wo_file, rw) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTLOCKFILE, FAIL, "unable to lock W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1124,7 +1125,7 @@ H5FD__splitter_unlock(H5FD_t *_file) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(file); @@ -1159,7 +1160,7 @@ H5FD__splitter_query(const H5FD_t *_file, unsigned long *flags /* out */) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); if (file) { HDassert(file); @@ -1196,7 +1197,7 @@ H5FD__splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(file); @@ -1207,7 +1208,8 @@ H5FD__splitter_alloc(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, hsize_t size HGOTO_ERROR(H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to allocate for R/W file") if (H5FDalloc(file->wo_file, type, dxpl_id, size) == HADDR_UNDEF) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, "unable to alloc for W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTINIT, HADDR_UNDEF, + "unable to alloc for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1229,7 +1231,7 @@ H5FD__splitter_get_type_map(const H5FD_t *_file, H5FD_mem_t *type_map) FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(file); @@ -1259,7 +1261,7 @@ H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, FUNC_ENTER_STATIC - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(file); @@ -1269,7 +1271,7 @@ H5FD__splitter_free(H5FD_t *_file, H5FD_mem_t type, hid_t dxpl_id, haddr_t addr, HGOTO_ERROR(H5E_VFL, H5E_CANTFREE, FAIL, "unable to free for R/W file") if (H5FDfree(file->wo_file, type, dxpl_id, addr, size) < 0) - H5FD_SPLITTER_WO_ERROR(file, FUNC, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file") + H5FD_SPLITTER_WO_ERROR(file, __func__, H5E_VFL, H5E_CANTINIT, FAIL, "unable to free for W/O file") done: FUNC_LEAVE_NOAPI(ret_value) @@ -1290,7 +1292,7 @@ H5FD__splitter_log_error(const H5FD_splitter_t *file, const char *atfunc, const FUNC_ENTER_STATIC_NOERR - H5FD_SPLITTER_LOG_CALL(FUNC); + H5FD_SPLITTER_LOG_CALL(__func__); /* Check arguments */ HDassert(file); @@ -207,7 +207,7 @@ H5FL_term_package(void) /* Dump information about all the outstanding allocations */ while (trk != NULL) { /* Print information about the outstanding block */ - HDfprintf(stderr, "%s: Outstanding allocation:\n", FUNC); + HDfprintf(stderr, "%s: Outstanding allocation:\n", __func__); HDfprintf(stderr, "\tPtr: %p, File: %s, Function: %s, Line: %d\n", (((unsigned char *)trk) + sizeof(H5FL_track_t)), trk->file, trk->func, trk->line); H5CS_print_stack(trk->stack, stderr); @@ -625,7 +625,7 @@ H5FL__reg_term(void) tmp = H5FL_reg_gc_head.first->next; #ifdef H5FL_DEBUG - HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_reg_gc_head.first->list->name, + HDprintf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_reg_gc_head.first->list->name, (int)H5FL_reg_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ /* Check if the list has allocations outstanding */ @@ -1303,7 +1303,7 @@ H5FL__blk_term(void) tmp = H5FL_blk_gc_head.first->next; #ifdef H5FL_DEBUG - HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_blk_gc_head.first->pq->name, + HDprintf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_blk_gc_head.first->pq->name, (int)H5FL_blk_gc_head.first->pq->allocated); #endif /* H5FL_DEBUG */ @@ -1763,7 +1763,7 @@ H5FL__arr_term(void) /* Check if the list has allocations outstanding */ #ifdef H5FL_DEBUG - HDprintf("%s: head->name = %s, head->allocated = %d\n", FUNC, H5FL_arr_gc_head.first->list->name, + HDprintf("%s: head->name = %s, head->allocated = %d\n", __func__, H5FL_arr_gc_head.first->list->name, (int)H5FL_arr_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ if (H5FL_arr_gc_head.first->list->allocated > 0) { @@ -2348,8 +2348,8 @@ H5FL__fac_term_all(void) tmp = H5FL_fac_gc_head.first->next; #ifdef H5FL_DEBUG - HDprintf("%s: head->size = %d, head->allocated = %d\n", FUNC, (int)H5FL_fac_gc_head.first->list->size, - (int)H5FL_fac_gc_head.first->list->allocated); + HDprintf("%s: head->size = %d, head->allocated = %d\n", __func__, + (int)H5FL_fac_gc_head.first->list->size, (int)H5FL_fac_gc_head.first->list->allocated); #endif /* H5FL_DEBUG */ /* The list cannot have any allocations outstanding */ diff --git a/src/H5FLprivate.h b/src/H5FLprivate.h index 42581ac..381f977 100644 --- a/src/H5FLprivate.h +++ b/src/H5FLprivate.h @@ -51,7 +51,7 @@ /* #define H5FL_TRACK */ #ifdef H5FL_TRACK /* Macro for inclusion in the free list allocation calls */ -#define H5FL_TRACK_INFO , __FILE__, FUNC, __LINE__ +#define H5FL_TRACK_INFO , __FILE__, __func__, __LINE__ /* Macro for inclusion in internal free list allocation calls */ #define H5FL_TRACK_INFO_INT , call_file, call_func, call_line @@ -100,7 +100,7 @@ H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_create, uint16_t FUNC_ENTER_NOAPI(NULL) #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", FUNC, nclasses); + HDfprintf(stderr, "%s: Creating free space manager, nclasses = %Zu\n", __func__, nclasses); #endif /* H5FS_DEBUG */ /* Check arguments. */ @@ -146,7 +146,7 @@ H5FS_create(H5F_t *f, haddr_t *fs_addr, const H5FS_create_t *fs_create, uint16_t /* Set the return value */ ret_value = fspace; #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: fspace = %p, fspace->addr = %a\n", FUNC, fspace, fspace->addr); + HDfprintf(stderr, "%s: fspace = %p, fspace->addr = %a\n", __func__, fspace, fspace->addr); #endif /* H5FS_DEBUG */ done: @@ -155,7 +155,7 @@ done: HDONE_ERROR(H5E_FSPACE, H5E_CANTFREE, NULL, "unable to destroy free space header") #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5FS_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_create() */ @@ -183,7 +183,7 @@ H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class FUNC_ENTER_NOAPI(NULL) #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Opening free space manager, fs_addr = %a, nclasses = %Zu\n", FUNC, fs_addr, + HDfprintf(stderr, "%s: Opening free space manager, fs_addr = %a, nclasses = %Zu\n", __func__, fs_addr, nclasses); #endif /* H5FS_DEBUG */ @@ -204,11 +204,11 @@ H5FS_open(H5F_t *f, haddr_t fs_addr, uint16_t nclasses, const H5FS_section_class (fspace = (H5FS_t *)H5AC_protect(f, H5AC_FSPACE_HDR, fs_addr, &cache_udata, H5AC__READ_ONLY_FLAG))) HGOTO_ERROR(H5E_FSPACE, H5E_CANTPROTECT, NULL, "unable to load free space header") #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr); - HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", FUNC, fspace->sect_size); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", FUNC, fspace->alloc_sect_size); - HDfprintf(stderr, "%s: fspace->sinfo = %p\n", FUNC, fspace->sinfo); - HDfprintf(stderr, "%s: fspace->rc = %u\n", FUNC, fspace->rc); + HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", __func__, fspace->sect_addr); + HDfprintf(stderr, "%s: fspace->sect_size = %Hu\n", __func__, fspace->sect_size); + HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu\n", __func__, fspace->alloc_sect_size); + HDfprintf(stderr, "%s: fspace->sinfo = %p\n", __func__, fspace->sinfo); + HDfprintf(stderr, "%s: fspace->rc = %u\n", __func__, fspace->rc); #endif /* H5FS_DEBUG */ /* Increment the reference count on the free space manager header */ @@ -251,7 +251,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) FUNC_ENTER_NOAPI(FAIL) #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = %a\n", FUNC, fs_addr); + HDfprintf(stderr, "%s: Deleting free space manager, fs_addr = %a\n", __func__, fs_addr); #endif /* H5FS_DEBUG */ /* Check arguments. */ @@ -278,7 +278,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "unable to check metadata cache status for free space section info") - HDfprintf(stderr, "%s: fspace_status = %0x: ", FUNC, fspace_status); + HDfprintf(stderr, "%s: fspace_status = %0x: ", __func__, fspace_status); if (fspace_status) { hbool_t printed = FALSE; @@ -321,7 +321,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) /* Delete serialized section storage, if there are any */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", FUNC, fspace->sect_addr); + HDfprintf(stderr, "%s: fspace->sect_addr = %a\n", __func__, fspace->sect_addr); #endif /* H5FS_DEBUG */ if (fspace->serial_sect_count > 0) { unsigned sinfo_status = 0; /* Free space section info's status in the metadata cache */ @@ -342,7 +342,7 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) HDassert(!(sinfo_status & H5AC_ES__IS_PROTECTED)); #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Expunging free space section info from cache\n", FUNC); + HDfprintf(stderr, "%s: Expunging free space section info from cache\n", __func__); #endif /* H5FS_DEBUG */ /* Evict the free space section info from the metadata cache */ /* (Free file space) */ @@ -361,12 +361,12 @@ H5FS_delete(H5F_t *f, haddr_t fs_addr) } /* end block */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", FUNC); + HDfprintf(stderr, "%s: Done expunging free space section info from cache\n", __func__); #endif /* H5FS_DEBUG */ } /* end if */ else { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Deleting free space section info from file\n", FUNC); + HDfprintf(stderr, "%s: Deleting free space section info from file\n", __func__); #endif /* H5FS_DEBUG */ /* Release the space in the file */ if (!H5F_IS_TMP_ADDR(f, fspace->sect_addr)) @@ -407,7 +407,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) HDassert(f); HDassert(fspace); #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Entering, fspace = %p, fspace->addr = %a, fspace->sinfo = %p\n", FUNC, fspace, + HDfprintf(stderr, "%s: Entering, fspace = %p, fspace->addr = %a, fspace->sinfo = %p\n", __func__, fspace, fspace->addr, fspace->sinfo); #endif /* H5FS_DEBUG */ @@ -418,15 +418,15 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu, fspace->serial_sect_count = %Hu, fspace->sect_addr = " "%a, fspace->rc = %u\n", - FUNC, fspace->tot_sect_count, fspace->serial_sect_count, fspace->sect_addr, fspace->rc); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, + __func__, fspace->tot_sect_count, fspace->serial_sect_count, fspace->sect_addr, fspace->rc); + HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", __func__, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_DEBUG */ /* If there are sections to serialize, update them */ /* (if the free space manager is persistent) */ if (fspace->serial_sect_count > 0 && H5F_addr_defined(fspace->addr)) { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Real sections to store in file\n", FUNC); + HDfprintf(stderr, "%s: Real sections to store in file\n", __func__); #endif /* H5FS_DEBUG */ if (fspace->sinfo->dirty) { /* Check if the section info is "floating" */ @@ -465,7 +465,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) } /* end if */ else { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: NOT storing section info in file\n", FUNC); + HDfprintf(stderr, "%s: NOT storing section info in file\n", __func__); #endif /* H5FS_DEBUG */ /* Check if space for the section info is allocated */ if (H5F_addr_defined(fspace->sect_addr)) { @@ -474,7 +474,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) HDassert(H5F_addr_defined(fspace->addr)); #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info allocated though\n", FUNC); + HDfprintf(stderr, "%s: Section info allocated though\n", __func__); #endif /* H5FS_DEBUG */ /* Check if the section info is for the free space in the file */ /* (NOTE: This is the "bootstrapping" special case for the @@ -486,12 +486,13 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) htri_t status; /* "can absorb" status for section into */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info is for file free space\n", FUNC); + HDfprintf(stderr, "%s: Section info is for file free space\n", __func__); #endif /* H5FS_DEBUG */ /* Try to shrink the file or absorb the section info into a block aggregator */ if (H5F_IS_TMP_ADDR(f, fspace->sect_addr)) { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info in temp. address space went 'go away'\n", FUNC); + HDfprintf(stderr, "%s: Section info in temp. address space went 'go away'\n", + __func__); #endif /* H5FS_DEBUG */ /* Reset section info in header */ fspace->sect_addr = HADDR_UNDEF; @@ -512,12 +513,13 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) * header to record it */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info can't 'go away', header will own it\n", FUNC); + HDfprintf(stderr, "%s: Section info can't 'go away', header will own it\n", + __func__); #endif /* H5FS_DEBUG */ } /* end if */ else { #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info went 'go away'\n", FUNC); + HDfprintf(stderr, "%s: Section info went 'go away'\n", __func__); #endif /* H5FS_DEBUG */ /* Reset section info in header */ fspace->sect_addr = HADDR_UNDEF; @@ -536,7 +538,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) fspace->alloc_sect_size; /* Previous size of section info in file */ #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Section info is NOT for file free space\n", FUNC); + HDfprintf(stderr, "%s: Section info is NOT for file free space\n", __func__); #endif /* H5FS_DEBUG */ /* Reset section info in header */ fspace->sect_addr = HADDR_UNDEF; @@ -576,7 +578,7 @@ H5FS_close(H5F_t *f, H5FS_t *fspace) done: #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", FUNC, ret_value, fspace->rc); + HDfprintf(stderr, "%s: Leaving, ret_value = %d, fspace->rc = %u\n", __func__, ret_value, fspace->rc); #endif /* H5FS_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_close() */ @@ -709,7 +711,8 @@ H5FS__incr(H5FS_t *fspace) FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc); + HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", __func__, fspace->addr, + fspace->rc); #endif /* H5FS_DEBUG */ /* @@ -748,7 +751,8 @@ H5FS__decr(H5FS_t *fspace) FUNC_ENTER_PACKAGE #ifdef H5FS_DEBUG - HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", FUNC, fspace->addr, fspace->rc); + HDfprintf(stderr, "%s: Entering, fpace->addr = %a, fspace->rc = %u\n", __func__, fspace->addr, + fspace->rc); #endif /* H5FS_DEBUG */ /* diff --git a/src/H5FSsection.c b/src/H5FSsection.c index 14870b4..d28358c 100644 --- a/src/H5FSsection.c +++ b/src/H5FSsection.c @@ -123,7 +123,7 @@ H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace) HDassert(f); HDassert(fspace); #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: fspace->addr = %a\n", FUNC, fspace->addr); + HDfprintf(stderr, "%s: fspace->addr = %a\n", __func__, fspace->addr); #endif /* H5FS_SINFO_DEBUG */ /* Allocate the free space header */ @@ -136,10 +136,10 @@ H5FS__sinfo_new(H5F_t *f, H5FS_t *fspace) sinfo->sect_off_size = (fspace->max_sect_addr + 7) / 8; sinfo->sect_len_size = H5VM_limit_enc_size((uint64_t)fspace->max_sect_size); #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: fspace->max_sect_size = %Hu\n", FUNC, fspace->max_sect_size); - HDfprintf(stderr, "%s: fspace->max_sect_addr = %u\n", FUNC, fspace->max_sect_addr); - HDfprintf(stderr, "%s: sinfo->nbins = %u\n", FUNC, sinfo->nbins); - HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", FUNC, + HDfprintf(stderr, "%s: fspace->max_sect_size = %Hu\n", __func__, fspace->max_sect_size); + HDfprintf(stderr, "%s: fspace->max_sect_addr = %u\n", __func__, fspace->max_sect_addr); + HDfprintf(stderr, "%s: sinfo->nbins = %u\n", __func__, sinfo->nbins); + HDfprintf(stderr, "%s: sinfo->sect_off_size = %u, sinfo->sect_len_size = %u\n", __func__, sinfo->sect_off_size, sinfo->sect_len_size); #endif /* H5FS_SINFO_DEBUG */ @@ -200,9 +200,9 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) FUNC_ENTER_STATIC #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC, + HDfprintf(stderr, "%s: Called, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", __func__, fspace->addr, fspace->sinfo, fspace->sect_addr); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, + HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", __func__, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ @@ -251,7 +251,7 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) HDassert(H5F_addr_defined(fspace->addr)); #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n", FUNC, + HDfprintf(stderr, "%s: Reading in existing sections, fspace->sect_addr = %a\n", __func__, fspace->sect_addr); #endif /* H5FS_SINFO_DEBUG */ /* Protect the free space sections */ @@ -267,7 +267,7 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) } /* end if */ else { #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Creating new section info\n", FUNC); + HDfprintf(stderr, "%s: Creating new section info\n", __func__); #endif /* H5FS_SINFO_DEBUG */ /* Sanity check */ HDassert(fspace->tot_sect_count == 0); @@ -289,9 +289,9 @@ H5FS__sinfo_lock(H5F_t *f, H5FS_t *fspace, unsigned accmode) done: #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", FUNC, - fspace->addr, fspace->sinfo, fspace->sect_addr); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, + HDfprintf(stderr, "%s: Leaving, fspace->addr = %a, fspace->sinfo = %p, fspace->sect_addr = %a\n", + __func__, fspace->addr, fspace->sinfo, fspace->sect_addr); + HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", __func__, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) @@ -331,13 +331,13 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) FUNC_ENTER_STATIC #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Called, modified = %t, fspace->addr = %a, fspace->sect_addr = %a\n", FUNC, + HDfprintf(stderr, "%s: Called, modified = %t, fspace->addr = %a, fspace->sect_addr = %a\n", __func__, modified, fspace->addr, fspace->sect_addr); HDfprintf( stderr, "%s: fspace->sinfo_lock_count = %u, fspace->sinfo_modified = %t, fspace->sinfo_protected = %t\n", - FUNC, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected); - HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", FUNC, + __func__, fspace->sinfo_lock_count, fspace->sinfo_modified, fspace->sinfo_protected); + HDfprintf(stderr, "%s: fspace->alloc_sect_size = %Hu, fspace->sect_size = %Hu\n", __func__, fspace->alloc_sect_size, fspace->sect_size); #endif /* H5FS_SINFO_DEBUG */ @@ -413,7 +413,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) /* (Possibly dirty) */ /* (Possibly taking ownership from the cache) */ #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Unprotecting section info, cache_flags = %u\n", FUNC, cache_flags); + HDfprintf(stderr, "%s: Unprotecting section info, cache_flags = %u\n", __func__, cache_flags); #endif /* H5FS_SINFO_DEBUG */ if (H5AC_unprotect(f, H5AC_FSPACE_SINFO, fspace->sect_addr, fspace->sinfo, cache_flags) < 0) HGOTO_ERROR(H5E_FSPACE, H5E_CANTUNPROTECT, FAIL, "unable to release free space section info") @@ -424,14 +424,14 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) /* Check if header is taking ownership of section info */ if ((cache_flags & H5AC__TAKE_OWNERSHIP_FLAG)) { #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Taking ownership of section info\n", FUNC); + HDfprintf(stderr, "%s: Taking ownership of section info\n", __func__); #endif /* H5FS_SINFO_DEBUG */ /* Set flag to release section info space in file */ release_sinfo_space = TRUE; } /* end if */ else { #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Relinquishing section info ownership\n", FUNC); + HDfprintf(stderr, "%s: Relinquishing section info ownership\n", __func__); #endif /* H5FS_SINFO_DEBUG */ /* Free space header relinquished ownership of section info */ fspace->sinfo = NULL; @@ -491,7 +491,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) #ifdef H5FS_SINFO_DEBUG HDfprintf(stderr, "%s: Freeing section info on disk, old_sect_addr = %a, old_alloc_sect_size = %Hu\n", - FUNC, old_sect_addr, old_alloc_sect_size); + __func__, old_sect_addr, old_alloc_sect_size); #endif /* H5FS_SINFO_DEBUG */ /* Release space for section info in file */ if (!H5F_IS_TMP_ADDR(f, old_sect_addr)) @@ -502,7 +502,7 @@ H5FS__sinfo_unlock(H5F_t *f, H5FS_t *fspace, hbool_t modified) done: #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS__sinfo_unlock() */ @@ -1343,7 +1343,7 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag FUNC_ENTER_NOAPI(FAIL) #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: *sect = {%a, %Hu, %u, %s}\n", FUNC, sect->addr, sect->size, sect->type, + HDfprintf(stderr, "%s: *sect = {%a, %Hu, %u, %s}\n", __func__, sect->addr, sect->size, sect->type, (sect->state == H5FS_SECT_LIVE ? "H5FS_SECT_LIVE" : "H5FS_SECT_SERIALIZED")); #endif /* H5FS_SINFO_DEBUG */ @@ -1367,7 +1367,7 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag /* Check for merging returned space with existing section node */ if (flags & H5FS_ADD_RETURNED_SPACE) { #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Returning space\n", FUNC); + HDfprintf(stderr, "%s: Returning space\n", __func__); #endif /* H5FS_SINFO_DEBUG */ /* Attempt to merge returned section with existing sections */ @@ -1384,7 +1384,7 @@ H5FS_sect_add(H5F_t *f, H5FS_t *fspace, H5FS_section_info_t *sect, unsigned flag HGOTO_ERROR(H5E_FSPACE, H5E_CANTINSERT, FAIL, "can't insert free space section into skip list") #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", FUNC, fspace->tot_space); + HDfprintf(stderr, "%s: fspace->tot_space = %Hu\n", __func__, fspace->tot_space); #endif /* H5FS_SINFO_DEBUG */ /* Mark free space sections as changed */ /* (if adding sections while deserializing sections, don't set the flag) */ @@ -1401,7 +1401,7 @@ done: H5FS__assert(fspace); #endif /* H5FS_DEBUG_ASSERT */ #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5FS_SINFO_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* H5FS_sect_add() */ @@ -1429,7 +1429,7 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize FUNC_ENTER_NOAPI(FAIL) #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: addr = %a, size = %Hu, extra_requested = %hu\n", FUNC, addr, size, + HDfprintf(stderr, "%s: addr = %a, size = %Hu, extra_requested = %hu\n", __func__, addr, size, extra_requested); #endif /* H5FS_SINFO_DEBUG */ @@ -1442,9 +1442,9 @@ H5FS_sect_try_extend(H5F_t *f, H5FS_t *fspace, haddr_t addr, hsize_t size, hsize /* Check for any sections on free space list */ #ifdef H5FS_SINFO_DEBUG - HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", FUNC, fspace->tot_sect_count); - HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", FUNC, fspace->serial_sect_count); - HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", FUNC, fspace->ghost_sect_count); + HDfprintf(stderr, "%s: fspace->tot_sect_count = %Hu\n", __func__, fspace->tot_sect_count); + HDfprintf(stderr, "%s: fspace->serial_sect_count = %Hu\n", __func__, fspace->serial_sect_count); + HDfprintf(stderr, "%s: fspace->ghost_sect_count = %Hu\n", __func__, fspace->ghost_sect_count); #endif /* H5FS_SINFO_DEBUG */ if (fspace->tot_sect_count > 0) { H5FS_section_info_t *sect; /* Temporary free space section */ @@ -271,7 +271,7 @@ H5Gcreate_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(FUNC, "*s*sIui*siiii", app_file, app_func, app_line, loc_id, name, lcpl_id, gcpl_id, gapl_id, es_id)) < 0) { + H5ARG_TRACE9(__func__, "*s*sIui*siiii", app_file, app_func, app_line, loc_id, name, lcpl_id, gcpl_id, gapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on group ID") @@ -475,7 +475,7 @@ H5Gopen_async(const char *app_file, const char *app_func, unsigned app_line, hid if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, gapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, gapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_SYM, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on group ID") @@ -622,7 +622,7 @@ H5Gget_info_async(const char *app_file, const char *app_func, unsigned app_line, if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE6(FUNC, "*s*sIuixi", app_file, app_func, app_line, loc_id, group_info, es_id)) < 0) + H5ARG_TRACE6(__func__, "*s*sIuixi", app_file, app_func, app_line, loc_id, group_info, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -728,7 +728,7 @@ H5Gget_info_by_name_async(const char *app_file, const char *app_func, unsigned a if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE8(FUNC, "*s*sIui*sxii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id)) < 0) + H5ARG_TRACE8(__func__, "*s*sIui*sxii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -841,7 +841,7 @@ H5Gget_info_by_idx_async(const char *app_file, const char *app_func, unsigned ap if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE11(FUNC, "*s*sIui*sIiIohxii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, group_info, lapl_id, es_id)) < 0) + H5ARG_TRACE11(__func__, "*s*sIui*sIiIohxii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, group_info, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -931,7 +931,7 @@ H5Gclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, group_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, group_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set") diff --git a/src/H5Gint.c b/src/H5Gint.c index dab7a54..90a2c6b 100644 --- a/src/H5Gint.c +++ b/src/H5Gint.c @@ -38,6 +38,7 @@ #include "H5Iprivate.h" /* IDs */ #include "H5Lprivate.h" /* Links */ #include "H5MMprivate.h" /* Memory management */ +#include "H5SLprivate.h" /* Skip lists */ /****************/ /* Local Macros */ diff --git a/src/H5Gpkg.h b/src/H5Gpkg.h index 86b6e1b..a5efd48 100644 --- a/src/H5Gpkg.h +++ b/src/H5Gpkg.h @@ -35,7 +35,6 @@ #include "H5HFprivate.h" /* Fractal heaps */ #include "H5HLprivate.h" /* Local Heaps */ #include "H5Oprivate.h" /* Object headers */ -#include "H5SLprivate.h" /* Skip lists */ /**************************/ /* Package Private Macros */ @@ -429,7 +429,7 @@ H5HF_get_obj_len(H5HF_t *fh, const void *_id, size_t *obj_len_p) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't get 'tiny' object's length") } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ @@ -489,7 +489,7 @@ H5HF_get_obj_off(H5HF_t *fh, const void *_id, hsize_t *obj_off_p) *obj_off_p = (hsize_t)0; } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ @@ -552,7 +552,7 @@ H5HF_read(H5HF_t *fh, const void *_id, void *obj /*out*/) HGOTO_ERROR(H5E_HEAP, H5E_CANTGET, FAIL, "can't read 'tiny' object from fractal heap") } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ @@ -628,7 +628,7 @@ H5HF_write(H5HF_t *fh, void *_id, hbool_t H5_ATTR_UNUSED *id_changed, const void HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "modifying 'tiny' object not supported yet") } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ @@ -696,7 +696,7 @@ H5HF_op(H5HF_t *fh, const void *_id, H5HF_operator_t op, void *op_data) HGOTO_ERROR(H5E_HEAP, H5E_CANTOPERATE, FAIL, "can't operate on 'tiny' object from fractal heap") } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ @@ -759,7 +759,7 @@ H5HF_remove(H5HF_t *fh, const void *_id) HGOTO_ERROR(H5E_HEAP, H5E_CANTREMOVE, FAIL, "can't remove 'tiny' object from fractal heap") } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ diff --git a/src/H5HFdbg.c b/src/H5HFdbg.c index a244035..8dbb3f4 100644 --- a/src/H5HFdbg.c +++ b/src/H5HFdbg.c @@ -140,7 +140,7 @@ H5HF_id_print(H5HF_t *fh, const void *_id, FILE *stream, int indent, int fwidth) id_type = 'T'; } /* end if */ else { - HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", FUNC); + HDfprintf(stderr, "%s: Heap ID type not supported yet!\n", __func__); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "heap ID type not supported yet") } /* end else */ diff --git a/src/H5HFdblock.c b/src/H5HFdblock.c index 628dcc4..4adb47a 100644 --- a/src/H5HFdblock.c +++ b/src/H5HFdblock.c @@ -397,7 +397,7 @@ H5HF__man_dblock_new(H5HF_hdr_t *hdr, size_t request, H5HF_free_section_t **ret_ HDfprintf( stderr, "%s: Skipping direct block sizes not supported, min_dblock_size = %zu, next_size = %zu\n", - FUNC, min_dblock_size, next_size); + __func__, min_dblock_size, next_size); HGOTO_ERROR(H5E_HEAP, H5E_UNSUPPORTED, FAIL, "skipping direct block sizes not supported yet") } /* end if */ diff --git a/src/H5HFpkg.h b/src/H5HFpkg.h index 893a65d..8d189e8 100644 --- a/src/H5HFpkg.h +++ b/src/H5HFpkg.h @@ -34,7 +34,6 @@ #include "H5B2private.h" /* v2 B-trees */ #include "H5FLprivate.h" /* Free Lists */ #include "H5FSprivate.h" /* Free space manager */ -#include "H5SLprivate.h" /* Skip lists */ /**************************/ /* Package Private Macros */ @@ -383,7 +383,7 @@ H5Lcreate_soft_async(const char *app_file, const char *app_func, unsigned app_li if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(FUNC, "*s*sIu*si*siii", app_file, app_func, app_line, link_target, link_loc_id, link_name, lcpl_id, lapl_id, es_id)) < 0) + H5ARG_TRACE9(__func__, "*s*sIu*si*siii", app_file, app_func, app_line, link_target, link_loc_id, link_name, lcpl_id, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -558,7 +558,7 @@ H5Lcreate_hard_async(const char *app_file, const char *app_func, unsigned app_li if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj_ptr->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIui*si*siii", app_file, app_func, app_line, cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIui*si*siii", app_file, app_func, app_line, cur_loc_id, cur_name, new_loc_id, new_name, lcpl_id, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -838,7 +838,7 @@ H5Ldelete_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0) + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -963,7 +963,7 @@ H5Ldelete_by_idx_async(const char *app_file, const char *app_func, unsigned app_ if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1192,7 +1192,7 @@ H5Lexists_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) if (H5ES_insert(es_id, vol_obj->connector, token, /* clang-format off */ - H5ARG_TRACE8(FUNC, "*s*sIui*s*bii", app_file, app_func, app_line, loc_id, name, exists, lapl_id, es_id)) < 0) + H5ARG_TRACE8(__func__, "*s*sIui*s*bii", app_file, app_func, app_line, loc_id, name, exists, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1629,7 +1629,7 @@ H5Literate_async(const char *app_file, const char *app_func, unsigned app_line, if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIuiIiIo*hLI*xi", app_file, app_func, app_line, group_id, idx_type, order, idx_p, op, op_data, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIuiIiIo*hLI*xi", app_file, app_func, app_line, group_id, idx_type, order, idx_p, op, op_data, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_LINK, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -369,7 +369,7 @@ H5Mcreate_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE11(FUNC, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, key_type_id, val_type_id, lcpl_id, mcpl_id, mapl_id, es_id)) < 0) { + H5ARG_TRACE11(__func__, "*s*sIui*siiiiii", app_file, app_func, app_line, loc_id, name, key_type_id, val_type_id, lcpl_id, mcpl_id, mapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_MAP, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on map ID") @@ -576,7 +576,7 @@ H5Mopen_async(const char *app_file, const char *app_func, unsigned app_line, hid if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, mapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, mapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_MAP, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on map ID") @@ -670,7 +670,7 @@ H5Mclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, map_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, map_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -984,7 +984,7 @@ H5Mput_async(const char *app_file, const char *app_func, unsigned app_line, hid_ if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1113,7 +1113,7 @@ H5Mget_async(const char *app_file, const char *app_func, unsigned app_line, hid_ if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIuii*xi*xii", app_file, app_func, app_line, map_id, key_mem_type_id, key, val_mem_type_id, value, dxpl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_MAP, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -602,7 +602,7 @@ H5MF__delete_fstype(H5F_t *f, H5F_mem_page_t type) H5AC_set_ring(fsm_ring, &orig_ring); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Before deleting free space manager\n", FUNC); + HDfprintf(stderr, "%s: Before deleting free space manager\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Delete free space manager for this type */ @@ -657,7 +657,7 @@ H5MF__close_fstype(H5F_t *f, H5F_mem_page_t type) HDassert(f->shared->fs_state[type] != H5F_FS_STATE_CLOSED); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Before closing free space manager\n", FUNC); + HDfprintf(stderr, "%s: Before closing free space manager\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Close an existing free space structure for the file */ @@ -713,7 +713,7 @@ H5MF__add_sect(H5F_t *f, H5FD_mem_t alloc_type, H5FS_t *fspace, H5MF_free_sectio H5AC_set_ring(fsm_ring, &orig_ring); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: adding node, node->sect_info.addr = %a, node->sect_info.size = %Hu\n", FUNC, + HDfprintf(stderr, "%s: adding node, node->sect_info.addr = %a, node->sect_info.size = %Hu\n", __func__, node->sect_info.addr, node->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Add the section */ @@ -766,7 +766,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h HGOTO_ERROR(H5E_RESOURCE, H5E_CANTALLOC, FAIL, "error locating free space in file") #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section found = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: section found = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Check for actually finding section */ @@ -781,7 +781,7 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h /* Check for eliminating the section */ if (node->sect_info.size == size) { #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: freeing node\n", FUNC); + HDfprintf(stderr, "%s: freeing node\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Free section node */ @@ -794,7 +794,8 @@ H5MF__find_sect(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size, H5FS_t *fspace, h node->sect_info.size -= size; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: re-adding node, node->sect_info.size = %Hu\n", FUNC, node->sect_info.size); + HDfprintf(stderr, "%s: re-adding node, node->sect_info.size = %Hu\n", __func__, + node->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Re-add the section to the free-space manager */ @@ -837,7 +838,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); + HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", __func__, (unsigned)alloc_type, size); #endif /* H5MF_ALLOC_DEBUG */ /* check arguments */ @@ -854,7 +855,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &fs_type); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 1.0\n", FUNC); + HDfprintf(stderr, "%s: Check 1.0\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Set the ring type in the API context */ @@ -891,7 +892,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) /* If no space is found from the free-space manager, continue further action */ if (!H5F_addr_defined(ret_value)) { #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 2.0\n", FUNC); + HDfprintf(stderr, "%s: Check 2.0\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ if (f->shared->fs_strategy == H5F_FSPACE_STRATEGY_PAGE) { HDassert(f->shared->fs_page_size >= H5F_FILE_SPACE_PAGE_SIZE_MIN); @@ -906,7 +907,7 @@ H5MF_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) } /* end if */ HDassert(H5F_addr_defined(ret_value)); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 3.0\n", FUNC); + HDfprintf(stderr, "%s: Check 3.0\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ done: @@ -915,7 +916,7 @@ done: H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); + HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", __func__, ret_value, size); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); @@ -955,7 +956,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); + HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", __func__, (unsigned)alloc_type, size); #endif /* H5MF_ALLOC_DEBUG */ H5MF__alloc_to_fs_type(f->shared, alloc_type, size, &ptype); @@ -1052,7 +1053,7 @@ H5MF__alloc_pagefs(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) done: #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); + HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", __func__, ret_value, size); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); @@ -1098,7 +1099,7 @@ H5MF_alloc_tmp(H5F_t *f, hsize_t size) FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: size = %Hu\n", FUNC, size); + HDfprintf(stderr, "%s: size = %Hu\n", __func__, size); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ @@ -1145,8 +1146,8 @@ H5MF_xfree(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)alloc_type, - addr, size); + HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", __func__, + (unsigned)alloc_type, addr, size); #endif /* H5MF_ALLOC_DEBUG */ /* check arguments */ @@ -1223,13 +1224,13 @@ H5MF__xfree_inner_impl(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t si * space is at the end of the file */ #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: fs_addr = %a\n", FUNC, f->shared->fs_addr[fs_type]); + HDfprintf(stderr, "%s: fs_addr = %a\n", __func__, f->shared->fs_addr[fs_type]); #endif /* H5MF_ALLOC_DEBUG_MORE */ if (!H5F_addr_defined(f->shared->fs_addr[fs_type])) { htri_t status; /* "can absorb" status for section into */ #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Trying to avoid starting up free space manager\n", FUNC); + HDfprintf(stderr, "%s: Trying to avoid starting up free space manager\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Try to shrink the file or absorb the block into a block aggregator */ if ((status = H5MF_try_shrink(f, alloc_type, addr, size)) < 0) @@ -1239,7 +1240,8 @@ H5MF__xfree_inner_impl(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t si HGOTO_DONE(SUCCEED) else if (size < f->shared->fs_threshold) { #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, addr, size); + HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", __func__, addr, + size); #endif /* H5MF_ALLOC_DEBUG_MORE */ HGOTO_DONE(SUCCEED) } /* end else-if */ @@ -1256,7 +1258,7 @@ H5MF__xfree_inner_impl(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t si */ if (f->shared->fs_state[fs_type] == H5F_FS_STATE_DELETING || !H5F_HAVE_FREE_SPACE_MANAGER(f)) { #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", FUNC, addr, size); + HDfprintf(stderr, "%s: dropping addr = %a, size = %Hu, on the floor!\n", __func__, addr, size); #endif /* H5MF_ALLOC_DEBUG_MORE */ HGOTO_DONE(SUCCEED) } /* end if */ @@ -1279,7 +1281,7 @@ H5MF__xfree_inner_impl(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t si HDassert(f->shared->fs_man[fs_type]); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Before H5FS_sect_add()\n", FUNC); + HDfprintf(stderr, "%s: Before H5FS_sect_add()\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* Add to the free space for the file */ @@ -1288,7 +1290,7 @@ H5MF__xfree_inner_impl(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t si node = NULL; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: After H5FS_sect_add()\n", FUNC); + HDfprintf(stderr, "%s: After H5FS_sect_add()\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ else { @@ -1321,7 +1323,7 @@ done: HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); @@ -1414,8 +1416,8 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_requested = %Hu\n", FUNC, - (unsigned)alloc_type, addr, size, extra_requested); + HDfprintf(stderr, "%s: Entering: alloc_type = %u, addr = %a, size = %Hu, extra_requested = %Hu\n", + __func__, (unsigned)alloc_type, addr, size, extra_requested); #endif /* H5MF_ALLOC_DEBUG */ /* Sanity check */ @@ -1467,7 +1469,7 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi if ((ret_value = H5F__try_extend(f, map_type, end, extra_requested + frag_size)) < 0) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending file") #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: extended = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: extended = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ /* If extending at EOA succeeds: */ @@ -1505,7 +1507,7 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending aggregation block") #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: H5MF__aggr_try_extend = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: H5MF__aggr_try_extend = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ @@ -1531,7 +1533,7 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi HGOTO_ERROR(H5E_RESOURCE, H5E_CANTEXTEND, FAIL, "error extending block in free space manager") #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Try to H5FS_sect_try_extend = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Try to H5FS_sect_try_extend = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ @@ -1542,7 +1544,8 @@ H5MF_try_extend(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size, hsi if (frag_size <= H5F_PGEND_META_THRES(f) && extra_requested <= frag_size) ret_value = TRUE; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Try to extend into the page end threshold = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Try to extend into the page end threshold = %t\n", __func__, + ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ } /* end if */ @@ -1554,7 +1557,7 @@ done: H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG */ #ifdef H5MF_ALLOC_DEBUG_DUMP H5MF__sects_dump(f, stderr); @@ -1589,8 +1592,8 @@ H5MF_try_shrink(H5F_t *f, H5FD_mem_t alloc_type, haddr_t addr, hsize_t size) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", FUNC, (unsigned)alloc_type, - addr, size); + HDfprintf(stderr, "%s: Entering - alloc_type = %u, addr = %a, size = %Hu\n", __func__, + (unsigned)alloc_type, addr, size); #endif /* H5MF_ALLOC_DEBUG */ /* check arguments */ @@ -1646,7 +1649,7 @@ done: HDONE_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't free simple section node") #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving, ret_value = %d\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF_try_shrink() */ @@ -1670,7 +1673,7 @@ H5MF_close(H5F_t *f) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", FUNC); + HDfprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ @@ -1688,7 +1691,7 @@ H5MF_close(H5F_t *f) done: #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", FUNC); + HDfprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF_close() */ @@ -1714,7 +1717,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type) FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", FUNC); + HDfprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ @@ -1726,7 +1729,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type) HDassert((H5FD_mem_t)type < H5FD_MEM_NTYPES); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", FUNC, + HDfprintf(stderr, "%s: Check 1.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", __func__, (unsigned)type, f->shared->fs_man[type], (unsigned)type, f->shared->fs_addr[type]); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -1736,7 +1739,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTRELEASE, FAIL, "can't close the free space manager") #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Check 2.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", FUNC, + HDfprintf(stderr, "%s: Check 2.0 - f->shared->fs_man[%u] = %p, f->shared->fs_addr[%u] = %a\n", __func__, (unsigned)type, f->shared->fs_man[type], (unsigned)type, f->shared->fs_addr[type]); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -1747,7 +1750,7 @@ H5MF__close_delete_fstype(H5F_t *f, H5F_mem_page_t type) done: #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", FUNC); + HDfprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5MF__close_delete() */ @@ -1776,7 +1779,7 @@ H5MF_try_close(H5F_t *f) FUNC_ENTER_NOAPI_TAG(H5AC__FREESPACE_TAG, FAIL) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", FUNC); + HDfprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ @@ -1855,7 +1858,7 @@ done: H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", FUNC); + HDfprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* H5MF_try_close() */ @@ -1883,7 +1886,7 @@ H5MF__close_aggrfs(H5F_t *f) FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", FUNC); + HDfprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ @@ -2021,7 +2024,7 @@ done: H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", FUNC); + HDfprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF__close_aggrfs() */ @@ -2049,7 +2052,7 @@ H5MF__close_pagefs(H5F_t *f) FUNC_ENTER_STATIC_TAG(H5AC__FREESPACE_TAG) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Entering\n", FUNC); + HDfprintf(stderr, "%s: Entering\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* check args */ @@ -2196,7 +2199,7 @@ done: H5AC_set_ring(orig_ring, NULL); #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Leaving\n", FUNC); + HDfprintf(stderr, "%s: Leaving\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF__close_pagefs() */ diff --git a/src/H5MFaggr.c b/src/H5MFaggr.c index 12e9dbe..4684ee2 100644 --- a/src/H5MFaggr.c +++ b/src/H5MFaggr.c @@ -92,7 +92,7 @@ H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) FUNC_ENTER_NOAPI(HADDR_UNDEF) #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", FUNC, (unsigned)alloc_type, size); + HDfprintf(stderr, "%s: alloc_type = %u, size = %Hu\n", __func__, (unsigned)alloc_type, size); #endif /* H5MF_AGGR_DEBUG */ /* check arguments */ @@ -120,7 +120,7 @@ H5MF_aggr_vfd_alloc(H5F_t *f, H5FD_mem_t alloc_type, hsize_t size) done: #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", FUNC, ret_value, size); + HDfprintf(stderr, "%s: Leaving: ret_value = %a, size = %Hu\n", __func__, ret_value, size); #endif /* H5MF_AGGR_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) @@ -150,7 +150,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F FUNC_ENTER_STATIC #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: type = %u, size = %Hu\n", FUNC, (unsigned)type, size); + HDfprintf(stderr, "%s: type = %u, size = %Hu\n", __func__, (unsigned)type, size); #endif /* H5MF_AGGR_DEBUG */ /* check args */ @@ -199,7 +199,8 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F H5FD_mem_t alloc_type, other_alloc_type; /* Current aggregator & 'other' aggregator types */ #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", FUNC, aggr->addr, aggr->tot_size, aggr->size); + HDfprintf(stderr, "%s: aggr = {%a, %Hu, %Hu}\n", __func__, aggr->addr, aggr->tot_size, + aggr->size); #endif /* H5MF_AGGR_DEBUG */ /* Turn off alignment if allocation < threshold */ @@ -267,7 +268,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F /* Allocate another block */ #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: Allocating block\n", FUNC); + HDfprintf(stderr, "%s: Allocating block\n", __func__); #endif /* H5MF_AGGR_DEBUG */ if (aggr_frag_size > (ext_size - size)) @@ -387,7 +388,7 @@ H5MF__aggr_alloc(H5F_t *f, H5F_blk_aggr_t *aggr, H5F_blk_aggr_t *other_aggr, H5F done: #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: ret_value = %a\n", FUNC, ret_value); + HDfprintf(stderr, "%s: ret_value = %a\n", __func__, ret_value); #endif /* H5MF_AGGR_DEBUG */ FUNC_LEAVE_NOAPI(ret_value) } /* end H5MF__aggr_alloc() */ @@ -722,7 +723,7 @@ done: tmp_addr = aggr->addr; tmp_size = aggr->size; #ifdef H5MF_AGGR_DEBUG - HDfprintf(stderr, "%s: tmp_addr = %a, tmp_size = %Hu\n", FUNC, tmp_addr, tmp_size); + HDfprintf(stderr, "%s: tmp_addr = %a, tmp_size = %Hu\n", __func__, tmp_addr, tmp_size); #endif /* H5MF_AGGR_DEBUG */ /* Reset aggregator block information */ diff --git a/src/H5MFdbg.c b/src/H5MFdbg.c index 7b89fd8..6ccbe78 100644 --- a/src/H5MFdbg.c +++ b/src/H5MFdbg.c @@ -210,7 +210,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) FUNC_ENTER_PACKAGE_TAG(H5AC__FREESPACE_TAG) #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: Dumping file free space sections\n", FUNC); + HDfprintf(stderr, "%s: Dumping file free space sections\n", __func__); #endif /* H5MF_ALLOC_DEBUG */ /* @@ -223,7 +223,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) if (HADDR_UNDEF == (eoa = H5F_get_eoa(f, H5FD_MEM_DEFAULT))) HGOTO_ERROR(H5E_RESOURCE, H5E_CANTGET, FAIL, "driver get_eoa request failed") #ifdef H5MF_ALLOC_DEBUG - HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %" PRIuHADDR "\n", FUNC, eoa); + HDfprintf(stderr, "%s: for type = H5FD_MEM_DEFAULT, eoa = %" PRIuHADDR "\n", __func__, eoa); #endif /* H5MF_ALLOC_DEBUG */ if (H5F_PAGED_AGGR(f)) { /* File space paging */ @@ -267,7 +267,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: ma_addr = %" PRIuHADDR ", ma_size = %" PRIuHSIZE ", end of ma = %" PRIuHADDR "\n", - FUNC, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); + __func__, ma_addr, ma_size, (haddr_t)((ma_addr + ma_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ /* Retrieve 'small data' aggregator info, if available */ @@ -275,7 +275,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) #ifdef H5MF_ALLOC_DEBUG HDfprintf(stderr, "%s: sda_addr = %" PRIuHADDR ", sda_size = %" PRIuHSIZE ", end of sda = %" PRIuHADDR "\n", - FUNC, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); + __func__, sda_addr, sda_size, (haddr_t)((sda_addr + sda_size) - 1)); #endif /* H5MF_ALLOC_DEBUG */ /* Iterate over all the free space types that have managers and dump each free list's space */ @@ -318,7 +318,7 @@ H5MF__sects_dump(H5F_t *f, FILE *stream) } /* end else */ done: - HDfprintf(stderr, "%s: Done dumping file free space sections\n", FUNC); + HDfprintf(stderr, "%s: Done dumping file free space sections\n", __func__); FUNC_LEAVE_NOAPI_TAG(ret_value) } /* end H5MF__sects_dump() */ #endif /* H5MF_ALLOC_DEBUG_DUMP */ diff --git a/src/H5MFsection.c b/src/H5MFsection.c index 1494d21..e686842d 100644 --- a/src/H5MFsection.c +++ b/src/H5MFsection.c @@ -472,7 +472,7 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* Set the shrinking type */ udata->shrink = H5MF_SHRINK_EOA; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr, + HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", __func__, sect->sect_info.addr, sect->sect_info.size, eoa); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -496,7 +496,7 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* Set the aggregator to operate on */ udata->aggr = &(udata->f->shared->meta_aggr); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins metadata aggregator\n", FUNC, + HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins metadata aggregator\n", __func__, sect->sect_info.addr, sect->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -517,7 +517,7 @@ H5MF__sect_simple_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* Set the aggregator to operate on */ udata->aggr = &(udata->f->shared->sdata_aggr); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins small data aggregator\n", FUNC, + HDfprintf(stderr, "%s: section {%a, %Hu}, adjoins small data aggregator\n", __func__, sect->sect_info.addr, sect->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -625,7 +625,7 @@ H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata) FUNC_ENTER_STATIC #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr, + HDfprintf(stderr, "%s: Entering, section {%a, %Hu}\n", __func__, (*sect)->sect_info.addr, (*sect)->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -646,14 +646,14 @@ H5MF__sect_small_add(H5FS_section_info_t **_sect, unsigned *flags, void *_udata) *flags &= (unsigned)~H5FS_ADD_RETURNED_SPACE; *flags |= H5FS_PAGE_END_NO_ADD; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section is dropped\n", FUNC); + HDfprintf(stderr, "%s: section is dropped\n", __func__); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ /* Adjust the section if it is not at page end but its size + prem is at page end */ else if (prem <= H5F_PGEND_META_THRES(udata->f)) { (*sect)->sect_info.size += prem; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section is adjusted {%a, %Hu}\n", FUNC, (*sect)->sect_info.addr, + HDfprintf(stderr, "%s: section is adjusted {%a, %Hu}\n", __func__, (*sect)->sect_info.addr, (*sect)->sect_info.size); #endif /* H5MF_ALLOC_DEBUG_MORE */ } /* end if */ @@ -702,7 +702,7 @@ H5MF__sect_small_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section ret_value = FALSE; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ FUNC_LEAVE_NOAPI(ret_value) @@ -818,7 +818,7 @@ H5MF__sect_large_can_merge(const H5FS_section_info_t *_sect1, const H5FS_section ret_value = H5F_addr_eq(sect1->sect_info.addr + sect1->sect_info.size, sect2->sect_info.addr); #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", FUNC, ret_value); + HDfprintf(stderr, "%s: Leaving: ret_value = %t\n", __func__, ret_value); #endif /* H5MF_ALLOC_DEBUG_MORE */ done: @@ -907,7 +907,7 @@ H5MF__sect_large_can_shrink(const H5FS_section_info_t *_sect, void *_udata) /* Set the shrinking type */ udata->shrink = H5MF_SHRINK_EOA; #ifdef H5MF_ALLOC_DEBUG_MORE - HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", FUNC, sect->sect_info.addr, + HDfprintf(stderr, "%s: section {%a, %Hu}, shrinks file, eoa = %a\n", __func__, sect->sect_info.addr, sect->sect_info.size, eoa); #endif /* H5MF_ALLOC_DEBUG_MORE */ @@ -201,7 +201,7 @@ H5Oopen_async(const char *app_file, const char *app_func, unsigned app_line, hid if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID") @@ -334,7 +334,7 @@ H5Oopen_by_idx_async(const char *app_file, const char *app_func, unsigned app_li if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0) { + H5ARG_TRACE10(__func__, "*s*sIui*sIiIohii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, lapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HDONE_ERROR(H5E_OHDR, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID") @@ -594,7 +594,7 @@ H5Ocopy_async(const char *app_file, const char *app_func, unsigned app_line, hid if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIui*si*siii", app_file, app_func, app_line, src_loc_id, src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIui*si*siii", app_file, app_func, app_line, src_loc_id, src_name, dst_loc_id, dst_name, ocpypl_id, lcpl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -695,7 +695,7 @@ H5Oflush_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, obj_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, obj_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -796,7 +796,7 @@ H5Orefresh_async(const char *app_file, const char *app_func, unsigned app_line, if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, oid, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, oid, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1202,7 +1202,7 @@ H5Oget_info_by_name_async(const char *app_file, const char *app_func, unsigned a if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE9(FUNC, "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, es_id)) < 0) + H5ARG_TRACE9(__func__, "*s*sIui*sxIuii", app_file, app_func, app_line, loc_id, name, oinfo, fields, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -1929,7 +1929,7 @@ H5Oclose_async(const char *app_file, const char *app_func, unsigned app_line, hi if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, object_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, object_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_OHDR, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -584,7 +584,7 @@ H5Ropen_object_async(const char *app_file, const char *app_func, unsigned app_li if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on object ID") @@ -746,7 +746,7 @@ H5Ropen_region_async(const char *app_file, const char *app_func, unsigned app_li if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, oapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, "can't decrement count on region ID") @@ -915,7 +915,7 @@ H5Ropen_attr_async(const char *app_file, const char *app_func, unsigned app_line if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, aapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIu*Rriii", app_file, app_func, app_line, ref_ptr, rapl_id, aapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HGOTO_ERROR(H5E_REFERENCE, H5E_CANTDEC, H5I_INVALID_HID, diff --git a/src/H5Shyper.c b/src/H5Shyper.c index e12ff93..a5b9b6c 100644 --- a/src/H5Shyper.c +++ b/src/H5Shyper.c @@ -296,11 +296,11 @@ H5S__hyper_print_spans_helper(FILE *f, const H5S_hyper_span_t *span, unsigned de FUNC_ENTER_STATIC_NOERR while (span) { - HDfprintf(f, "%s: %*sdepth=%u, span=%p, (%Hu, %Hu), next=%p\n", FUNC, depth * 2, "", depth, span, + HDfprintf(f, "%s: %*sdepth=%u, span=%p, (%Hu, %Hu), next=%p\n", __func__, depth * 2, "", depth, span, span->low, span->high, span->next); if (span->down) { - HDfprintf(f, "%s: %*sspans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", FUNC, (depth + 1) * 2, - "", span->down, span->down->count, span->down->low_bounds[0], + HDfprintf(f, "%s: %*sspans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", __func__, + (depth + 1) * 2, "", span->down, span->down->count, span->down->low_bounds[0], span->down->high_bounds[0], span->down->head); H5S__hyper_print_spans_helper(f, span->down->head, depth + 1); } /* end if */ @@ -316,7 +316,7 @@ H5S__hyper_print_spans(FILE *f, const H5S_hyper_span_info_t *span_lst) FUNC_ENTER_STATIC_NOERR if (span_lst != NULL) { - HDfprintf(f, "%s: spans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", FUNC, span_lst, + HDfprintf(f, "%s: spans=%p, count=%u, bounds[0]={%Hu, %Hu}, head=%p\n", __func__, span_lst, span_lst->count, span_lst->low_bounds[0], span_lst->high_bounds[0], span_lst->head); H5S__hyper_print_spans_helper(f, span_lst->head, 0); } /* end if */ @@ -342,21 +342,21 @@ H5S__hyper_print_diminfo_helper(FILE *f, const char *field, unsigned ndims, cons FUNC_ENTER_STATIC_NOERR if (dinfo != NULL) { - HDfprintf(f, "%s: %s: start=[", FUNC, field); + HDfprintf(f, "%s: %s: start=[", __func__, field); for (u = 0; u < ndims; u++) HDfprintf(f, "%Hd%s", dinfo[u].start, (u < (ndims - 1) ? ", " : "]\n")); - HDfprintf(f, "%s: %s: stride=[", FUNC, field); + HDfprintf(f, "%s: %s: stride=[", __func__, field); for (u = 0; u < ndims; u++) HDfprintf(f, "%Hu%s", dinfo[u].stride, (u < (ndims - 1) ? ", " : "]\n")); - HDfprintf(f, "%s: %s: count=[", FUNC, field); + HDfprintf(f, "%s: %s: count=[", __func__, field); for (u = 0; u < ndims; u++) HDfprintf(f, "%Hu%s", dinfo[u].count, (u < (ndims - 1) ? ", " : "]\n")); - HDfprintf(f, "%s: %s: block=[", FUNC, field); + HDfprintf(f, "%s: %s: block=[", __func__, field); for (u = 0; u < ndims; u++) HDfprintf(f, "%Hu%s", dinfo[u].block, (u < (ndims - 1) ? ", " : "]\n")); } /* end if */ else - HDfprintf(f, "%s: %s==NULL\n", FUNC, field); + HDfprintf(f, "%s: %s==NULL\n", __func__, field); FUNC_LEAVE_NOAPI(SUCCEED) } diff --git a/src/H5Smpio.c b/src/H5Smpio.c index 7b85209..b626b77 100644 --- a/src/H5Smpio.c +++ b/src/H5Smpio.c @@ -685,7 +685,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new rank = sel_iter.u.hyp.iter_rank; #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: Flattened selection\n", FUNC); + HDfprintf(H5DEBUG(S), "%s: Flattened selection\n", __func__); #endif for (u = 0; u < rank; ++u) { H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t) @@ -700,7 +700,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new HDfprintf(H5DEBUG(S), "%s: start=%" PRIdHSIZE " stride=%" PRIuHSIZE " count=%" PRIuHSIZE " block=%" PRIuHSIZE " xtent=%" PRIuHSIZE, - FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); + __func__, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); if (u == 0) HDfprintf(H5DEBUG(S), " rank=%u\n", rank); else @@ -719,7 +719,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new rank = space->extent.rank; #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: Non-flattened selection\n", FUNC); + HDfprintf(H5DEBUG(S), "%s: Non-flattened selection\n", __func__); #endif for (u = 0; u < rank; ++u) { H5_CHECK_OVERFLOW(diminfo[u].start, hsize_t, hssize_t) @@ -734,7 +734,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new HDfprintf(H5DEBUG(S), "%s: start=%" PRIdHSIZE " stride=%" PRIuHSIZE " count=%" PRIuHSIZE " block=%" PRIuHSIZE " xtent=%" PRIuHSIZE, - FUNC, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); + __func__, d[u].start, d[u].strid, d[u].count, d[u].block, d[u].xtent); if (u == 0) HDfprintf(H5DEBUG(S), " rank=%u\n", rank); else @@ -783,7 +783,7 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new *******************************************************/ #ifdef H5S_DEBUG if (H5DEBUG(S)) { - HDfprintf(H5DEBUG(S), "%s: Making contig type %zu MPI_BYTEs\n", FUNC, elmt_size); + HDfprintf(H5DEBUG(S), "%s: Making contig type %zu MPI_BYTEs\n", __func__, elmt_size); for (i = ((int)rank) - 1; i >= 0; --i) HDfprintf(H5DEBUG(S), "d[%d].xtent=%" PRIuHSIZE "\n", i, d[i].xtent); } @@ -817,12 +817,12 @@ H5S__mpio_reg_hyper_type(const H5S_t *space, size_t elmt_size, MPI_Datatype *new "%s: Dimension i=%d \n" "start=%" PRIdHSIZE " count=%" PRIuHSIZE " block=%" PRIuHSIZE " stride=%" PRIuHSIZE ", xtent=%" PRIuHSIZE " max_xtent=%" PRIuHSIZE "\n", - FUNC, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]); + __func__, i, d[i].start, d[i].count, d[i].block, d[i].strid, d[i].xtent, max_xtent[i]); #endif #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", FUNC, i); + HDfprintf(H5DEBUG(S), "%s: i=%d Making vector-type \n", __func__, i); #endif /**************************************** * Build vector type of the selection. @@ -957,7 +957,7 @@ done: #ifdef H5S_DEBUG if (H5DEBUG(S)) - HDfprintf(H5DEBUG(S), "Leave %s, count=%d is_derived_type=%s\n", FUNC, *count, + HDfprintf(H5DEBUG(S), "Leave %s, count=%d is_derived_type=%s\n", __func__, *count, (*is_derived_type) ? "TRUE" : "FALSE"); #endif FUNC_LEAVE_NOAPI(ret_value) @@ -2040,7 +2040,7 @@ H5Tclose_async(const char *app_file, const char *app_func, unsigned app_line, hi /* If a token was created, add the token to the event set */ if (NULL != token) if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE5(FUNC, "*s*sIuii", app_file, app_func, app_line, type_id, es_id)) < 0) + H5ARG_TRACE5(__func__, "*s*sIuii", app_file, app_func, app_line, type_id, es_id)) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert token into event set") done: diff --git a/src/H5Tcommit.c b/src/H5Tcommit.c index d214ca1..91801c6 100644 --- a/src/H5Tcommit.c +++ b/src/H5Tcommit.c @@ -218,7 +218,7 @@ H5Tcommit_async(const char *app_file, const char *app_func, unsigned app_line, h if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE10(FUNC, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id, es_id)) < 0) + H5ARG_TRACE10(__func__, "*s*sIui*siiiii", app_file, app_func, app_line, loc_id, name, type_id, lcpl_id, tcpl_id, tapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_DATATYPE, H5E_CANTINSERT, FAIL, "can't insert token into event set") @@ -726,7 +726,7 @@ H5Topen_async(const char *app_file, const char *app_func, unsigned app_line, hid if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE7(FUNC, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, tapl_id, es_id)) < 0) { + H5ARG_TRACE7(__func__, "*s*sIui*sii", app_file, app_func, app_line, loc_id, name, tapl_id, es_id)) < 0) { /* clang-format on */ if (H5I_dec_app_ref_always_close(ret_value) < 0) HGOTO_ERROR(H5E_DATATYPE, H5E_CANTDEC, H5I_INVALID_HID, diff --git a/src/H5detect.c b/src/H5detect.c index d148301..2e893cf 100644 --- a/src/H5detect.c +++ b/src/H5detect.c @@ -80,7 +80,7 @@ H5_GCC_DIAG_OFF("cast-align") #define H5SETJMP(buf) HDsigsetjmp(buf, 1) #define H5LONGJMP(buf, val) HDsiglongjmp(buf, val) #define H5HAVE_SIGJMP /* sigsetjmp/siglongjmp are supported. */ -#elif defined(H5_HAVE_LONGJMP) +#else #define H5JMP_BUF jmp_buf #define H5SETJMP(buf) HDsetjmp(buf) #define H5LONGJMP(buf, val) HDlongjmp(buf, val) @@ -149,12 +149,8 @@ static int sigbus_handler_called_g = 0; /* how many times called */ static int sigsegv_handler_called_g = 0; /* how many times called */ static int sigill_handler_called_g = 0; /* how many times called */ static int signal_handler_tested_g = 0; /* how many times tested */ -#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) -static int verify_signal_handlers(int signum, void (*handler)(int)); -#endif -#ifdef H5JMP_BUF -static H5JMP_BUF jbuf_g; -#endif +static int verify_signal_handlers(int signum, void (*handler)(int)); +static H5JMP_BUF jbuf_g; /*------------------------------------------------------------------------- * Function: precision @@ -388,7 +384,6 @@ precision(detected_t *d) COMP_ALIGN = (unsigned int)((char *)(&(s.x)) - (char *)(&s)); \ } -#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) #define ALIGNMENT(TYPE, INFO) \ { \ char *volatile _buf = NULL; \ @@ -435,15 +430,6 @@ precision(detected_t *d) HDsignal(SIGSEGV, _handler2); /*restore original handler*/ \ HDsignal(SIGILL, _handler3); /*restore original handler*/ \ } -#else -#define ALIGNMENT(TYPE, INFO) \ - { \ - align_status_g |= STA_NoALIGNMENT; \ - (INFO.align) = 0; \ - } -#endif - -#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- * Function: sigsegv_handler @@ -473,9 +459,6 @@ sigsegv_handler(int H5_ATTR_UNUSED signo) HDsignal(SIGSEGV, sigsegv_handler); H5LONGJMP(jbuf_g, SIGSEGV); } -#endif - -#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- * Function: sigbus_handler @@ -505,9 +488,6 @@ sigbus_handler(int H5_ATTR_UNUSED signo) HDsignal(SIGBUS, sigbus_handler); H5LONGJMP(jbuf_g, SIGBUS); } -#endif - -#if defined(H5LONGJMP) && defined(H5_HAVE_SIGNAL) /*------------------------------------------------------------------------- * Function: sigill_handler @@ -537,7 +517,6 @@ sigill_handler(int H5_ATTR_UNUSED signo) HDsignal(SIGILL, sigill_handler); H5LONGJMP(jbuf_g, SIGILL); } -#endif /*------------------------------------------------------------------------- * Function: print_results @@ -777,21 +756,6 @@ done:\n\ fprintf(rawoutstream, "/* Signal handlers verify test is not available */\n"); /* The following is available in H5pubconf.h. Printing them here for */ /* convenience. */ -#ifdef H5_HAVE_SIGNAL - fprintf(rawoutstream, "/* Signal() support: yes */\n"); -#else - fprintf(rawoutstream, "/* Signal() support: no */\n"); -#endif -#ifdef H5_HAVE_SETJMP - fprintf(rawoutstream, "/* setjmp() support: yes */\n"); -#else - fprintf(rawoutstream, "/* setjmp() support: no */\n"); -#endif -#ifdef H5_HAVE_LONGJMP - fprintf(rawoutstream, "/* longjmp() support: yes */\n"); -#else - fprintf(rawoutstream, "/* longjmp() support: no */\n"); -#endif #ifdef H5_HAVE_SIGSETJMP fprintf(rawoutstream, "/* sigsetjmp() support: yes */\n"); #else @@ -1314,60 +1278,18 @@ detect_C89_floats(void) static void HDF_NO_UBSAN detect_C99_integers8(void) { -#if H5_SIZEOF_INT8_T > 0 -#if H5_SIZEOF_INT8_T == 1 DETECT_BYTE(int8_t, INT8, d_g[nd_g]); nd_g++; -#else - DETECT_I(int8_t, INT8, d_g[nd_g]); - nd_g++; -#endif -#endif -#if H5_SIZEOF_UINT8_T > 0 -#if H5_SIZEOF_UINT8_T == 1 DETECT_BYTE(uint8_t, UINT8, d_g[nd_g]); nd_g++; -#else - DETECT_I(uint8_t, UINT8, d_g[nd_g]); - nd_g++; -#endif -#endif -#if H5_SIZEOF_INT_LEAST8_T > 0 -#if H5_SIZEOF_INT_LEAST8_T == 1 DETECT_BYTE(int_least8_t, INT_LEAST8, d_g[nd_g]); nd_g++; -#else - DETECT_I(int_least8_t, INT_LEAST8, d_g[nd_g]); - nd_g++; -#endif -#endif -#if H5_SIZEOF_UINT_LEAST8_T > 0 -#if H5_SIZEOF_UINT_LEAST8_T == 1 DETECT_BYTE(uint_least8_t, UINT_LEAST8, d_g[nd_g]); nd_g++; -#else - DETECT_I(uint_least8_t, UINT_LEAST8, d_g[nd_g]); - nd_g++; -#endif -#endif -#if H5_SIZEOF_INT_FAST8_T > 0 -#if H5_SIZEOF_INT_FAST8_T == 1 DETECT_BYTE(int_fast8_t, INT_FAST8, d_g[nd_g]); nd_g++; -#else - DETECT_I(int_fast8_t, INT_FAST8, d_g[nd_g]); - nd_g++; -#endif -#endif -#if H5_SIZEOF_UINT_FAST8_T > 0 -#if H5_SIZEOF_UINT_FAST8_T == 1 DETECT_BYTE(uint_fast8_t, UINT_FAST8, d_g[nd_g]); nd_g++; -#else - DETECT_I(uint_fast8_t, UINT_FAST8, d_g[nd_g]); - nd_g++; -#endif -#endif } /*------------------------------------------------------------------------- @@ -1381,30 +1303,18 @@ detect_C99_integers8(void) static void HDF_NO_UBSAN detect_C99_integers16(void) { -#if H5_SIZEOF_INT16_T > 0 DETECT_I(int16_t, INT16, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT16_T > 0 DETECT_I(uint16_t, UINT16, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_INT_LEAST16_T > 0 DETECT_I(int_least16_t, INT_LEAST16, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT_LEAST16_T > 0 DETECT_I(uint_least16_t, UINT_LEAST16, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_INT_FAST16_T > 0 DETECT_I(int_fast16_t, INT_FAST16, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT_FAST16_T > 0 DETECT_I(uint_fast16_t, UINT_FAST16, d_g[nd_g]); nd_g++; -#endif } /*------------------------------------------------------------------------- @@ -1418,30 +1328,18 @@ detect_C99_integers16(void) static void HDF_NO_UBSAN detect_C99_integers32(void) { -#if H5_SIZEOF_INT32_T > 0 DETECT_I(int32_t, INT32, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT32_T > 0 DETECT_I(uint32_t, UINT32, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_INT_LEAST32_T > 0 DETECT_I(int_least32_t, INT_LEAST32, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT_LEAST32_T > 0 DETECT_I(uint_least32_t, UINT_LEAST32, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_INT_FAST32_T > 0 DETECT_I(int_fast32_t, INT_FAST32, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT_FAST32_T > 0 DETECT_I(uint_fast32_t, UINT_FAST32, d_g[nd_g]); nd_g++; -#endif } /*------------------------------------------------------------------------- @@ -1456,47 +1354,23 @@ detect_C99_integers32(void) static void HDF_NO_UBSAN detect_C99_integers64(void) { -#if H5_SIZEOF_INT64_T > 0 DETECT_I(int64_t, INT64, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT64_T > 0 DETECT_I(uint64_t, UINT64, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_INT_LEAST64_T > 0 DETECT_I(int_least64_t, INT_LEAST64, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT_LEAST64_T > 0 DETECT_I(uint_least64_t, UINT_LEAST64, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_INT_FAST64_T > 0 DETECT_I(int_fast64_t, INT_FAST64, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_UINT_FAST64_T > 0 DETECT_I(uint_fast64_t, UINT_FAST64, d_g[nd_g]); nd_g++; -#endif -#if H5_SIZEOF_LONG_LONG > 0 DETECT_I(long long, LLONG, d_g[nd_g]); nd_g++; DETECT_I(unsigned long long, ULLONG, d_g[nd_g]); nd_g++; -#else - /* - * This architecture doesn't support an integer type larger than `long' - * so we'll just make H5T_NATIVE_LLONG the same as H5T_NATIVE_LONG since - * `long long' is probably equivalent to `long' here anyway. - */ - DETECT_I(long, LLONG, d_g[nd_g]); - nd_g++; - DETECT_I(unsigned long, ULLONG, d_g[nd_g]); - nd_g++; -#endif } /*------------------------------------------------------------------------- @@ -1568,7 +1442,6 @@ detect_alignments(void) na_g++; } -#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* Verify the signal handler for signal signum works correctly multiple times. * One possible cause of failure is that the signal handling is blocked or * changed to SIG_DFL after H5LONGJMP. @@ -1625,7 +1498,6 @@ verify_signal_handlers(int signum, void (*handler)(int)) return 0; } } -#endif /*------------------------------------------------------------------------- * Function: main @@ -1655,7 +1527,6 @@ main(int argc, char *argv[]) if (!rawoutstream) rawoutstream = stdout; -#if defined(H5SETJMP) && defined(H5_HAVE_SIGNAL) /* verify the SIGBUS and SIGSEGV handlers work properly */ if (verify_signal_handlers(SIGBUS, sigbus_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigbus_handler", SIGBUS); @@ -1666,9 +1537,6 @@ main(int argc, char *argv[]) if (verify_signal_handlers(SIGILL, sigill_handler) != 0) { fprintf(stderr, "Signal handler %s for signal %d failed\n", "sigill_handler", SIGILL); } -#else - align_status_g |= STA_NoHandlerVerify; -#endif print_header(); diff --git a/src/H5private.h b/src/H5private.h index cc19e8e..0e2cdec 100644 --- a/src/H5private.h +++ b/src/H5private.h @@ -26,84 +26,44 @@ #include "H5public.h" /* Include Public Definitions */ -/* include the pthread header */ -#ifdef H5_HAVE_THREADSAFE -#ifdef H5_HAVE_WIN32_API -#ifndef H5_HAVE_WIN_THREADS -#ifdef H5_HAVE_PTHREAD_H -#include <pthread.h> -#endif /* H5_HAVE_PTHREAD_H */ -#endif /* H5_HAVE_WIN_THREADS */ -#else /* H5_HAVE_WIN32_API */ -#ifdef H5_HAVE_PTHREAD_H -#include <pthread.h> -#endif /* H5_HAVE_PTHREAD_H */ -#endif /* H5_HAVE_WIN32_API */ -#endif /* H5_HAVE_THREADSAFE */ - #include <assert.h> #include <ctype.h> #include <errno.h> #include <fcntl.h> #include <float.h> -#include <limits.h> #include <math.h> +#include <setjmp.h> #include <signal.h> #include <stdio.h> #include <stdlib.h> #include <string.h> +#include <time.h> -/* - * If _POSIX_VERSION is defined in unistd.h then this system is Posix.1 - * compliant. Otherwise all bets are off. - */ +/* POSIX headers */ +#ifdef H5_HAVE_SYS_TIME_H +#include <sys/time.h> +#endif #ifdef H5_HAVE_UNISTD_H -#include <sys/types.h> +#include <pwd.h> #include <unistd.h> -#endif -#ifdef _POSIX_VERSION #include <sys/wait.h> -#include <pwd.h> #endif -#include <stdint.h> +/* Include the Pthreads header, if necessary */ +#if defined(H5_HAVE_THREADSAFE) && defined(H5_HAVE_PTHREAD_H) +#include <pthread.h> +#endif /* - * The `struct stat' data type for stat() and fstat(). This is a Posix file - * but often apears on non-Posix systems also. The `struct stat' is required - * for hdf5 to compile, although only a few fields are actually used. + * The `struct stat' data type for stat() and fstat(). This is a POSIX file + * but often apears on non-POSIX systems also. The `struct stat' is required + * for HDF5 to compile, although only a few fields are actually used. */ #ifdef H5_HAVE_SYS_STAT_H #include <sys/stat.h> #endif /* - * If a program may include both `time.h' and `sys/time.h' then - * TIME_WITH_SYS_TIME is defined (see AC_HEADER_TIME in configure.ac). - * On some older systems, `sys/time.h' includes `time.h' but `time.h' is not - * protected against multiple inclusion, so programs should not explicitly - * include both files. This macro is useful in programs that use, for example, - * `struct timeval' or `struct timezone' as well as `struct tm'. It is best - * used in conjunction with `HAVE_SYS_TIME_H', whose existence is checked - * by `AC_CHECK_HEADERS(sys/time.h)' in configure.ac. - */ -#if defined(H5_TIME_WITH_SYS_TIME) -#include <sys/time.h> -#include <time.h> -#elif defined(H5_HAVE_SYS_TIME_H) -#include <sys/time.h> -#else -#include <time.h> -#endif - -/* - * Longjumps are used to detect alignment constrants - */ -#ifdef H5_HAVE_SETJMP_H -#include <setjmp.h> -#endif - -/* * flock() in sys/file.h is used for the implementation of file locking. */ #if defined(H5_HAVE_FLOCK) && defined(H5_HAVE_SYS_FILE_H) @@ -197,8 +157,8 @@ #define eventa(func_name) h5_mpe_eventa #define eventb(func_name) h5_mpe_eventb #define MPE_LOG_VARS \ - static int eventa(FUNC) = -1; \ - static int eventb(FUNC) = -1; \ + static int eventa(__func__) = -1; \ + static int eventb(__func__) = -1; \ char p_event_start[128]; /* Hardwire the color to "red", since that's what all the routines are using @@ -210,14 +170,14 @@ */ #define BEGIN_MPE_LOG \ if (H5_MPEinit_g) { \ - sprintf(p_event_start, "start %s", FUNC); \ - if (eventa(FUNC) == -1 && eventb(FUNC) == -1) { \ + sprintf(p_event_start, "start %s", __func__); \ + if (eventa(__func__) == -1 && eventb(__func__) == -1) { \ const char *p_color = "red"; \ - eventa(FUNC) = MPE_Log_get_event_number(); \ - eventb(FUNC) = MPE_Log_get_event_number(); \ - MPE_Describe_state(eventa(FUNC), eventb(FUNC), FUNC, p_color); \ + eventa(__func__) = MPE_Log_get_event_number(); \ + eventb(__func__) = MPE_Log_get_event_number(); \ + MPE_Describe_state(eventa(__func__), eventb(__func__), __func__, p_color); \ } \ - MPE_Log_event(eventa(FUNC), 0, p_event_start); \ + MPE_Log_event(eventa(__func__), 0, p_event_start); \ } /*------------------------------------------------------------------------ @@ -228,7 +188,7 @@ */ #define FINISH_MPE_LOG \ if (H5_MPEinit_g) { \ - MPE_Log_event(eventb(FUNC), 0, FUNC); \ + MPE_Log_event(eventb(__func__), 0, __func__); \ } #else /* H5_HAVE_MPE */ @@ -403,74 +363,6 @@ #endif /* - * Numeric data types. Some of these might be defined in Posix.1g, otherwise - * we define them with the closest available type which is at least as large - * as the number of bits indicated in the type name. The `int8' types *must* - * be exactly one byte wide because we use it for pointer calculations to - * void* memory. - */ -#if H5_SIZEOF_INT8_T == 0 -typedef signed char int8_t; -#undef H5_SIZEOF_INT8_T -#define H5_SIZEOF_INT8_T H5_SIZEOF_CHAR -#elif H5_SIZEOF_INT8_T == 1 -#else -#error "the int8_t type must be 1 byte wide" -#endif - -#if H5_SIZEOF_UINT8_T == 0 -typedef unsigned char uint8_t; -#undef H5_SIZEOF_UINT8_T -#define H5_SIZEOF_UINT8_T H5_SIZEOF_CHAR -#elif H5_SIZEOF_UINT8_T == 1 -#else -#error "the uint8_t type must be 1 byte wide" -#endif - -#if H5_SIZEOF_INT16_T >= 2 -#elif H5_SIZEOF_SHORT >= 2 -typedef short int16_t; -#undef H5_SIZEOF_INT16_T -#define H5_SIZEOF_INT16_T H5_SIZEOF_SHORT -#elif H5_SIZEOF_INT >= 2 -typedef int int16_t; -#undef H5_SIZEOF_INT16_T -#define H5_SIZEOF_INT16_T H5_SIZEOF_INT -#else -#error "nothing appropriate for int16_t" -#endif - -#if H5_SIZEOF_UINT16_T >= 2 -#elif H5_SIZEOF_SHORT >= 2 -typedef unsigned short uint16_t; -#undef H5_SIZEOF_UINT16_T -#define H5_SIZEOF_UINT16_T H5_SIZEOF_SHORT -#elif H5_SIZEOF_INT >= 2 -typedef unsigned uint16_t; -#undef H5_SIZEOF_UINT16_T -#define H5_SIZEOF_UINT16_T H5_SIZEOF_INT -#else -#error "nothing appropriate for uint16_t" -#endif - -#if H5_SIZEOF_INT32_T >= 4 -#elif H5_SIZEOF_SHORT >= 4 -typedef short int32_t; -#undef H5_SIZEOF_INT32_T -#define H5_SIZEOF_INT32_T H5_SIZEOF_SHORT -#elif H5_SIZEOF_INT >= 4 -typedef int int32_t; -#undef H5_SIZEOF_INT32_T -#define H5_SIZEOF_INT32_T H5_SIZEOF_INT -#elif H5_SIZEOF_LONG >= 4 -typedef long int32_t; -#undef H5_SIZEOF_INT32_T -#define H5_SIZEOF_INT32_T H5_SIZEOF_LONG -#else -#error "nothing appropriate for int32_t" -#endif - -/* * Maximum and minimum values. These should be defined in <limits.h> for the * most part. */ @@ -637,228 +529,231 @@ typedef struct { haddr_t addr; /* The unique address of the object's header in that file */ } H5_obj_t; -/* - * Redefine all the POSIX functions. We should never see a POSIX - * function (or any other non-HDF5 function) in the source! +#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T + +/* Put all Windows-specific definitions in H5win32defs.h so we + * can (mostly) assume a POSIX platform. Not all of the POSIX calls + * will have a Windows equivalent so some #ifdef protection is still + * necessary (e.g., fork()). */ +#include "H5win32defs.h" + +/* Platform-independent definitions for struct stat and off_t */ +#ifndef H5_HAVE_WIN32_API +/* These definitions differ in Windows and are defined in + * H5win32defs for that platform. + */ +typedef struct stat h5_stat_t; +typedef off_t h5_stat_size_t; +#define HDoff_t off_t +#endif -/* Put all platform-specific definitions in the following file */ -/* so that the following definitions are platform free. */ -#include "H5win32defs.h" /* For Windows-specific definitions */ +#/* Redefine all the POSIX and C functions. We should never see an + * undecorated POSIX or C function (or any other non-HDF5 function) + * in the source. + */ #ifndef HDabort #define HDabort() abort() -#endif /* HDabort */ +#endif #ifndef HDabs #define HDabs(X) abs(X) -#endif /* HDabs */ +#endif #ifndef HDaccept -#define HDaccept(A, B, C) accept((A), (B), (C)) /* mirror VFD */ -#endif /* HDaccept */ +#define HDaccept(A, B, C) accept((A), (B), (C)) +#endif #ifndef HDaccess #define HDaccess(F, M) access(F, M) -#endif /* HDaccess */ +#endif #ifndef HDacos #define HDacos(X) acos(X) -#endif /* HDacos */ +#endif #ifndef HDalarm -#ifdef H5_HAVE_ALARM #define HDalarm(N) alarm(N) -#else /* H5_HAVE_ALARM */ -#define HDalarm(N) (0) -#endif /* H5_HAVE_ALARM */ -#endif /* HDalarm */ +#endif #ifndef HDasctime #define HDasctime(T) asctime(T) -#endif /* HDasctime */ +#endif #ifndef HDasin #define HDasin(X) asin(X) -#endif /* HDasin */ +#endif #ifndef HDasprintf #define HDasprintf asprintf /*varargs*/ -#endif /* HDasprintf */ +#endif #ifndef HDassert #define HDassert(X) assert(X) -#endif /* HDassert */ +#endif #ifndef HDatan #define HDatan(X) atan(X) -#endif /* HDatan */ +#endif #ifndef HDatan2 #define HDatan2(X, Y) atan2(X, Y) -#endif /* HDatan2 */ +#endif #ifndef HDatexit #define HDatexit(F) atexit(F) -#endif /* HDatexit */ +#endif #ifndef HDatof #define HDatof(S) atof(S) -#endif /* HDatof */ +#endif #ifndef HDatoi #define HDatoi(S) atoi(S) -#endif /* HDatoi */ +#endif #ifndef HDatol #define HDatol(S) atol(S) -#endif /* HDatol */ +#endif #ifndef HDatoll #define HDatoll(S) atoll(S) -#endif /* HDatol */ +#endif #ifndef HDbind -#define HDbind(A, B, C) bind((A), (B), (C)) /* mirror VFD */ -#endif /* HDbind */ +#define HDbind(A, B, C) bind((A), (B), (C)) +#endif #ifndef HDbsearch #define HDbsearch(K, B, N, Z, F) bsearch(K, B, N, Z, F) -#endif /* HDbsearch */ +#endif #ifndef HDcalloc #define HDcalloc(N, Z) calloc(N, Z) -#endif /* HDcalloc */ +#endif #ifndef HDceil #define HDceil(X) ceil(X) -#endif /* HDceil */ +#endif #ifndef HDcfgetispeed #define HDcfgetispeed(T) cfgetispeed(T) -#endif /* HDcfgetispeed */ +#endif #ifndef HDcfgetospeed #define HDcfgetospeed(T) cfgetospeed(T) -#endif /* HDcfgetospeed */ +#endif #ifndef HDcfsetispeed #define HDcfsetispeed(T, S) cfsetispeed(T, S) -#endif /* HDcfsetispeed */ +#endif #ifndef HDcfsetospeed #define HDcfsetospeed(T, S) cfsetospeed(T, S) -#endif /* HDcfsetospeed */ +#endif #ifndef HDchdir #define HDchdir(S) chdir(S) -#endif /* HDchdir */ +#endif #ifndef HDchmod #define HDchmod(S, M) chmod(S, M) -#endif /* HDchmod */ +#endif #ifndef HDchown #define HDchown(S, O, G) chown(S, O, G) -#endif /* HDchown */ +#endif #ifndef HDclearerr #define HDclearerr(F) clearerr(F) -#endif /* HDclearerr */ +#endif #ifndef HDclock #define HDclock() clock() -#endif /* HDclock */ +#endif #ifndef HDclock_gettime #define HDclock_gettime(CID, TS) clock_gettime(CID, TS) -#endif /* HDclock_gettime */ +#endif #ifndef HDclose #define HDclose(F) close(F) -#endif /* HDclose */ +#endif #ifndef HDclosedir #define HDclosedir(D) closedir(D) -#endif /* HDclosedir */ +#endif #ifndef HDconnect -#define HDconnect(A, B, C) connect((A), (B), (C)) /* mirror VFD */ -#endif /* HDconnect */ +#define HDconnect(A, B, C) connect((A), (B), (C)) +#endif #ifndef HDcos #define HDcos(X) cos(X) -#endif /* HDcos */ +#endif #ifndef HDcosh #define HDcosh(X) cosh(X) -#endif /* HDcosh */ +#endif #ifndef HDcreat #define HDcreat(S, M) creat(S, M) -#endif /* HDcreat */ +#endif #ifndef HDctermid #define HDctermid(S) ctermid(S) -#endif /* HDctermid */ +#endif #ifndef HDctime #define HDctime(T) ctime(T) -#endif /* HDctime */ +#endif #ifndef HDcuserid #define HDcuserid(S) cuserid(S) -#endif /* HDcuserid */ +#endif #ifndef HDdifftime -#ifdef H5_HAVE_DIFFTIME #define HDdifftime(X, Y) difftime(X, Y) -#else /* H5_HAVE_DIFFTIME */ -#define HDdifftime(X, Y) ((double)(X) - (double)(Y)) -#endif /* H5_HAVE_DIFFTIME */ -#endif /* HDdifftime */ +#endif #ifndef HDdiv #define HDdiv(X, Y) div(X, Y) -#endif /* HDdiv */ +#endif #ifndef HDdup #define HDdup(F) dup(F) -#endif /* HDdup */ +#endif #ifndef HDdup2 #define HDdup2(F, I) dup2(F, I) -#endif /* HDdup2 */ -/* execl() variable arguments */ -/* execle() variable arguments */ -/* execlp() variable arguments */ +#endif #ifndef HDexecv #define HDexecv(S, AV) execv(S, AV) -#endif /* HDexecv */ +#endif #ifndef HDexecve #define HDexecve(S, AV, E) execve(S, AV, E) -#endif /* HDexecve */ +#endif #ifndef HDexecvp #define HDexecvp(S, AV) execvp(S, AV) -#endif /* HDexecvp */ +#endif #ifndef HDexit #define HDexit(N) exit(N) -#endif /* HDexit */ +#endif #ifndef HD_exit #define HD_exit(N) _exit(N) -#endif /* HD_exit */ +#endif #ifndef HDexp #define HDexp(X) exp(X) -#endif /* HDexp */ +#endif #ifndef HDexp2 #define HDexp2(X) exp2(X) -#endif /* HDexp2 */ +#endif #ifndef HDfabs #define HDfabs(X) fabs(X) -#endif /* HDfabs */ -/* use ABS() because fabsf() fabsl() are not common yet. */ +#endif #ifndef HDfabsf -#define HDfabsf(X) ABS(X) -#endif /* HDfabsf */ +#define HDfabsf(X) fabsf(X) +#endif #ifndef HDfabsl -#define HDfabsl(X) ABS(X) -#endif /* HDfabsl */ +#define HDfabsl(X) fabsl(X) +#endif #ifndef HDfclose #define HDfclose(F) fclose(F) -#endif /* HDfclose */ -#ifdef H5_HAVE_FCNTL +#endif #ifndef HDfcntl #define HDfcntl(F, C, ...) fcntl(F, C, __VA_ARGS__) -#endif /* HDfcntl */ -#endif /* H5_HAVE_FCNTL */ +#endif #ifndef HDfdopen #define HDfdopen(N, S) fdopen(N, S) -#endif /* HDfdopen */ +#endif #ifndef HDfeof #define HDfeof(F) feof(F) -#endif /* HDfeof */ +#endif #ifndef HDferror #define HDferror(F) ferror(F) -#endif /* HDferror */ +#endif #ifndef HDfflush #define HDfflush(F) fflush(F) -#endif /* HDfflush */ +#endif #ifndef HDfgetc #define HDfgetc(F) fgetc(F) -#endif /* HDfgetc */ +#endif #ifndef HDfgetpos #define HDfgetpos(F, P) fgetpos(F, P) -#endif /* HDfgetpos */ +#endif #ifndef HDfgets #define HDfgets(S, N, F) fgets(S, N, F) -#endif /* HDfgets */ +#endif #ifndef HDfileno #define HDfileno(F) fileno(F) -#endif /* HDfileno */ +#endif + /* Since flock is so prevalent, always build these functions * when possible to avoid them becoming dead code. */ #ifdef H5_HAVE_FCNTL H5_DLL int Pflock(int fd, int operation); -#endif /* H5_HAVE_FCNTL */ +#endif H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); + #ifndef HDflock /* NOTE: flock(2) is not present on all POSIX systems. * If it is not present, we try a flock() equivalent based on @@ -872,735 +767,720 @@ H5_DLL H5_ATTR_CONST int Nflock(int fd, int operation); #define HDflock(F, L) Pflock(F, L) #else #define HDflock(F, L) Nflock(F, L) -#endif /* H5_HAVE_FLOCK */ +#endif + #endif /* HDflock */ + #ifndef HDfloor #define HDfloor(X) floor(X) -#endif /* HDfloor */ +#endif #ifndef HDfmod #define HDfmod(X, Y) fmod(X, Y) -#endif /* HDfmod */ +#endif #ifndef HDfopen #define HDfopen(S, M) fopen(S, M) -#endif /* HDfopen */ +#endif #ifndef HDfork #define HDfork() fork() -#endif /* HDfork */ +#endif #ifndef HDfprintf #define HDfprintf fprintf #endif #ifndef HDfpathconf #define HDfpathconf(F, N) fpathconf(F, N) -#endif /* HDfpathconf */ +#endif #ifndef HDfputc #define HDfputc(C, F) fputc(C, F) -#endif /* HDfputc */ +#endif #ifndef HDfputs #define HDfputs(S, F) fputs(S, F) -#endif /* HDfputs */ +#endif #ifndef HDfread #define HDfread(M, Z, N, F) fread(M, Z, N, F) -#endif /* HDfread */ +#endif #ifndef HDfree #define HDfree(M) free(M) -#endif /* HDfree */ +#endif #ifndef HDfreopen #define HDfreopen(S, M, F) freopen(S, M, F) -#endif /* HDfreopen */ +#endif #ifndef HDfrexp #define HDfrexp(X, N) frexp(X, N) -#endif /* HDfrexp */ -/* Check for Cray-specific 'frexpf()' and 'frexpl()' routines */ +#endif #ifndef HDfrexpf -#ifdef H5_HAVE_FREXPF #define HDfrexpf(X, N) frexpf(X, N) -#else /* H5_HAVE_FREXPF */ -#define HDfrexpf(X, N) frexp(X, N) -#endif /* H5_HAVE_FREXPF */ -#endif /* HDfrexpf */ +#endif #ifndef HDfrexpl -#ifdef H5_HAVE_FREXPL #define HDfrexpl(X, N) frexpl(X, N) -#else /* H5_HAVE_FREXPL */ -#define HDfrexpl(X, N) frexp(X, N) -#endif /* H5_HAVE_FREXPL */ -#endif /* HDfrexpl */ -/* fscanf() variable arguments */ +#endif +#ifndef HDfscanf +#define HDfscanf fscanf +#endif #ifndef HDfseek #define HDfseek(F, O, W) fseeko(F, O, W) -#endif /* HDfseek */ +#endif #ifndef HDfsetpos #define HDfsetpos(F, P) fsetpos(F, P) -#endif /* HDfsetpos */ +#endif #ifndef HDfstat #define HDfstat(F, B) fstat(F, B) -#endif /* HDfstat */ -#ifndef HDlstat -#define HDlstat(S, B) lstat(S, B) -#endif /* HDlstat */ -#ifndef HDstat -#define HDstat(S, B) stat(S, B) -#endif /* HDstat */ - -#ifndef H5_HAVE_WIN32_API -/* These definitions differ in Windows and are defined in - * H5win32defs for that platform. - */ -typedef struct stat h5_stat_t; -typedef off_t h5_stat_size_t; -#define HDoff_t off_t -#endif /* H5_HAVE_WIN32_API */ - -#define H5_SIZEOF_H5_STAT_SIZE_T H5_SIZEOF_OFF_T - +#endif #ifndef HDftell #define HDftell(F) ftell(F) -#endif /* HDftell */ +#endif #ifndef HDftruncate #define HDftruncate(F, L) ftruncate(F, L) -#endif /* HDftruncate */ +#endif #ifndef HDfwrite #define HDfwrite(M, Z, N, F) fwrite(M, Z, N, F) -#endif /* HDfwrite */ +#endif #ifndef HDgetc #define HDgetc(F) getc(F) -#endif /* HDgetc */ +#endif #ifndef HDgetchar #define HDgetchar() getchar() -#endif /* HDgetchar */ +#endif #ifndef HDgetcwd #define HDgetcwd(S, Z) getcwd(S, Z) -#endif /* HDgetcwd */ +#endif #ifndef HDgetdcwd #define HDgetdcwd(D, S, Z) getcwd(S, Z) -#endif /* HDgetdcwd */ +#endif + +/* Windows only - set to zero on other systems */ #ifndef HDgetdrive #define HDgetdrive() 0 -#endif /* HDgetdrive */ +#endif + #ifndef HDgetegid #define HDgetegid() getegid() -#endif /* HDgetegid() */ +#endif #ifndef HDgetenv #define HDgetenv(S) getenv(S) -#endif /* HDgetenv */ +#endif #ifndef HDgeteuid #define HDgeteuid() geteuid() -#endif /* HDgeteuid */ +#endif #ifndef HDgetgid #define HDgetgid() getgid() -#endif /* HDgetgid */ +#endif #ifndef HDgetgrgid #define HDgetgrgid(G) getgrgid(G) -#endif /* HDgetgrgid */ +#endif #ifndef HDgetgrnam #define HDgetgrnam(S) getgrnam(S) -#endif /* HDgetgrnam */ +#endif #ifndef HDgetgroups #define HDgetgroups(Z, G) getgroups(Z, G) -#endif /* HDgetgroups */ +#endif #ifndef HDgethostbyaddr -#define HDgethostbyaddr(A, B, C) gethostbyaddr((A), (B), (C)) /* mirror VFD */ -#endif /* HDgethostbyaddr */ +#define HDgethostbyaddr(A, B, C) gethostbyaddr((A), (B), (C)) +#endif #ifndef HDgethostname #define HDgethostname(N, L) gethostname(N, L) -#endif /* HDgethostname */ +#endif #ifndef HDgetlogin #define HDgetlogin() getlogin() -#endif /* HDgetlogin */ +#endif #ifndef HDgetpgrp #define HDgetpgrp() getpgrp() -#endif /* HDgetpgrp */ +#endif #ifndef HDgetpid #define HDgetpid() getpid() -#endif /* HDgetpid */ +#endif #ifndef HDgetppid #define HDgetppid() getppid() -#endif /* HDgetppid */ +#endif #ifndef HDgetpwnam #define HDgetpwnam(S) getpwnam(S) -#endif /* HDgetpwnam */ +#endif #ifndef HDgetpwuid #define HDgetpwuid(U) getpwuid(U) -#endif /* HDgetpwuid */ +#endif #ifndef HDgetrusage #define HDgetrusage(X, S) getrusage(X, S) -#endif /* HDgetrusage */ +#endif /* Don't define HDgets - gets() was deprecated in C99 and removed in C11 */ #ifdef HDgets #undef HDgets -#endif /* HDgets */ +#endif #ifndef HDgettimeofday #define HDgettimeofday(S, P) gettimeofday(S, P) -#endif /* HDgettimeofday */ +#endif #ifndef HDclock_gettime #define HDclock_gettime(C, T) clock_gettime(C, T) -#endif /* HDclock_gettime */ +#endif #ifndef HDgetuid #define HDgetuid() getuid() -#endif /* HDgetuid */ +#endif #ifndef HDgmtime #define HDgmtime(T) gmtime(T) -#endif /* HDgmtime */ +#endif #ifndef HDhtonl -#define HDhtonl(X) htonl((X)) /* mirror VFD */ -#endif /* HDhtonl */ +#define HDhtonl(X) htonl((X)) +#endif #ifndef HDhtons -#define HDhtons(X) htons((X)) /* mirror VFD */ -#endif /* HDhtons */ +#define HDhtons(X) htons((X)) +#endif #ifndef HDinet_addr -#define HDinet_addr(C) inet_addr((C)) /* mirror VFD */ -#endif /* HDinet_addr */ +#define HDinet_addr(C) inet_addr((C)) +#endif #ifndef HDinet_ntoa -#define HDinet_ntoa(C) inet_ntoa((C)) /* mirror VFD */ -#endif /* HDinet_ntoa */ +#define HDinet_ntoa(C) inet_ntoa((C)) +#endif #ifndef HDisalnum -#define HDisalnum(C) isalnum((int)(C)) /*cast for solaris warning*/ -#endif /* HDisalnum */ +#define HDisalnum(C) isalnum((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisalpha -#define HDisalpha(C) isalpha((int)(C)) /*cast for solaris warning*/ -#endif /* HDisalpha */ +#define HDisalpha(C) isalpha((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisatty #define HDisatty(F) isatty(F) -#endif /* HDisatty */ +#endif #ifndef HDiscntrl -#define HDiscntrl(C) iscntrl((int)(C)) /*cast for solaris warning*/ -#endif /* HDiscntrl */ +#define HDiscntrl(C) iscntrl((int)(C)) /* Cast for solaris warning */ +#endif #ifndef HDisdigit -#define HDisdigit(C) isdigit((int)(C)) /*cast for solaris warning*/ -#endif /* HDisdigit */ +#define HDisdigit(C) isdigit((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisgraph -#define HDisgraph(C) isgraph((int)(C)) /*cast for solaris warning*/ -#endif /* HDisgraph */ +#define HDisgraph(C) isgraph((int)(C)) /* Cast for Solaris warning*/ +#endif #ifndef HDislower -#define HDislower(C) islower((int)(C)) /*cast for solaris warning*/ -#endif /* HDislower */ +#define HDislower(C) islower((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisnan #define HDisnan(X) isnan(X) -#endif /* HDisnan */ +#endif #ifndef HDisprint -#define HDisprint(C) isprint((int)(C)) /*cast for solaris warning*/ -#endif /* HDisprint */ +#define HDisprint(C) isprint((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDispunct -#define HDispunct(C) ispunct((int)(C)) /*cast for solaris warning*/ -#endif /* HDispunct */ +#define HDispunct(C) ispunct((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisspace -#define HDisspace(C) isspace((int)(C)) /*cast for solaris warning*/ -#endif /* HDisspace */ +#define HDisspace(C) isspace((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisupper -#define HDisupper(C) isupper((int)(C)) /*cast for solaris warning*/ -#endif /* HDisupper */ +#define HDisupper(C) isupper((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDisxdigit -#define HDisxdigit(C) isxdigit((int)(C)) /*cast for solaris warning*/ -#endif /* HDisxdigit */ +#define HDisxdigit(C) isxdigit((int)(C)) /* Cast for Solaris warning */ +#endif #ifndef HDkill #define HDkill(P, S) kill(P, S) -#endif /* HDkill */ +#endif #ifndef HDlabs #define HDlabs(X) labs(X) -#endif /* HDlabs */ +#endif #ifndef HDldexp #define HDldexp(X, N) ldexp(X, N) -#endif /* HDldexp */ +#endif #ifndef HDldiv #define HDldiv(X, Y) ldiv(X, Y) -#endif /* HDldiv */ +#endif #ifndef HDlink #define HDlink(OLD, NEW) link(OLD, NEW) -#endif /* HDlink */ +#endif #ifndef HDlisten -#define HDlisten(A, B) listen((A), (B)) /* mirror VFD */ -#endif /* HDlisten */ +#define HDlisten(A, B) listen((A), (B)) +#endif #ifndef HDllround #define HDllround(V) llround(V) -#endif /* HDround */ +#endif #ifndef HDllroundf #define HDllroundf(V) llroundf(V) -#endif /* HDllroundf */ +#endif #ifndef HDllroundl #define HDllroundl(V) llroundl(V) -#endif /* HDllroundl */ +#endif #ifndef HDlocaleconv #define HDlocaleconv() localeconv() -#endif /* HDlocaleconv */ +#endif #ifndef HDlocaltime #define HDlocaltime(T) localtime(T) -#endif /* HDlocaltime */ +#endif #ifndef HDlog #define HDlog(X) log(X) -#endif /* HDlog */ +#endif #ifndef HDlog10 #define HDlog10(X) log10(X) -#endif /* HDlog10 */ +#endif #ifndef HDlongjmp #define HDlongjmp(J, N) longjmp(J, N) -#endif /* HDlongjmp */ +#endif #ifndef HDlround #define HDlround(V) lround(V) -#endif /* HDround */ +#endif #ifndef HDlroundf #define HDlroundf(V) lroundf(V) -#endif /* HDlroundf */ +#endif #ifndef HDlroundl #define HDlroundl(V) lroundl(V) -#endif /* HDroundl */ +#endif #ifndef HDlseek #define HDlseek(F, O, W) lseek(F, O, W) -#endif /* HDlseek */ +#endif +#ifndef HDlstat +#define HDlstat(S, B) lstat(S, B) +#endif #ifndef HDmalloc #define HDmalloc(Z) malloc(Z) -#endif /* HDmalloc */ +#endif #ifndef HDposix_memalign #define HDposix_memalign(P, A, Z) posix_memalign(P, A, Z) -#endif /* HDposix_memalign */ +#endif #ifndef HDmblen #define HDmblen(S, N) mblen(S, N) -#endif /* HDmblen */ +#endif #ifndef HDmbstowcs #define HDmbstowcs(P, S, Z) mbstowcs(P, S, Z) -#endif /* HDmbstowcs */ +#endif #ifndef HDmbtowc #define HDmbtowc(P, S, Z) mbtowc(P, S, Z) -#endif /* HDmbtowc */ +#endif #ifndef HDmemchr #define HDmemchr(S, C, Z) memchr(S, C, Z) -#endif /* HDmemchr */ +#endif #ifndef HDmemcmp #define HDmemcmp(X, Y, Z) memcmp(X, Y, Z) -#endif /* HDmemcmp */ +#endif #ifndef HDmemcpy #define HDmemcpy(X, Y, Z) memcpy(X, Y, Z) -#endif /* HDmemcpy */ +#endif #ifndef HDmemmove #define HDmemmove(X, Y, Z) memmove((char *)(X), (const char *)(Y), Z) -#endif /* HDmemmove */ +#endif #ifndef HDmemset #define HDmemset(X, C, Z) memset(X, C, Z) -#endif /* HDmemset */ +#endif #ifndef HDmkdir #define HDmkdir(S, M) mkdir(S, M) -#endif /* HDmkdir */ +#endif #ifndef HDmkfifo #define HDmkfifo(S, M) mkfifo(S, M) -#endif /* HDmkfifo */ +#endif #ifndef HDmktime #define HDmktime(T) mktime(T) -#endif /* HDmktime */ +#endif #ifndef HDmodf #define HDmodf(X, Y) modf(X, Y) -#endif /* HDmodf */ +#endif #ifndef HDnanosleep #define HDnanosleep(N, O) nanosleep(N, O) -#endif /* HDnanosleep */ +#endif #ifndef HDntohl -#define HDntohl(A) ntohl((A)) /* mirror VFD */ -#endif /* HDntohl */ +#define HDntohl(A) ntohl((A)) +#endif #ifndef HDntohs -#define HDntohs(A) ntohs((A)) /* mirror VFD */ -#endif /* HDntohs */ +#define HDntohs(A) ntohs((A)) +#endif #ifndef HDopen #define HDopen(F, ...) open(F, __VA_ARGS__) -#endif /* HDopen */ +#endif #ifndef HDopendir #define HDopendir(S) opendir(S) -#endif /* HDopendir */ +#endif #ifndef HDpathconf #define HDpathconf(S, N) pathconf(S, N) -#endif /* HDpathconf */ +#endif #ifndef HDpause #define HDpause() pause() -#endif /* HDpause */ +#endif #ifndef HDperror #define HDperror(S) perror(S) -#endif /* HDperror */ +#endif #ifndef HDpipe #define HDpipe(F) pipe(F) -#endif /* HDpipe */ +#endif #ifndef HDpow #define HDpow(X, Y) pow(X, Y) -#endif /* HDpow */ +#endif #ifndef HDpowf #define HDpowf(X, Y) powf(X, Y) -#endif /* HDpowf */ +#endif #ifndef HDpread #define HDpread(F, B, C, O) pread(F, B, C, O) -#endif /* HDpread */ +#endif #ifndef HDprintf -#define HDprintf printf -#endif /* HDprintf */ +#define HDprintf printf /*varargs*/ +#endif #ifndef HDpthread_attr_destroy #define HDpthread_attr_destroy(A) pthread_attr_destroy(A) -#endif /* HDpthread_attr_destroy */ +#endif #ifndef HDpthread_attr_init #define HDpthread_attr_init(A) pthread_attr_init(A) -#endif /* HDpthread_attr_init */ +#endif #ifndef HDpthread_attr_setscope #define HDpthread_attr_setscope(A, S) pthread_attr_setscope(A, S) -#endif /* HDpthread_attr_setscope */ +#endif #ifndef HDpthread_cond_init #define HDpthread_cond_init(C, A) pthread_cond_init(C, A) -#endif /* HDpthread_cond_init */ +#endif #ifndef HDpthread_cond_signal #define HDpthread_cond_signal(C) pthread_cond_signal(C) -#endif /* HDpthread_cond_signal */ +#endif #ifndef HDpthread_cond_wait #define HDpthread_cond_wait(C, M) pthread_cond_wait(C, M) -#endif /* HDpthread_cond_wait */ +#endif #ifndef HDpthread_create #define HDpthread_create(R, A, F, U) pthread_create(R, A, F, U) -#endif /* HDpthread_create */ +#endif #ifndef HDpthread_equal #define HDpthread_equal(T1, T2) pthread_equal(T1, T2) -#endif /* HDpthread_equal */ +#endif #ifndef HDpthread_getspecific #define HDpthread_getspecific(K) pthread_getspecific(K) -#endif /* HDpthread_getspecific */ +#endif #ifndef HDpthread_join #define HDpthread_join(T, V) pthread_join(T, V) -#endif /* HDpthread_join */ +#endif #ifndef HDpthread_key_create #define HDpthread_key_create(K, D) pthread_key_create(K, D) -#endif /* HDpthread_key_create */ +#endif #ifndef HDpthread_mutex_init #define HDpthread_mutex_init(M, A) pthread_mutex_init(M, A) -#endif /* HDpthread_mutex_init */ +#endif #ifndef HDpthread_mutex_lock #define HDpthread_mutex_lock(M) pthread_mutex_lock(M) -#endif /* HDpthread_mutex_lock */ +#endif #ifndef HDpthread_mutex_unlock #define HDpthread_mutex_unlock(M) pthread_mutex_unlock(M) -#endif /* HDpthread_mutex_unlock */ +#endif #ifndef HDpthread_self #define HDpthread_self() pthread_self() -#endif /* HDpthread_self */ +#endif #ifndef HDpthread_setcancelstate #define HDpthread_setcancelstate(N, O) pthread_setcancelstate(N, O) -#endif /* HDpthread_setcancelstate */ +#endif #ifndef HDpthread_setspecific #define HDpthread_setspecific(K, V) pthread_setspecific(K, V) -#endif /* HDpthread_setspecific */ +#endif #ifndef HDputc #define HDputc(C, F) putc(C, F) -#endif /* HDputc*/ +#endif #ifndef HDputchar #define HDputchar(C) putchar(C) -#endif /* HDputchar */ +#endif #ifndef HDputs #define HDputs(S) puts(S) -#endif /* HDputs */ +#endif #ifndef HDpwrite #define HDpwrite(F, B, C, O) pwrite(F, B, C, O) -#endif /* HDpwrite */ +#endif #ifndef HDqsort #define HDqsort(M, N, Z, F) qsort(M, N, Z, F) -#endif /* HDqsort*/ +#endif #ifndef HDraise #define HDraise(N) raise(N) -#endif /* HDraise */ +#endif +/* clang-format off */ #ifdef H5_HAVE_RAND_R -#ifndef HDrandom -#define HDrandom() HDrand() -#endif /* HDrandom */ -H5_DLL int HDrand(void); -#ifndef HDsrandom -#define HDsrandom(S) HDsrand(S) -#endif /* HDsrandom */ -H5_DLL void HDsrand(unsigned int seed); +# ifndef HDrandom +# define HDrandom() HDrand() +# endif + H5_DLL int HDrand(void); +# ifndef HDsrandom +# define HDsrandom(S) HDsrand(S) +# endif + H5_DLL void HDsrand(unsigned int seed); #elif defined(H5_HAVE_RANDOM) -#ifndef HDrand -#define HDrand() random() -#endif /* HDrand */ -#ifndef HDrandom -#define HDrandom() random() -#endif /* HDrandom */ -#ifndef HDsrand -#define HDsrand(S) srandom(S) -#endif /* HDsrand */ -#ifndef HDsrandom -#define HDsrandom(S) srandom(S) -#endif /* HDsrandom */ -#else /* H5_HAVE_RANDOM */ -#ifndef HDrand -#define HDrand() rand() -#endif /* HDrand */ -#ifndef HDrandom -#define HDrandom() rand() -#endif /* HDrandom */ -#ifndef HDsrand -#define HDsrand(S) srand(S) -#endif /* HDsrand */ -#ifndef HDsrandom -#define HDsrandom(S) srand(S) -#endif /* HDsrandom */ -#endif /* H5_HAVE_RANDOM */ +# ifndef HDrand +# define HDrand() random() +# endif +# ifndef HDrandom +# define HDrandom() random() +# endif +# ifndef HDsrand +# define HDsrand(S) srandom(S) +# endif +# ifndef HDsrandom +# define HDsrandom(S) srandom(S) +# endif +#else +# ifndef HDrand +# define HDrand() rand() +# endif +# ifndef HDrandom +# define HDrandom() rand() +# endif +# ifndef HDsrand +# define HDsrand(S) srand(S) +# endif +# ifndef HDsrandom +# define HDsrandom(S) srand(S) +# endif +#endif +/* clang-format on */ #ifndef HDread #define HDread(F, M, Z) read(F, M, Z) -#endif /* HDread */ +#endif #ifndef HDreaddir #define HDreaddir(D) readdir(D) -#endif /* HDreaddir */ +#endif #ifndef HDrealloc #define HDrealloc(M, Z) realloc(M, Z) -#endif /* HDrealloc */ +#endif #ifndef HDrealpath #define HDrealpath(F1, F2) realpath(F1, F2) -#endif /* HDrealloc */ +#endif #ifndef HDremove #define HDremove(S) remove(S) -#endif /* HDremove */ +#endif #ifndef HDrename #define HDrename(OLD, NEW) rename(OLD, NEW) -#endif /* HDrename */ +#endif #ifndef HDrewind #define HDrewind(F) rewind(F) -#endif /* HDrewind */ +#endif #ifndef HDrewinddir #define HDrewinddir(D) rewinddir(D) -#endif /* HDrewinddir */ +#endif #ifndef HDround #define HDround(V) round(V) -#endif /* HDround */ +#endif #ifndef HDroundf #define HDroundf(V) roundf(V) -#endif /* HDroundf */ +#endif #ifndef HDroundl #define HDroundl(V) roundl(V) -#endif /* HDroundl */ +#endif #ifndef HDrmdir #define HDrmdir(S) rmdir(S) -#endif /* HDrmdir */ -/* scanf() variable arguments */ +#endif +#ifndef HDscanf +#define HDscanf scanf /*varargs*/ +#endif #ifndef HDselect #define HDselect(N, RD, WR, ER, T) select(N, RD, WR, ER, T) -#endif /* HDsetbuf */ +#endif #ifndef HDsetbuf #define HDsetbuf(F, S) setbuf(F, S) -#endif /* HDsetbuf */ +#endif #ifndef HDsetenv #define HDsetenv(N, V, O) setenv(N, V, O) -#endif /* HDsetenv */ +#endif #ifndef HDsetgid #define HDsetgid(G) setgid(G) -#endif /* HDsetgid */ +#endif #ifndef HDsetjmp #define HDsetjmp(J) setjmp(J) -#endif /* HDsetjmp */ +#endif #ifndef HDsetlocale #define HDsetlocale(N, S) setlocale(N, S) -#endif /* HDsetlocale */ +#endif #ifndef HDsetpgid #define HDsetpgid(P, PG) setpgid(P, PG) -#endif /* HDsetpgid */ +#endif #ifndef HDsetsid #define HDsetsid() setsid() -#endif /* HDsetsid */ +#endif #ifndef HDsetsockopt -#define HDsetsockopt(A, B, C, D, E) setsockopt((A), (B), (C), (D), (E)) /* mirror VFD */ -#endif /* HDsetsockopt */ +#define HDsetsockopt(A, B, C, D, E) setsockopt((A), (B), (C), (D), (E)) +#endif #ifndef HDsetuid #define HDsetuid(U) setuid(U) -#endif /* HDsetuid */ +#endif #ifndef HDsetvbuf #define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, Z) -#endif /* HDsetvbuf */ +#endif #ifndef HDshutdown -#define HDshutdown(A, B) shutdown((A), (B)) /* mirror VFD */ -#endif /* HDshutdown */ +#define HDshutdown(A, B) shutdown((A), (B)) +#endif #ifndef HDsigaction #define HDsigaction(S, A, O) sigaction((S), (A), (O)) -#endif /* HDsigaction */ +#endif #ifndef HDsigaddset #define HDsigaddset(S, N) sigaddset(S, N) -#endif /* HDsigaddset */ +#endif #ifndef HDsigdelset #define HDsigdelset(S, N) sigdelset(S, N) -#endif /* HDsigdelset */ +#endif #ifndef HDsigemptyset #define HDsigemptyset(S) sigemptyset(S) -#endif /* HDsigemptyset */ +#endif #ifndef HDsigfillset #define HDsigfillset(S) sigfillset(S) -#endif /* HDsigfillset */ +#endif #ifndef HDsigismember #define HDsigismember(S, N) sigismember(S, N) -#endif /* HDsigismember */ +#endif #ifndef HDsiglongjmp #define HDsiglongjmp(J, N) siglongjmp(J, N) -#endif /* HDsiglongjmp */ +#endif #ifndef HDsignal #define HDsignal(N, F) signal(N, F) -#endif /* HDsignal */ +#endif #ifndef HDsigpending #define HDsigpending(S) sigpending(S) -#endif /* HDsigpending */ +#endif #ifndef HDsigprocmask #define HDsigprocmask(H, S, O) sigprocmask(H, S, O) -#endif /* HDsigprocmask */ +#endif #ifndef HDsigsetjmp #define HDsigsetjmp(J, N) sigsetjmp(J, N) -#endif /* HDsigsetjmp */ +#endif #ifndef HDsigsuspend #define HDsigsuspend(S) sigsuspend(S) -#endif /* HDsigsuspend */ +#endif #ifndef HDsin #define HDsin(X) sin(X) -#endif /* HDsin */ +#endif #ifndef HDsinh #define HDsinh(X) sinh(X) -#endif /* HDsinh */ +#endif #ifndef HDsleep #define HDsleep(N) sleep(N) -#endif /* HDsleep */ +#endif #ifndef HDsnprintf #define HDsnprintf snprintf /*varargs*/ -#endif /* HDsnprintf */ +#endif #ifndef HDsocket -#define HDsocket(A, B, C) socket((A), (B), (C)) /* mirror VFD */ -#endif /* HDsocket */ +#define HDsocket(A, B, C) socket((A), (B), (C)) +#endif #ifndef HDsprintf #define HDsprintf sprintf /*varargs*/ -#endif /* HDsprintf */ +#endif #ifndef HDsqrt #define HDsqrt(X) sqrt(X) -#endif /* HDsqrt */ +#endif #ifndef HDsscanf -#define HDsscanf(S, FMT, ...) sscanf(S, FMT, __VA_ARGS__) -#endif /* HDsscanf */ +#define HDsscanf sscanf /*varargs*/ +#endif +#ifndef HDstat +#define HDstat(S, B) stat(S, B) +#endif #ifndef HDstrcat #define HDstrcat(X, Y) strcat(X, Y) -#endif /* HDstrcat */ +#endif #ifndef HDstrchr #define HDstrchr(S, C) strchr(S, C) -#endif /* HDstrchr */ +#endif #ifndef HDstrcmp #define HDstrcmp(X, Y) strcmp(X, Y) -#endif /* HDstrcmp */ +#endif #ifndef HDstrcasecmp #define HDstrcasecmp(X, Y) strcasecmp(X, Y) -#endif /* HDstrcasecmp */ +#endif #ifndef HDstrcoll #define HDstrcoll(X, Y) strcoll(X, Y) -#endif /* HDstrcoll */ +#endif #ifndef HDstrcpy #define HDstrcpy(X, Y) strcpy(X, Y) -#endif /* HDstrcpy */ +#endif #ifndef HDstrcspn #define HDstrcspn(X, Y) strcspn(X, Y) -#endif /* HDstrcspn */ +#endif #ifndef HDstrdup #define HDstrdup(S) strdup(S) -#endif /* HDstrdup */ +#endif #ifndef HDstrerror #define HDstrerror(N) strerror(N) -#endif /* HDstrerror */ +#endif #ifndef HDstrftime #define HDstrftime(S, Z, F, T) strftime(S, Z, F, T) -#endif /* HDstrftime */ +#endif #ifndef HDstrlen #define HDstrlen(S) strlen(S) -#endif /* HDstrlen */ +#endif #ifndef HDstrncat #define HDstrncat(X, Y, Z) strncat(X, Y, Z) -#endif /* HDstrncat */ +#endif #ifndef HDstrncmp #define HDstrncmp(X, Y, Z) strncmp(X, Y, Z) -#endif /* HDstrncmp */ +#endif #ifndef HDstrncpy #define HDstrncpy(X, Y, Z) strncpy(X, Y, Z) -#endif /* HDstrncpy */ +#endif #ifndef HDstrpbrk #define HDstrpbrk(X, Y) strpbrk(X, Y) -#endif /* HDstrpbrk */ +#endif #ifndef HDstrrchr #define HDstrrchr(S, C) strrchr(S, C) -#endif /* HDstrrchr */ +#endif #ifndef HDstrspn #define HDstrspn(X, Y) strspn(X, Y) -#endif /* HDstrspn */ +#endif #ifndef HDstrstr #define HDstrstr(X, Y) strstr(X, Y) -#endif /* HDstrstr */ +#endif #ifndef HDstrtod #define HDstrtod(S, R) strtod(S, R) -#endif /* HDstrtod */ +#endif #ifndef HDstrtok #define HDstrtok(X, Y) strtok(X, Y) -#endif /* HDstrtok */ +#endif #ifndef HDstrtok_r #define HDstrtok_r(X, Y, Z) strtok_r(X, Y, Z) -#endif /* HDstrtok */ +#endif #ifndef HDstrtol #define HDstrtol(S, R, N) strtol(S, R, N) -#endif /* HDstrtol */ +#endif #ifndef HDstrtoll -#ifdef H5_HAVE_STRTOLL #define HDstrtoll(S, R, N) strtoll(S, R, N) -#else -H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); -#endif /* H5_HAVE_STRTOLL */ -#endif /* HDstrtoll */ +#endif #ifndef HDstrtoul #define HDstrtoul(S, R, N) strtoul(S, R, N) -#endif /* HDstrtoul */ +#endif #ifndef HDstrtoull #define HDstrtoull(S, R, N) strtoull(S, R, N) -#endif /* HDstrtoul */ +#endif #ifndef HDstrtoumax #define HDstrtoumax(S, R, N) strtoumax(S, R, N) -#endif /* HDstrtoumax */ +#endif #ifndef HDstrxfrm #define HDstrxfrm(X, Y, Z) strxfrm(X, Y, Z) -#endif /* HDstrxfrm */ -#ifdef H5_HAVE_SYMLINK +#endif #ifndef HDsymlink #define HDsymlink(F1, F2) symlink(F1, F2) -#endif /* HDsymlink */ -#endif /* H5_HAVE_SYMLINK */ +#endif #ifndef HDsysconf #define HDsysconf(N) sysconf(N) -#endif /* HDsysconf */ +#endif #ifndef HDsystem #define HDsystem(S) system(S) -#endif /* HDsystem */ +#endif #ifndef HDtan #define HDtan(X) tan(X) -#endif /* HDtan */ +#endif #ifndef HDtanh #define HDtanh(X) tanh(X) -#endif /* HDtanh */ +#endif #ifndef HDtcdrain #define HDtcdrain(F) tcdrain(F) -#endif /* HDtcdrain */ +#endif #ifndef HDtcflow #define HDtcflow(F, A) tcflow(F, A) -#endif /* HDtcflow */ +#endif #ifndef HDtcflush #define HDtcflush(F, N) tcflush(F, N) -#endif /* HDtcflush */ +#endif #ifndef HDtcgetattr #define HDtcgetattr(F, T) tcgetattr(F, T) -#endif /* HDtcgetattr */ +#endif #ifndef HDtcgetpgrp #define HDtcgetpgrp(F) tcgetpgrp(F) -#endif /* HDtcgetpgrp */ +#endif #ifndef HDtcsendbreak #define HDtcsendbreak(F, N) tcsendbreak(F, N) -#endif /* HDtcsendbreak */ +#endif #ifndef HDtcsetattr #define HDtcsetattr(F, O, T) tcsetattr(F, O, T) -#endif /* HDtcsetattr */ +#endif #ifndef HDtcsetpgrp #define HDtcsetpgrp(F, N) tcsetpgrp(F, N) -#endif /* HDtcsetpgrp */ +#endif #ifndef HDtime #define HDtime(T) time(T) -#endif /* HDtime */ +#endif #ifndef HDtimes #define HDtimes(T) times(T) -#endif /* HDtimes*/ +#endif + #ifndef HDtimespeccmp #ifdef H5_HAVE_TIMESPECCMP #define HDtimespeccmp(tsp, usp, cmp) timespeccmp(tsp, usp, cmp) @@ -1608,89 +1488,92 @@ H5_DLL int64_t HDstrtoll(const char *s, const char **rest, int base); #define HDtimespeccmp(tsp, usp, cmp) \ (((tsp)->tv_sec == (usp)->tv_sec) ? ((tsp)->tv_nsec cmp(usp)->tv_nsec) : ((tsp)->tv_sec cmp(usp)->tv_sec)) #endif -#endif /* HDtimespeccmp */ +#endif + #ifndef HDtmpfile #define HDtmpfile() tmpfile() -#endif /* HDtmpfile */ +#endif #ifndef HDtmpnam #define HDtmpnam(S) tmpnam(S) -#endif /* HDtmpnam */ +#endif #ifndef HDtolower #define HDtolower(C) tolower(C) -#endif /* HDtolower */ +#endif #ifndef HDtoupper #define HDtoupper(C) toupper(C) -#endif /* HDtoupper */ +#endif #ifndef HDttyname #define HDttyname(F) ttyname(F) -#endif /* HDttyname */ +#endif #ifndef HDtzset #define HDtzset() tzset() -#endif /* HDtzset */ +#endif #ifndef HDumask #define HDumask(N) umask(N) -#endif /* HDumask */ +#endif #ifndef HDuname #define HDuname(S) uname(S) -#endif /* HDuname */ +#endif #ifndef HDungetc #define HDungetc(C, F) ungetc(C, F) -#endif /* HDungetc */ +#endif #ifndef HDunlink #define HDunlink(S) unlink(S) -#endif /* HDunlink */ +#endif #ifndef HDunsetenv #define HDunsetenv(S) unsetenv(S) -#endif /* HDsetenv */ +#endif #ifndef HDutime #define HDutime(S, T) utime(S, T) -#endif /* HDutime */ +#endif + #ifndef HDvasprintf #ifdef H5_HAVE_VASPRINTF #define HDvasprintf(RET, FMT, A) vasprintf(RET, FMT, A) #else -H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); -#endif /* H5_HAVE_VASPRINTF */ -#endif /* HDvasprintf */ +H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); +#endif +#endif + #ifndef HDva_arg #define HDva_arg(A, T) va_arg(A, T) -#endif /* HDva_arg */ +#endif #ifndef HDva_copy #define HDva_copy(D, S) va_copy(D, S) -#endif /* HDva_copy */ +#endif #ifndef HDva_end #define HDva_end(A) va_end(A) -#endif /* HDva_end */ +#endif #ifndef HDva_start #define HDva_start(A, P) va_start(A, P) -#endif /* HDva_start */ +#endif #ifndef HDvfprintf #define HDvfprintf(F, FMT, A) vfprintf(F, FMT, A) -#endif /* HDvfprintf */ +#endif #ifndef HDvprintf #define HDvprintf(FMT, A) vprintf(FMT, A) -#endif /* HDvprintf */ +#endif #ifndef HDvsprintf #define HDvsprintf(S, FMT, A) vsprintf(S, FMT, A) -#endif /* HDvsprintf */ +#endif #ifndef HDvsnprintf #define HDvsnprintf(S, N, FMT, A) vsnprintf(S, N, FMT, A) -#endif /* HDvsnprintf */ +#endif #ifndef HDwait #define HDwait(W) wait(W) -#endif /* HDwait */ +#endif #ifndef HDwaitpid #define HDwaitpid(P, W, O) waitpid(P, W, O) -#endif /* HDwaitpid */ +#endif #ifndef HDwcstombs #define HDwcstombs(S, P, Z) wcstombs(S, P, Z) -#endif /* HDwcstombs */ +#endif #ifndef HDwctomb #define HDwctomb(S, C) wctomb(S, C) -#endif /* HDwctomb */ +#endif #ifndef HDwrite #define HDwrite(F, M, Z) write(F, M, Z) -#endif /* HDwrite */ +#endif /* Macro for "stringizing" an integer in the C preprocessor (use H5_TOSTRING) */ /* (use H5_TOSTRING, H5_STRINGIZE is just part of the implementation) */ @@ -1819,15 +1702,6 @@ H5_DLL int HDvasprintf(char **bufp, const char *fmt, va_list _ap); #define H5_COLON_SEPC ':' -/* Use FUNC to safely handle variations of C99 __func__ keyword handling */ -#ifdef H5_HAVE_C99_FUNC -#define FUNC __func__ -#elif defined(H5_HAVE_FUNCTION) -#define FUNC __FUNCTION__ -#else -#error "We need __func__ or __FUNCTION__ to test function names!" -#endif - /* * These macros check whether debugging has been requested for a certain * package at run-time. Code for debugging is conditionally compiled by @@ -1908,51 +1782,52 @@ extern char H5libhdf5_settings[]; /* embedded library information */ #define H5TRACE0(R, T) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T) + CALLTIME = H5_trace(NULL, __func__, T) #define H5TRACE1(R, T, A0) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0) #define H5TRACE2(R, T, A0, A1) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1) #define H5TRACE3(R, T, A0, A1, A2) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2) #define H5TRACE4(R, T, A0, A1, A2, A3) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3) #define H5TRACE5(R, T, A0, A1, A2, A3, A4) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4) #define H5TRACE6(R, T, A0, A1, A2, A3, A4, A5) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5) #define H5TRACE7(R, T, A0, A1, A2, A3, A4, A5, A6) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6) #define H5TRACE8(R, T, A0, A1, A2, A3, A4, A5, A6, A7) \ - RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, A7) + RTYPE = R; \ + CALLTIME = \ + H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, A7) #define H5TRACE9(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \ - A7, #A8, A8) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \ + #A7, A7, #A8, A8) #define H5TRACE10(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \ - A7, #A8, A8, #A9, A9) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \ + #A7, A7, #A8, A8, #A9, A9) #define H5TRACE11(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \ - A7, #A8, A8, #A9, A9, #A10, A10) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \ + #A7, A7, #A8, A8, #A9, A9, #A10, A10) #define H5TRACE12(R, T, A0, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11) \ RTYPE = R; \ - CALLTIME = H5_trace(NULL, FUNC, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, #A7, \ - A7, #A8, A8, #A9, A9, #A10, A10, #A11, A11) + CALLTIME = H5_trace(NULL, __func__, T, #A0, A0, #A1, A1, #A2, A2, #A3, A3, #A4, A4, #A5, A5, #A6, A6, \ + #A7, A7, #A8, A8, #A9, A9, #A10, A10, #A11, A11) #define H5TRACE_RETURN(V) \ if (RTYPE) { \ - H5_trace(&CALLTIME, FUNC, RTYPE, NULL, V); \ + H5_trace(&CALLTIME, __func__, RTYPE, NULL, V); \ RTYPE = NULL; \ } #else @@ -2123,7 +1998,7 @@ extern hbool_t H5_libterm_g; /* Is the library being shutdown? */ /* Include required function stack header */ #include "H5CSprivate.h" -#define H5_PUSH_FUNC H5CS_push(FUNC); +#define H5_PUSH_FUNC H5CS_push(__func__); #define H5_POP_FUNC H5CS_pop(); #else /* H5_HAVE_CODESTACK */ #define H5_PUSH_FUNC /* void */ @@ -2208,7 +2083,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); #define FUNC_ENTER_API_COMMON \ FUNC_ENTER_API_VARS \ - FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_API(__func__)); \ FUNC_ENTER_API_THREADSAFE; #define FUNC_ENTER_API_INIT(err) \ @@ -2327,7 +2202,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ { \ FUNC_ENTER_API_VARS \ - FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_API(__func__)); \ FUNC_ENTER_API_THREADSAFE; \ BEGIN_MPE_LOG \ { @@ -2344,7 +2219,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ { \ { \ - FUNC_ENTER_COMMON(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_API(__func__)); \ FUNC_ENTER_API_THREADSAFE; \ FUNC_ENTER_API_INIT(err); \ { @@ -2363,7 +2238,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ { \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_API(__func__)); \ { /* Note: this macro only works when there's _no_ interface initialization routine for the module */ @@ -2377,14 +2252,14 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* Use this macro for all "normal" non-API functions */ #define FUNC_ENTER_NOAPI(err) \ { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ FUNC_ENTER_NOAPI_INIT(err) \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for all non-API functions, which propagate errors, but don't issue them */ #define FUNC_ENTER_NOAPI_NOERR \ { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \ FUNC_ENTER_NOAPI_INIT(-) \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2398,7 +2273,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); */ #define FUNC_ENTER_NOAPI_NOINIT \ { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2413,7 +2288,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); */ #define FUNC_ENTER_NOAPI_NOINIT_NOERR \ { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2425,7 +2300,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); */ #define FUNC_ENTER_NOAPI_NOFS \ { \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ \ /* Initialize the package, if appropriate */ \ H5_PACKAGE_INIT(H5_MY_PKG_INIT, err) \ @@ -2442,7 +2317,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); */ #define FUNC_ENTER_NOAPI_NOERR_NOFS \ { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* @@ -2454,7 +2329,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); */ #define FUNC_ENTER_NOAPI_NAMECHECK_ONLY \ { \ - FUNC_ENTER_COMMON_NOERR(!H5_IS_API(FUNC)); + FUNC_ENTER_COMMON_NOERR(!H5_IS_API(__func__)); /* Use the following two macros as replacements for the FUNC_ENTER_NOAPI * and FUNC_ENTER_NOAPI_NOINIT macros when the function needs to set @@ -2463,7 +2338,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ haddr_t prev_tag = HADDR_UNDEF; \ \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ H5AC_tag(tag, &prev_tag); \ FUNC_ENTER_NOAPI_INIT(err) \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2472,7 +2347,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ haddr_t prev_tag = HADDR_UNDEF; \ \ - FUNC_ENTER_COMMON(!H5_IS_API(FUNC)); \ + FUNC_ENTER_COMMON(!H5_IS_API(__func__)); \ H5AC_tag(tag, &prev_tag); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2480,14 +2355,14 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* Use this macro for all "normal" package-level functions */ #define FUNC_ENTER_PACKAGE \ { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for package-level functions which propgate errors, but don't issue them */ #define FUNC_ENTER_PACKAGE_NOERR \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2497,7 +2372,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ haddr_t prev_tag = HADDR_UNDEF; \ \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5AC_tag(tag, &prev_tag); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2505,14 +2380,14 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* Use this macro for all "normal" staticly-scoped functions */ #define FUNC_ENTER_STATIC \ { \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* Use this macro for staticly-scoped functions which propgate errors, but don't issue them */ #define FUNC_ENTER_STATIC_NOERR \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2520,7 +2395,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); /* And that shouldn't push their name on the function stack */ #define FUNC_ENTER_STATIC_NOERR_NOFS \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { /* @@ -2532,7 +2407,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); */ #define FUNC_ENTER_STATIC_NAMECHECK_ONLY \ { \ - FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(FUNC)); + FUNC_ENTER_COMMON_NOERR(H5_IS_PKG(__func__)); /* Use the following macro as replacement for the FUNC_ENTER_STATIC * macro when the function needs to set up a metadata tag. */ @@ -2540,7 +2415,7 @@ H5_DLL herr_t H5CX_pop(hbool_t update_dxpl_props); { \ haddr_t prev_tag = HADDR_UNDEF; \ \ - FUNC_ENTER_COMMON(H5_IS_PKG(FUNC)); \ + FUNC_ENTER_COMMON(H5_IS_PKG(__func__)); \ H5AC_tag(tag, &prev_tag); \ H5_PUSH_FUNC \ if (H5_PKG_INIT_VAR || !H5_TERM_GLOBAL) { @@ -2770,6 +2645,57 @@ H5_DLL herr_t H5_combine_path(const char *path1, const char *path2, char **full_ H5_DLL herr_t H5_dirname(const char *path, char **dirname /*out*/); H5_DLL herr_t H5_basename(const char *path, char **basename /*out*/); +/* getopt(3) equivalent that papers over the lack of long options on BSD + * and lack of Windows support. + */ +H5_DLLVAR int H5_opterr; /* get_option prints errors if this is on */ +H5_DLLVAR int H5_optind; /* token pointer */ +H5_DLLVAR const char *H5_optarg; /* flag argument (or value) */ + +enum h5_arg_level { + no_arg = 0, /* doesn't take an argument */ + require_arg, /* requires an argument */ + optional_arg /* argument is optional */ +}; + +/* + * get_option determines which options are specified on the command line and + * returns a pointer to any arguments possibly associated with the option in + * the ``H5_optarg'' variable. get_option returns the shortname equivalent of + * the option. The long options are specified in the following way: + * + * struct h5_long_options foo[] = { + * { "filename", require_arg, 'f' }, + * { "append", no_arg, 'a' }, + * { "width", require_arg, 'w' }, + * { NULL, 0, 0 } + * }; + * + * Long named options can have arguments specified as either: + * + * ``--param=arg'' or ``--param arg'' + * + * Short named options can have arguments specified as either: + * + * ``-w80'' or ``-w 80'' + * + * and can have more than one short named option specified at one time: + * + * -aw80 + * + * in which case those options which expect an argument need to come at the + * end. + */ +struct h5_long_options { + const char * name; /* Name of the long option */ + enum h5_arg_level has_arg; /* Whether we should look for an arg */ + char shortval; /* The shortname equivalent of long arg + * this gets returned from get_option + */ +}; + +H5_DLL int H5_get_option(int argc, const char **argv, const char *opt, const struct h5_long_options *l_opt); + #ifdef H5_HAVE_PARALLEL /* Generic MPI functions */ H5_DLL hsize_t H5_mpi_set_bigio_count(hsize_t new_count); diff --git a/src/H5public.h b/src/H5public.h index cef15d9..e192de0 100644 --- a/src/H5public.h +++ b/src/H5public.h @@ -35,22 +35,23 @@ #include <features.h> /* For setting POSIX, BSD, etc. compatibility */ #endif -#ifdef H5_HAVE_SYS_TYPES_H -#include <sys/types.h> -#endif - -#include <limits.h> /* For H5T_NATIVE_CHAR defn in H5Tpublic.h */ -#include <stdarg.h> /* For variadic functions in H5VLpublic.h */ - -#include <stdint.h> /* For C9x types */ - +/* C library header files for things that appear in HDF5 public headers */ #ifdef __cplusplus #define __STDC_FORMAT_MACROS #endif -#include <inttypes.h> /* C99/POSIX.1 header for uint64_t, PRIu64 */ - -#ifdef H5_HAVE_STDDEF_H +#include <inttypes.h> +#include <limits.h> +#include <stdarg.h> +#include <stdbool.h> #include <stddef.h> +#include <stdint.h> + +/* Unlike most sys/ headers, which are POSIX-only, sys/types.h is avaible + * on Windows, though it doesn't necessarily contain all the POSIX types + * we need for HDF5 (e.g. ssize_t). + */ +#ifdef H5_HAVE_SYS_TYPES_H +#include <sys/types.h> #endif #ifdef H5_HAVE_PARALLEL @@ -192,7 +193,6 @@ typedef int herr_t; * } * \endcode */ -#include <stdbool.h> typedef bool hbool_t; typedef int htri_t; diff --git a/src/H5system.c b/src/H5system.c index 879c003..dcb77dd 100644 --- a/src/H5system.c +++ b/src/H5system.c @@ -97,131 +97,6 @@ HDvasprintf(char **bufp, const char *fmt, va_list _ap) #endif /* H5_HAVE_VASPRINTF */ /*------------------------------------------------------------------------- - * Function: HDstrtoll - * - * Purpose: Converts the string S to an int64_t value according to the - * given BASE, which must be between 2 and 36 inclusive, or be - * the special value zero. - * - * The string must begin with an arbitrary amount of white space - * (as determined by isspace(3c)) followed by a single optional - * `+' or `-' sign. If BASE is zero or 16 the string may then - * include a `0x' or `0X' prefix, and the number will be read in - * base 16; otherwise a zero BASE is taken as 10 (decimal) - * unless the next character is a `0', in which case it is taken - * as 8 (octal). - * - * The remainder of the string is converted to an int64_t in the - * obvious manner, stopping at the first character which is not - * a valid digit in the given base. (In bases above 10, the - * letter `A' in either upper or lower case represetns 10, `B' - * represents 11, and so forth, with `Z' representing 35.) - * - * If REST is not null, the address of the first invalid - * character in S is stored in *REST. If there were no digits - * at all, the original value of S is stored in *REST. Thus, if - * *S is not `\0' but **REST is `\0' on return the entire string - * was valid. - * - * Return: Success: The result. - * - * Failure: If the input string does not contain any - * digits then zero is returned and REST points - * to the original value of S. If an overflow - * or underflow occurs then the maximum or - * minimum possible value is returned and the - * global `errno' is set to ERANGE. If BASE is - * incorrect then zero is returned. - * - * Programmer: Robb Matzke - * Thursday, April 9, 1998 - * - *------------------------------------------------------------------------- - */ -#ifndef HDstrtoll -int64_t -HDstrtoll(const char *s, const char **rest, int base) -{ - int64_t sign = 1, acc = 0; - hbool_t overflow = FALSE; - - errno = 0; - if (!s || (base && (base < 2 || base > 36))) { - if (rest) - *rest = s; - return 0; - } - - /* Skip white space */ - while (HDisspace(*s)) - s++; - - /* Optional minus or plus sign */ - if ('+' == *s) { - s++; - } - else if ('-' == *s) { - sign = -1; - s++; - } - - /* Zero base prefix */ - if (0 == base && '0' == *s && ('x' == s[1] || 'X' == s[1])) { - base = 16; - s += 2; - } - else if (0 == base && '0' == *s) { - base = 8; - s++; - } - else if (0 == base) { - base = 10; - } - - /* Digits */ - while ((base <= 10 && *s >= '0' && *s < '0' + base) || - (base > 10 && ((*s >= '0' && *s <= '9') || (*s >= 'a' && *s < 'a' + base - 10) || - (*s >= 'A' && *s < 'A' + base - 10)))) { - if (!overflow) { - int64_t digit = 0; - - if (*s >= '0' && *s <= '9') - digit = *s - '0'; - else if (*s >= 'a' && *s <= 'z') - digit = (*s - 'a') + 10; - else - digit = (*s - 'A') + 10; - - if (acc * base + digit < acc) { - overflow = TRUE; - } - else { - acc = acc * base + digit; - } - } - s++; - } - - /* Overflow */ - if (overflow) { - if (sign > 0) { - acc = ((uint64_t)1 << (8 * sizeof(int64_t) - 1)) - 1; - } - else { - acc = (int64_t)((uint64_t)1 << (8 * sizeof(int64_t) - 1)); - } - errno = ERANGE; - } - - /* Return values */ - acc *= sign; - if (rest) - *rest = s; - return acc; -} /* end HDstrtoll() */ -#endif - -/*------------------------------------------------------------------------- * Function: HDrand/HDsrand * * Purpose: Wrapper function for rand. If rand_r exists on this system, @@ -1201,3 +1076,167 @@ done: FUNC_LEAVE_NOAPI(ret_value) } /* end H5_basename() */ + +/* Global variables */ +int H5_opterr = 1; /* Get_option prints errors if this is on */ +int H5_optind = 1; /* Token pointer */ +const char *H5_optarg; /* Flag argument (or value) */ + +/*------------------------------------------------------------------------- + * Function: H5_get_option + * + * Purpose: Determine the command-line options a user specified. We can + * accept both short and long type command-lines. + * + * Return: Success: The short valued "name" of the command line + * parameter or EOF if there are no more + * parameters to process. + * + * Failure: A question mark. + *------------------------------------------------------------------------- + */ +int +H5_get_option(int argc, const char **argv, const char *opts, const struct h5_long_options *l_opts) +{ + static int sp = 1; /* character index in current token */ + int optopt = '?'; /* option character passed back to user */ + + if (sp == 1) { + /* check for more flag-like tokens */ + if (H5_optind >= argc || argv[H5_optind][0] != '-' || argv[H5_optind][1] == '\0') { + return EOF; + } + else if (HDstrcmp(argv[H5_optind], "--") == 0) { + H5_optind++; + return EOF; + } + } + + if (sp == 1 && argv[H5_optind][0] == '-' && argv[H5_optind][1] == '-') { + /* long command line option */ + int i; + const char ch = '='; + char * arg = HDstrdup(&argv[H5_optind][2]); + size_t arg_len = 0; + + H5_optarg = strchr(&argv[H5_optind][2], ch); + arg_len = HDstrlen(&argv[H5_optind][2]); + if (H5_optarg) { + arg_len -= HDstrlen(H5_optarg); + H5_optarg++; /* skip the equal sign */ + } + arg[arg_len] = 0; + + for (i = 0; l_opts && l_opts[i].name; i++) { + if (HDstrcmp(arg, l_opts[i].name) == 0) { + /* we've found a matching long command line flag */ + optopt = l_opts[i].shortval; + + if (l_opts[i].has_arg != no_arg) { + if (H5_optarg == NULL) { + if (l_opts[i].has_arg != optional_arg) { + if (H5_optind < (argc - 1)) + if (argv[H5_optind + 1][0] != '-') + H5_optarg = argv[++H5_optind]; + } + else if (l_opts[i].has_arg == require_arg) { + if (H5_opterr) + HDfprintf(stderr, "%s: option required for \"--%s\" flag\n", argv[0], arg); + + optopt = '?'; + } + } + } + else { + if (H5_optarg) { + if (H5_opterr) + HDfprintf(stderr, "%s: no option required for \"%s\" flag\n", argv[0], arg); + + optopt = '?'; + } + } + break; + } + } + + if (l_opts[i].name == NULL) { + /* exhausted all of the l_opts we have and still didn't match */ + if (H5_opterr) + HDfprintf(stderr, "%s: unknown option \"%s\"\n", argv[0], arg); + + optopt = '?'; + } + + H5_optind++; + sp = 1; + + HDfree(arg); + } + else { + register char *cp; /* pointer into current token */ + + /* short command line option */ + optopt = argv[H5_optind][sp]; + + if (optopt == ':' || (cp = HDstrchr(opts, optopt)) == 0) { + if (H5_opterr) + HDfprintf(stderr, "%s: unknown option \"%c\"\n", argv[0], optopt); + + /* if no chars left in this token, move to next token */ + if (argv[H5_optind][++sp] == '\0') { + H5_optind++; + sp = 1; + } + return '?'; + } + + if (*++cp == ':') { + /* if a value is expected, get it */ + if (argv[H5_optind][sp + 1] != '\0') { + /* flag value is rest of current token */ + H5_optarg = &argv[H5_optind++][sp + 1]; + } + else if (++H5_optind >= argc) { + if (H5_opterr) + HDfprintf(stderr, "%s: value expected for option \"%c\"\n", argv[0], optopt); + + optopt = '?'; + } + else { + /* flag value is next token */ + H5_optarg = argv[H5_optind++]; + } + + sp = 1; + } + /* wildcard argument */ + else if (*cp == '*') { + /* check the next argument */ + H5_optind++; + /* we do have an extra argument, check if not last */ + if ((H5_optind + 1) < argc) { + if (argv[H5_optind][0] != '-') { + H5_optarg = argv[H5_optind++]; + } + else { + H5_optarg = NULL; + } + } + else { + H5_optarg = NULL; + } + } + else { + /* set up to look at next char in token, next time */ + if (argv[H5_optind][++sp] == '\0') { + /* no more in current token, so setup next token */ + H5_optind++; + sp = 1; + } + H5_optarg = NULL; + } + } + + /* return the current flag character found */ + return optopt; +} diff --git a/src/H5win32defs.h b/src/H5win32defs.h index 26bca67..030b65b 100644 --- a/src/H5win32defs.h +++ b/src/H5win32defs.h @@ -29,23 +29,35 @@ typedef struct _stati64 h5_stat_t; typedef __int64 h5_stat_size_t; -#define HDaccess(F, M) _access(F, M) -#define HDchdir(S) _chdir(S) -#define HDclose(F) _close(F) -#define HDcreat(S, M) Wopen_utf8(S, O_CREAT | O_TRUNC | O_RDWR, M) -#define HDdup(F) _dup(F) -#define HDfdopen(N, S) _fdopen(N, S) -#define HDfileno(F) _fileno(F) -#define HDfstat(F, B) _fstati64(F, B) -#define HDisatty(F) _isatty(F) +#ifdef H5_HAVE_VISUAL_STUDIO -#define HDgetcwd(S, Z) _getcwd(S, Z) -#define HDgetdcwd(D, S, Z) _getdcwd(D, S, Z) -#define HDgetdrive() _getdrive() -#define HDlseek(F, O, W) _lseeki64(F, O, W) -#define HDlstat(S, B) _lstati64(S, B) -#define HDmkdir(S, M) _mkdir(S) -#define HDoff_t __int64 +struct timezone { + int tz_minuteswest; + int tz_dsttime; +}; + +#endif /* H5_HAVE_VISUAL_STUDIO */ + +#define HDaccess(F, M) _access(F, M) +#define HDchdir(S) _chdir(S) +#define HDclose(F) _close(F) +#define HDcreat(S, M) Wopen_utf8(S, O_CREAT | O_TRUNC | O_RDWR, M) +#define HDdup(F) _dup(F) +#define HDfdopen(N, S) _fdopen(N, S) +#define HDfileno(F) _fileno(F) +#define HDflock(F, L) Wflock(F, L) +#define HDfstat(F, B) _fstati64(F, B) +#define HDgetcwd(S, Z) _getcwd(S, Z) +#define HDgetdcwd(D, S, Z) _getdcwd(D, S, Z) +#define HDgetdrive() _getdrive() +#define HDgetlogin() Wgetlogin() +#define HDgettimeofday(V, Z) Wgettimeofday(V, Z) +#define HDisatty(F) _isatty(F) +#define HDlseek(F, O, W) _lseeki64(F, O, W) +#define HDlstat(S, B) _lstati64(S, B) +#define HDmemset(X, C, Z) memset((void *)(X), C, Z) /* Cast avoids MSVC warning */ +#define HDmkdir(S, M) _mkdir(S) +#define HDoff_t __int64 /* Note that the variadic HDopen macro is using a VC++ extension * where the comma is dropped if nothing is passed to the ellipsis. @@ -55,9 +67,11 @@ typedef __int64 h5_stat_size_t; #else #define HDopen(S, F, ...) Wopen_utf8(S, F, ##__VA_ARGS__) #endif + #define HDread(F, M, Z) _read(F, M, Z) #define HDremove(S) Wremove_utf8(S) #define HDrmdir(S) _rmdir(S) +#define HDsetenv(N, V, O) Wsetenv(N, V, O) #define HDsetvbuf(F, S, M, Z) setvbuf(F, S, M, (Z > 1 ? Z : 2)) #define HDsleep(S) Sleep(S * 1000) #define HDstat(S, B) _stati64(S, B) @@ -66,21 +80,13 @@ typedef __int64 h5_stat_size_t; #define HDstrtok_r(X, Y, Z) strtok_s(X, Y, Z) #define HDtzset() _tzset() #define HDunlink(S) _unlink(S) +#define HDunsetenv(N, V, O) Wsetenv(N, "", 1) #define HDwrite(F, M, Z) _write(F, M, Z) -#ifdef H5_HAVE_VISUAL_STUDIO - -/* - * The (void*) cast just avoids a compiler warning in MSVC - */ -#define HDmemset(X, C, Z) memset((void *)(X), C, Z) - -struct timezone { - int tz_minuteswest; - int tz_dsttime; -}; - -#endif /* H5_HAVE_VISUAL_STUDIO */ +#ifndef H5_HAVE_MINGW +#define HDftruncate(F, L) _chsize_s(F, L) +#define HDfseek(F, O, W) _fseeki64(F, O, W) +#endif /* H5_HAVE_MINGW */ #ifdef __cplusplus extern "C" { @@ -98,17 +104,4 @@ H5_DLL int H5_get_win32_times(H5_timevals_t *tvs); } #endif /* __cplusplus */ -#define HDgettimeofday(V, Z) Wgettimeofday(V, Z) -#define HDsetenv(N, V, O) Wsetenv(N, V, O) -#define HDunsetenv(N, V, O) Wsetenv(N, "", 1) -#define HDflock(F, L) Wflock(F, L) -#define HDgetlogin() Wgetlogin() - -/* Non-POSIX functions */ - -#ifndef H5_HAVE_MINGW -#define HDftruncate(F, L) _chsize_s(F, L) -#define HDfseek(F, O, W) _fseeki64(F, O, W) -#endif /* H5_HAVE_MINGW */ - #endif /* H5_HAVE_WIN32_API */ |