Skip to content

Commit

Permalink
Remove lint comments (#4107)
Browse files Browse the repository at this point in the history
  • Loading branch information
derobins authored Mar 10, 2024
1 parent 7403f20 commit 9bc6c20
Show file tree
Hide file tree
Showing 12 changed files with 51 additions and 77 deletions.
2 changes: 1 addition & 1 deletion src/H5B.c
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ H5B_create(H5F_t *f, const H5B_class_t *type, void *udata, haddr_t *addr_p /*out
} /* end if */

FUNC_LEAVE_NOAPI(ret_value)
} /* end H5B_create() */ /*lint !e818 Can't make udata a pointer to const */
} /* end H5B_create() */

/*-------------------------------------------------------------------------
* Function: H5B_find
Expand Down
5 changes: 2 additions & 3 deletions src/H5Dchunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -1976,9 +1976,8 @@ H5D__create_piece_file_map_hyper(H5D_dset_io_info_t *dinfo, H5D_io_info_t *io_in
do {
/* Reset current dimension's location to 0 */
scaled[curr_dim] = start_scaled[curr_dim];
coords[curr_dim] =
start_coords[curr_dim]; /*lint !e771 The start_coords will always be initialized */
end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1;
coords[curr_dim] = start_coords[curr_dim];
end[curr_dim] = (coords[curr_dim] + fm->chunk_dim[curr_dim]) - 1;

/* Decrement current dimension */
curr_dim--;
Expand Down
22 changes: 11 additions & 11 deletions src/H5Dint.c
Original file line number Diff line number Diff line change
Expand Up @@ -1787,8 +1787,8 @@ H5D__open_oid(H5D_t *dataset, hid_t dapl_id)
case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "not implemented yet");
} /* end switch */ /*lint !e788 All appropriate cases are covered */
} /* end else */
} /* end switch */
} /* end else */

/* If "old" fill value size is 0 (undefined), map it to -1 */
if (fill_prop->size == 0)
Expand Down Expand Up @@ -1972,8 +1972,8 @@ H5D_close(H5D_t *dataset)
assert("not implemented yet" && 0);
#ifdef NDEBUG
HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout");
#endif /* NDEBUG */
} /* end switch */ /*lint !e788 All appropriate cases are covered */
#endif
} /* end switch */

/* Destroy any cached layout information for the dataset */
if (dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0)
Expand Down Expand Up @@ -2136,8 +2136,8 @@ H5D_mult_refresh_close(hid_t dset_id)
assert("not implemented yet" && 0);
#ifdef NDEBUG
HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout");
#endif /* NDEBUG */
} /* end switch */ /*lint !e788 All appropriate cases are covered */
#endif
} /* end switch */

/* Destroy any cached layout information for the dataset */
if (dataset->shared->layout.ops->dest && (dataset->shared->layout.ops->dest)(dataset) < 0)
Expand Down Expand Up @@ -2346,8 +2346,8 @@ H5D__alloc_storage(H5D_t *dset, H5D_time_alloc_t time_alloc, bool full_overwrite
assert("not implemented yet" && 0);
#ifdef NDEBUG
HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout");
#endif /* NDEBUG */
} /* end switch */ /*lint !e788 All appropriate cases are covered */
#endif
} /* end switch */

/* Check if we need to initialize the space */
if (must_init_space) {
Expand Down Expand Up @@ -2467,8 +2467,8 @@ H5D__init_storage(H5D_t *dset, bool full_overwrite, hsize_t old_dim[])
assert("not implemented yet" && 0);
#ifdef NDEBUG
HGOTO_ERROR(H5E_IO, H5E_UNSUPPORTED, FAIL, "unsupported storage layout");
#endif /* NDEBUG */
} /* end switch */ /*lint !e788 All appropriate cases are covered */
#endif
} /* end switch */

done:
FUNC_LEAVE_NOAPI(ret_value)
Expand Down Expand Up @@ -2523,7 +2523,7 @@ H5D__get_storage_size(const H5D_t *dset, hsize_t *storage_size)
case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a dataset type");
} /*lint !e788 All appropriate cases are covered */
}

done:
FUNC_LEAVE_NOAPI_TAG(ret_value)
Expand Down
2 changes: 1 addition & 1 deletion src/H5Dlayout.c
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ H5D__layout_set_io_ops(const H5D_t *dataset)
case H5D_NLAYOUTS:
default:
HGOTO_ERROR(H5E_DATASET, H5E_UNSUPPORTED, FAIL, "unknown storage method");
} /* end switch */ /*lint !e788 All appropriate cases are covered */
} /* end switch */

done:
FUNC_LEAVE_NOAPI(ret_value)
Expand Down
27 changes: 9 additions & 18 deletions src/H5E.c
Original file line number Diff line number Diff line change
Expand Up @@ -876,8 +876,7 @@ H5E__get_current_stack(void)
FUNC_ENTER_PACKAGE

