Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/locking_protocol' into ts_h5fl_reg
Browse files Browse the repository at this point in the history
  • Loading branch information
qkoziol committed Dec 18, 2024
2 parents a583a12 + 4050130 commit 401bed4
Show file tree
Hide file tree
Showing 43 changed files with 1,373 additions and 1,342 deletions.
4 changes: 2 additions & 2 deletions .clang-format
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ IndentCaseLabels: true
IndentGotoLabels: false
#llvm11: IndentExternBlock: AfterExternBlock
#llvm11: InsertTrailingCommas: None
MacroBlockBegin: "^_BEFORE_USER_CB"
MacroBlockEnd: "^_AFTER_USER_CB"
MacroBlockBegin: "^H5_BEFORE_USER_CB*|^H5E_PAUSE_ERRORS"
MacroBlockEnd: "^H5_AFTER_USER_CB*|^H5E_RESUME_ERRORS"
ObjCBlockIndentWidth: 4
#llvm11: ObjCBreakBeforeNestedBlockParam: true
ReflowComments: true
Expand Down
8 changes: 4 additions & 4 deletions src/H5.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,10 @@ H5_term_library(void)

/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB_NOCHECK
{
/* Invoke callback, providing context */
(*curr_atclose->func)(curr_atclose->ctx);
}
{
/* Invoke callback, providing context */
(*curr_atclose->func)(curr_atclose->ctx);
}
H5_AFTER_USER_CB_NOCHECK

/* Advance to next node and free this one */
Expand Down
20 changes: 10 additions & 10 deletions src/H5Adense.c
Original file line number Diff line number Diff line change
Expand Up @@ -1055,11 +1055,11 @@ H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)

/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(H5_ITER_ERROR)
{
/* Make the application callback */
ret_value = (bt2_udata->attr_op->u.app_op2)(
bt2_udata->loc_id, fh_udata.attr->shared->name, &ainfo, bt2_udata->op_data);
}
{
/* Make the application callback */
ret_value = (bt2_udata->attr_op->u.app_op2)(
bt2_udata->loc_id, fh_udata.attr->shared->name, &ainfo, bt2_udata->op_data);
}
H5_AFTER_USER_CB(H5_ITER_ERROR)
break;
}
Expand All @@ -1068,11 +1068,11 @@ H5A__dense_iterate_bt2_cb(const void *_record, void *_bt2_udata)
case H5A_ATTR_OP_APP:
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(H5_ITER_ERROR)
{
/* Make the application callback */
ret_value = (bt2_udata->attr_op->u.app_op)(bt2_udata->loc_id, fh_udata.attr->shared->name,
bt2_udata->op_data);
}
{
/* Make the application callback */
ret_value = (bt2_udata->attr_op->u.app_op)(
bt2_udata->loc_id, fh_udata.attr->shared->name, bt2_udata->op_data);
}
H5_AFTER_USER_CB(H5_ITER_ERROR)
break;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
Expand Down
18 changes: 9 additions & 9 deletions src/H5Aint.c
Original file line number Diff line number Diff line change
Expand Up @@ -1894,11 +1894,11 @@ H5A__attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip, hsize_t *l

