summaryrefslogtreecommitdiffstats
path: root/test/dt_arith.c
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2023-06-16 04:49:02 (GMT)
committerGitHub <noreply@github.com>2023-06-16 04:49:02 (GMT)
commit68eba3da69e659fab69bbef5901ce42e82cea1dc (patch)
treef36805f798df6c04092c14dc6803d2cb82f6eff2 /test/dt_arith.c
parent10093f7c4345061bdbebc12888debbf08fe85a5b (diff)
downloadhdf5-68eba3da69e659fab69bbef5901ce42e82cea1dc.zip
hdf5-68eba3da69e659fab69bbef5901ce42e82cea1dc.tar.gz
hdf5-68eba3da69e659fab69bbef5901ce42e82cea1dc.tar.bz2
Many clang -Wextra-semi-stmt fixes (#2537)
* Adds semicolons to function-like macros * Adds a do..while(0) loop to some macros * Removes semicolons when inappropriate, especially H5E_TRY_BEGIN/END
Diffstat (limited to 'test/dt_arith.c')
-rw-r--r--test/dt_arith.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/test/dt_arith.c b/test/dt_arith.c
index a26945f..b9b8830 100644
--- a/test/dt_arith.c
+++ b/test/dt_arith.c
@@ -106,7 +106,7 @@ static int without_hardware_g = 0;
* This algorithm is mainly to avoid any casting and comparison between source and destination types
* for compiler, because we're testing conversions. */
#define INIT_INTEGER(TYPE, SRC_MAX, SRC_MIN, SRC_SIZE, DST_SIZE, SRC_PREC, BUF, SAVED, NELMTS) \
- { \
+ do { \
unsigned char *buf_p, *saved_p; \
unsigned int n; \
TYPE value1 = 1; \
@@ -160,13 +160,13 @@ static int without_hardware_g = 0;
if (n < SRC_PREC - 1) \
value2 = (TYPE)(value2 << 1); \
} \
- }
+ } while (0)
/* Change a buffer's byte order from big endian to little endian. It's mainly for library's
* bit operations which handle only little endian order.
*/
#define CHANGE_ORDER(EBUF, EORDER, ESIZE) \
- { \
+ do { \
unsigned int m; \
if (H5T_ORDER_BE == EORDER) { \
unsigned char mediator; \
@@ -190,14 +190,14 @@ static int without_hardware_g = 0;
EBUF[(ESIZE - 1) - m] = mediator2; \
} \
} \
- }
+ } while (0)
/* Allocate buffer and initialize it with floating-point normalized values.
* It's for conversion test of floating-point as the source.
*/
#define INIT_FP_NORM(TYPE, SRC_MAX, SRC_MIN, SRC_MAX_10_EXP, SRC_MIN_10_EXP, SRC_SIZE, DST_SIZE, BUF, SAVED, \
NELMTS) \
- { \
+ do { \
unsigned char *buf_p, *saved_p; \
size_t num_norm, factor, n; \
TYPE value1, value2; \
@@ -270,13 +270,13 @@ static int without_hardware_g = 0;
HDmemcpy(saved_p, &value2, SRC_SIZE); \
buf_p += SRC_SIZE; \
saved_p += SRC_SIZE; \
- }
+ } while (0)
/* Allocate buffer and initialize it with floating-point denormalized values.
* It's for conversion test of floating-point as the source.
*/
#define INIT_FP_DENORM(TYPE, SRC_MANT_DIG, SRC_SIZE, SRC_PREC, SRC_ORDR, DST_SIZE, BUF, SAVED, NELMTS) \
- { \
+ do { \
unsigned char *buf_p, *saved_p; \
unsigned char *tmp1, *tmp2; \
size_t n; \
@@ -322,13 +322,13 @@ static int without_hardware_g = 0;
} \
HDfree(tmp1); \
HDfree(tmp2); \
- }
+ } while (0)
/* Allocate buffer and initialize it with floating-point special values, +/-0, +/-infinity,
* +/-QNaN, +/-SNaN. It's for conversion test of floating-point as the source.
*/
#define INIT_FP_SPECIAL(SRC_SIZE, SRC_PREC, SRC_ORDR, SRC_MANT_DIG, DST_SIZE, BUF, SAVED, NELMTS) \
- { \
+ do { \
unsigned char *buf_p; \
unsigned char *value; \
int n; \
@@ -386,7 +386,7 @@ static int without_hardware_g = 0;
\
HDmemcpy(SAVED, BUF, NELMTS *MAX(SRC_SIZE, DST_SIZE)); \
HDfree(value); \
- }
+ } while (0)
static hbool_t overflows(unsigned char *origin_bits, hid_t src_id, size_t dst_num_bits);
static int my_isnan(dtype_t type, void *val);
@@ -763,7 +763,7 @@ error:
{
H5Pclose(dxpl_id);
}
- H5E_END_TRY;
+ H5E_END_TRY
if (buf1)
HDfree(buf1);
if (buf2)
@@ -1220,7 +1220,7 @@ error:
H5Pclose(dxpl_id);
H5Fclose(file);
}
- H5E_END_TRY;
+ H5E_END_TRY
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();
@@ -1532,7 +1532,7 @@ error:
H5Pclose(dxpl_id);
H5Fclose(file);
}
- H5E_END_TRY;
+ H5E_END_TRY
/* Restore the default error handler (set in h5_reset()) */
h5_restore_err();