/* Get a pointer to the current error stack */
if (NULL == (current_stack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean'
in non-threaded case */
if (NULL == (current_stack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, NULL, "can't get current error stack");

/* Allocate a new error stack */
Expand Down Expand Up @@ -992,8 +991,7 @@ H5E__set_current_stack(H5E_t *estack)
assert(estack);

/* Get a pointer to the current error stack */
if (NULL == (current_stack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean'
in non-threaded case */
if (NULL == (current_stack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");

/* Empty current error stack */
Expand Down Expand Up @@ -1114,8 +1112,7 @@ H5Eget_num(hid_t error_stack_id)

/* Need to check for errors */
if (error_stack_id == H5E_DEFAULT) {
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, (-1), "can't get current error stack");
} /* end if */
else {
Expand Down Expand Up @@ -1176,8 +1173,7 @@ H5Epop(hid_t err_stack, size_t count)

/* Need to check for errors */
if (err_stack == H5E_DEFAULT) {
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");
} /* end if */
else {
Expand Down Expand Up @@ -1360,8 +1356,7 @@ H5E__print2(hid_t err_stack, FILE *stream)

/* Need to check for errors */
if (err_stack == H5E_DEFAULT) {
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");
} /* end if */
else {
Expand Down Expand Up @@ -1403,8 +1398,7 @@ H5Ewalk2(hid_t err_stack, H5E_direction_t direction, H5E_walk2_t stack_func, voi

/* Need to check for errors */
if (err_stack == H5E_DEFAULT) {
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");
} /* end if */
else {
Expand Down Expand Up @@ -1449,8 +1443,7 @@ H5Eget_auto2(hid_t estack_id, H5E_auto2_t *func /*out*/, void **client_data /*ou
H5TRACE3("e", "i*EA**x", estack_id, func, client_data);

if (estack_id == H5E_DEFAULT) {
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");
} /* end if */
else {
Expand Down Expand Up @@ -1509,8 +1502,7 @@ H5Eset_auto2(hid_t estack_id, H5E_auto2_t func, void *client_data)
H5TRACE3("e", "iEA*x", estack_id, func, client_data);

if (estack_id == H5E_DEFAULT) {
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");
} /* end if */
else {
Expand Down Expand Up @@ -1568,8 +1560,7 @@ H5Eauto_is_v2(hid_t estack_id, unsigned *is_stack)
H5TRACE2("e", "i*Iu", estack_id, is_stack);

if (estack_id == H5E_DEFAULT) {
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");
} /* end if */
else {
Expand Down
12 changes: 4 additions & 8 deletions src/H5Edeprec.c
Original file line number Diff line number Diff line change
Expand Up @@ -248,8 +248,7 @@ H5Eprint1(FILE *stream)
FUNC_ENTER_API_NOCLEAR(FAIL)
/*NO TRACE*/

if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");

/* Print error stack */
Expand Down Expand Up @@ -282,8 +281,7 @@ H5Ewalk1(H5E_direction_t direction, H5E_walk1_t func, void *client_data)
FUNC_ENTER_API_NOCLEAR(FAIL)
/*NO TRACE*/

if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");

/* Walk the error stack */
Expand Down Expand Up @@ -320,8 +318,7 @@ H5Eget_auto1(H5E_auto1_t *func /*out*/, void **client_data /*out*/)
H5TRACE2("e", "*Ea**x", func, client_data);

/* Retrieve default error stack */
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");

/* Get the automatic error reporting information */
Expand Down Expand Up @@ -370,8 +367,7 @@ H5Eset_auto1(H5E_auto1_t func, void *client_data)
FUNC_ENTER_API_NOCLEAR(FAIL)
H5TRACE2("e", "Ea*x", func, client_data);

if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");

/* Get the automatic error reporting information */
Expand Down
6 changes: 2 additions & 4 deletions src/H5Eint.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,8 +709,7 @@ H5E__push_stack(H5E_t *estack, const char *file, const char *func, unsigned line

/* Check for 'default' error stack */
if (estack == NULL)
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_DONE(FAIL);

/*
Expand Down Expand Up @@ -827,8 +826,7 @@ H5E_clear_stack(H5E_t *estack)

/* Check for 'default' error stack */
if (estack == NULL)
if (NULL == (estack = H5E__get_my_stack())) /*lint !e506 !e774 Make lint 'constant value Boolean' in
non-threaded case */
if (NULL == (estack = H5E__get_my_stack()))
HGOTO_ERROR(H5E_ERROR, H5E_CANTGET, FAIL, "can't get current error stack");

/* Empty the error stack */
Expand Down
23 changes: 7 additions & 16 deletions src/H5FL.c
Original file line number Diff line number Diff line change
Expand Up @@ -984,10 +984,8 @@ H5FL_blk_free(H5FL_blk_head_t *head, void *block)
#endif /* H5FL_TRACK */

/* Get the pointer to the native block info header in front of the native block to free */
temp = (H5FL_blk_list_t *)((
void *)((unsigned char *)block -
(sizeof(H5FL_blk_list_t) +
H5FL_TRACK_SIZE))); /*lint !e826 Pointer-to-pointer cast is appropriate here */
temp =
(H5FL_blk_list_t *)((void *)((unsigned char *)block - (sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE)));

/* Save the block's size for later */
free_size = temp->size;
Expand Down Expand Up @@ -1058,10 +1056,8 @@ H5FL_blk_realloc(H5FL_blk_head_t *head, void *block, size_t new_size H5FL_TRACK_
H5FL_blk_list_t *temp; /* Temp. ptr to the new block node allocated */

/* Get the pointer to the chunk info header in front of the chunk to free */
temp = (H5FL_blk_list_t *)((
void *)((unsigned char *)block -
(sizeof(H5FL_blk_list_t) +
H5FL_TRACK_SIZE))); /*lint !e826 Pointer-to-pointer cast is appropriate here */
temp = (H5FL_blk_list_t *)((void *)((unsigned char *)block -
(sizeof(H5FL_blk_list_t) + H5FL_TRACK_SIZE)));

/* check if we are actually changing the size of the buffer */
if (new_size != temp->size) {
Expand Down Expand Up @@ -1407,10 +1403,7 @@ H5FL_arr_free(H5FL_arr_head_t *head, void *obj)
#endif

/* Get the pointer to the info header in front of the block to free */
temp = (H5FL_arr_list_t *)((
void *)((unsigned char *)obj -
(sizeof(H5FL_arr_list_t) +
H5FL_TRACK_SIZE))); /*lint !e826 Pointer-to-pointer cast is appropriate here */
temp = (H5FL_arr_list_t *)((void *)((unsigned char *)obj - (sizeof(H5FL_arr_list_t) + H5FL_TRACK_SIZE)));

/* Get the number of elements */
free_nelem = temp->nelem;
Expand Down Expand Up @@ -1607,10 +1600,8 @@ H5FL_arr_realloc(H5FL_arr_head_t *head, void *obj, size_t new_elem H5FL_TRACK_PA
assert((int)new_elem <= head->maxelem);

/* Get the pointer to the info header in front of the block to free */
temp = (H5FL_arr_list_t *)((
void *)((unsigned char *)obj -
(sizeof(H5FL_arr_list_t) +
H5FL_TRACK_SIZE))); /*lint !e826 Pointer-to-pointer cast is appropriate here */
temp =
(H5FL_arr_list_t *)((void *)((unsigned char *)obj - (sizeof(H5FL_arr_list_t) + H5FL_TRACK_SIZE)));

/* Check if the size is really changing */
if (temp->nelem != new_elem) {
Expand Down
4 changes: 2 additions & 2 deletions src/H5Tfields.c
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ H5T__get_member_name(H5T_t const *dt, unsigned membno)
case H5T_NCLASSES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, NULL, "operation not supported for type class");
} /*lint !e788 All appropriate cases are covered */
}

done:
FUNC_LEAVE_NOAPI(ret_value)
Expand Down Expand Up @@ -237,7 +237,7 @@ H5Tget_member_index(hid_t type_id, const char *name)
case H5T_NCLASSES:
default:
HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "operation not supported for this type");
} /*lint !e788 All appropriate cases are covered */
}

done:
FUNC_LEAVE_API(ret_value)
Expand Down
8 changes: 4 additions & 4 deletions src/H5Tvlen.c
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ H5T__vlen_set_loc(H5T_t *dt, H5VL_object_t *file, H5T_loc_t loc)
/* MAXLOC is invalid */
default:
HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype location");
} /* end switch */ /*lint !e788 All appropriate cases are covered */
} /* end switch */

/* Indicate that the location changed */
ret_value = true;
Expand Down Expand Up @@ -622,7 +622,7 @@ H5T__vlen_mem_str_setnull(H5VL_object_t H5_ATTR_UNUSED *file, void *_vl, void H5
/* Set pointer in user's buffer with memcpy, to avoid alignment issues */
H5MM_memcpy(_vl, &t, sizeof(char *));

FUNC_LEAVE_NOAPI(SUCCEED) /*lint !e429 The pointer in 't' has been copied */
FUNC_LEAVE_NOAPI(SUCCEED)
} /* end H5T__vlen_mem_str_setnull() */

/*-------------------------------------------------------------------------
Expand Down Expand Up @@ -695,7 +695,7 @@ H5T__vlen_mem_str_write(H5VL_object_t H5_ATTR_UNUSED *file, const H5T_vlen_alloc
H5MM_memcpy(_vl, &t, sizeof(char *));

done:
FUNC_LEAVE_NOAPI(ret_value) /*lint !e429 The pointer in 't' has been copied */
FUNC_LEAVE_NOAPI(ret_value)
} /* end H5T__vlen_mem_str_write() */

/*-------------------------------------------------------------------------
Expand Down Expand Up @@ -1035,7 +1035,7 @@ H5T__vlen_reclaim(void *elem, const H5T_t *dt, H5T_vlen_alloc_info_t *alloc_info
HGOTO_ERROR(H5E_DATATYPE, H5E_BADRANGE, FAIL, "invalid VL datatype class");
break;

} /* end switch */ /*lint !e788 All appropriate cases are covered */
} /* end switch */

done:
FUNC_LEAVE_NOAPI(ret_value)
Expand Down
Loading

0 comments on commit 9bc6c20

Please sign in to comment.