/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(H5_ITER_ERROR)
{
/* Make the application callback */
ret_value =
(attr_op->u.app_op2)(loc_id, ((atable->attrs[u])->shared)->name, &ainfo, op_data);
}
{
/* Make the application callback */
ret_value =
(attr_op->u.app_op2)(loc_id, ((atable->attrs[u])->shared)->name, &ainfo, op_data);
}
H5_AFTER_USER_CB(H5_ITER_ERROR)
break;
}
Expand All @@ -1907,10 +1907,10 @@ H5A__attr_iterate_table(const H5A_attr_table_t *atable, hsize_t skip, hsize_t *l
case H5A_ATTR_OP_APP:
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(H5_ITER_ERROR)
{
/* Make the application callback */
ret_value = (attr_op->u.app_op)(loc_id, ((atable->attrs[u])->shared)->name, op_data);
}
{
/* Make the application callback */
ret_value = (attr_op->u.app_op)(loc_id, ((atable->attrs[u])->shared)->name, op_data);
}
H5_AFTER_USER_CB(H5_ITER_ERROR)
break;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
Expand Down
14 changes: 7 additions & 7 deletions src/H5D.c
Original file line number Diff line number Diff line change
Expand Up @@ -1594,10 +1594,10 @@ H5Dscatter(H5D_scatter_func_t op, void *op_data, hid_t type_id, hid_t dst_space_
while (nelmts > 0) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
/* Make callback to retrieve data */
ret_value = op(&src_buf, &src_buf_nbytes, op_data);
}
{
/* Make callback to retrieve data */
ret_value = op(&src_buf, &src_buf_nbytes, op_data);
}
H5_AFTER_USER_CB(FAIL)
if (ret_value < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure");
Expand Down Expand Up @@ -1713,9 +1713,9 @@ H5Dgather(hid_t src_space_id, const void *src_buf, hid_t type_id, size_t dst_buf
if (op) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
ret_value = op(dst_buf, nelmts_gathered * type_size, op_data);
}
{
ret_value = op(dst_buf, nelmts_gathered * type_size, op_data);
}
H5_AFTER_USER_CB(FAIL)
if (ret_value < 0)
HGOTO_ERROR(H5E_DATASET, H5E_CALLBACK, FAIL, "callback operator returned failure");
Expand Down
10 changes: 5 additions & 5 deletions src/H5Dchunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -8146,11 +8146,11 @@ H5D__chunk_iter_cb(const H5D_chunk_rec_t *chunk_rec, void *udata)

/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB_NOERR(FAIL)
{
ret_value =
(data->op)(offset, (unsigned)chunk_rec->filter_mask, data->base_addr + chunk_rec->chunk_addr,
(hsize_t)chunk_rec->nbytes, data->op_data);
}
{
ret_value =
(data->op)(offset, (unsigned)chunk_rec->filter_mask, data->base_addr + chunk_rec->chunk_addr,
(hsize_t)chunk_rec->nbytes, data->op_data);
}
H5_AFTER_USER_CB_NOERR(FAIL)

/* Check for callback failure and pass along return value */
Expand Down
36 changes: 18 additions & 18 deletions src/H5Dfill.c
Original file line number Diff line number Diff line change
Expand Up @@ -350,9 +350,9 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat
if (alloc_func) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
fb_info->fill_buf = alloc_func(fb_info->fill_buf_size, alloc_info);
}
{
fb_info->fill_buf = alloc_func(fb_info->fill_buf_size, alloc_info);
}
H5_AFTER_USER_CB(FAIL)
}
else
Expand Down Expand Up @@ -409,9 +409,9 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat
if (alloc_func) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
fb_info->fill_buf = alloc_func(fb_info->fill_buf_size, alloc_info);
}
{
fb_info->fill_buf = alloc_func(fb_info->fill_buf_size, alloc_info);
}
H5_AFTER_USER_CB(FAIL)
}
else
Expand Down Expand Up @@ -450,9 +450,9 @@ H5D__fill_init(H5D_fill_buf_info_t *fb_info, void *caller_fill_buf, H5MM_allocat
if (alloc_func) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
fb_info->fill_buf = alloc_func(fb_info->fill_buf_size, alloc_info);
}
{
fb_info->fill_buf = alloc_func(fb_info->fill_buf_size, alloc_info);
}
H5_AFTER_USER_CB(FAIL)
if (NULL == fb_info->fill_buf)
HGOTO_ERROR(H5E_DATASET, H5E_CANTALLOC, FAIL, "memory allocation failed for fill buffer");
Expand Down Expand Up @@ -532,9 +532,9 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts)
if (fb_info->fill_alloc_func) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
buf = fb_info->fill_alloc_func(fb_info->fill_buf_size, fb_info->fill_alloc_info);
}
{
buf = fb_info->fill_alloc_func(fb_info->fill_buf_size, fb_info->fill_alloc_info);
}
H5_AFTER_USER_CB(FAIL)
}
else
Expand Down Expand Up @@ -565,9 +565,9 @@ H5D__fill_refill_vl(H5D_fill_buf_info_t *fb_info, size_t nelmts)
if (fb_info->fill_free_func) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB_NOERR(FAIL)
{
fb_info->fill_free_func(buf, fb_info->fill_free_info);
}
{
fb_info->fill_free_func(buf, fb_info->fill_free_info);
}
H5_AFTER_USER_CB_NOERR(FAIL)
}
else
Expand Down Expand Up @@ -602,9 +602,9 @@ H5D__fill_release(H5D_fill_buf_info_t *fb_info)
if (fb_info->fill_free_func) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB_NOERR(FAIL)
{
fb_info->fill_free_func(fb_info->fill_buf, fb_info->fill_free_info);
}
{
fb_info->fill_free_func(fb_info->fill_buf, fb_info->fill_free_info);
}
H5_AFTER_USER_CB_NOERR(FAIL)
}
else {
Expand Down
18 changes: 9 additions & 9 deletions src/H5ESint.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,9 @@ H5ES__insert(H5ES_t *es, H5VL_connector_t *connector, void *request_token, const

/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
status = (es->ins_func)(&ev->op_info, es->ins_ctx);
}
{
status = (es->ins_func)(&ev->op_info, es->ins_ctx);
}
H5_AFTER_USER_CB(FAIL)
if (status < 0)
HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'insert' callback for event set failed");
Expand Down Expand Up @@ -589,9 +589,9 @@ H5ES__op_complete(H5ES_t *es, H5ES_event_t *ev, H5VL_request_status_t ev_status)

/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
status = (es->comp_func)(&ev->op_info, op_status, H5I_INVALID_HID, es->comp_ctx);
}
{
status = (es->comp_func)(&ev->op_info, op_status, H5I_INVALID_HID, es->comp_ctx);
}
H5_AFTER_USER_CB(FAIL)
if (status < 0)
HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'complete' callback for event set failed");
Expand All @@ -618,9 +618,9 @@ H5ES__op_complete(H5ES_t *es, H5ES_event_t *ev, H5VL_request_status_t ev_status)

/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB(FAIL)
{
status = (es->comp_func)(&ev->op_info, H5ES_STATUS_FAIL, err_stack_id, es->comp_ctx);
}
{
status = (es->comp_func)(&ev->op_info, H5ES_STATUS_FAIL, err_stack_id, es->comp_ctx);
}
H5_AFTER_USER_CB(FAIL)
if (status < 0)
HGOTO_ERROR(H5E_EVENTSET, H5E_CALLBACK, FAIL, "'complete' callback for event set failed");
Expand Down
71 changes: 38 additions & 33 deletions src/H5Eint.c
Original file line number Diff line number Diff line change
Expand Up @@ -1363,9 +1363,9 @@ H5E__walk(const H5E_stack_t *estack, H5E_direction_t direction, const H5E_walk_o

/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR)
{
ret_value = (op->u.func1)(i, &old_err, client_data);
}
{
ret_value = (op->u.func1)(i, &old_err, client_data);
}
H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR)
} /* end for */
} /* end if */
Expand All @@ -1382,10 +1382,10 @@ H5E__walk(const H5E_stack_t *estack, H5E_direction_t direction, const H5E_walk_o

/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR)
{
ret_value =
(op->u.func1)((int)(estack->nused - (size_t)(i + 1)), &old_err, client_data);
}
{
ret_value =
(op->u.func1)((int)(estack->nused - (size_t)(i + 1)), &old_err, client_data);
}
H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR)
} /* end for */
} /* end else */
Expand All @@ -1402,24 +1402,26 @@ H5E__walk(const H5E_stack_t *estack, H5E_direction_t direction, const H5E_walk_o
if (op->u.func2) {
ret_value = SUCCEED;
if (H5E_WALK_UPWARD == direction) {
for (i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++)
for (i = 0; i < (int)estack->nused && ret_value == H5_ITER_CONT; i++) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR)
{
ret_value = (op->u.func2)((unsigned)i, &estack->entries[i].err, client_data);
}
H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR)
{
ret_value = (op->u.func2)((unsigned)i, &estack->entries[i].err, client_data);
}
H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR)
}
} /* end if */
else {
H5_CHECK_OVERFLOW(estack->nused - 1, size_t, int);
for (i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--)
for (i = (int)(estack->nused - 1); i >= 0 && ret_value == H5_ITER_CONT; i--) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR)
{
ret_value = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)),
&estack->entries[i].err, client_data);
}
H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR)
{
ret_value = (op->u.func2)((unsigned)(estack->nused - (size_t)(i + 1)),
&estack->entries[i].err, client_data);
}
H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR)
}
} /* end else */

if (ret_value < 0)
Expand Down Expand Up @@ -1944,31 +1946,34 @@ H5E_dump_api_stack(void)
assert(estack);

#ifdef H5_NO_DEPRECATED_SYMBOLS
if (estack->auto_op.func2)
if (estack->auto_op.func2) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR)
{
(void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data));
}
H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR)
{
(void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data));
}
H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR)
}
#else /* H5_NO_DEPRECATED_SYMBOLS */
if (estack->auto_op.vers == 1) {
if (estack->auto_op.func1)
if (estack->auto_op.func1) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR)
{
(void)((estack->auto_op.func1)(estack->auto_data));
}
H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR)
{
(void)((estack->auto_op.func1)(estack->auto_data));
}
H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR)
}
} /* end if */
else {
if (estack->auto_op.func2)
if (estack->auto_op.func2) {
/* Prepare & restore library for user callback */
H5_BEFORE_USER_CB_NOERR(H5_ITER_ERROR)
{
(void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data));
}
H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR)
{
(void)((estack->auto_op.func2)(H5E_DEFAULT, estack->auto_data));
}
H5_AFTER_USER_CB_NOERR(H5_ITER_ERROR)
}
} /* end else */
#endif /* H5_NO_DEPRECATED_SYMBOLS */

Expand Down
Loading

0 comments on commit 401bed4

Please sign in to comment.