summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorLarry Knox <lrknox@hdfgroup.org>2022-04-01 20:41:26 (GMT)
committerGitHub <noreply@github.com>2022-04-01 20:41:26 (GMT)
commit572adbaacb126e530f6af94a90092e004c23a163 (patch)
tree1fc09f3d565a05a93800a5c4a9eefe582d03d8b0 /tools
parent210e0d91d158ea80e6d76d5656b2b467d0d1a9e6 (diff)
downloadhdf5-572adbaacb126e530f6af94a90092e004c23a163.zip
hdf5-572adbaacb126e530f6af94a90092e004c23a163.tar.gz
hdf5-572adbaacb126e530f6af94a90092e004c23a163.tar.bz2
Assume C99 fixed sized ints exist, use them (#470) (#1571)
* Committing clang-format changes * Assume C99 fixed sized ints exist, use them * Assume H5_SIZEOF_LONG_DOUBLE != 0, `long double` has existed since C89 Note, this is only assuming that `long double` exists, no assumptions about its size have been touched. Didn't remove any code that does things like test if `long double` and `double` have different sizes. * Committing clang-format changes Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Sean McBride <sean@rogue-research.com> Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/lib/h5diff_array.c40
-rw-r--r--tools/lib/h5diff_util.c2
-rw-r--r--tools/lib/h5tools_str.c2
-rw-r--r--tools/src/h5import/h5import.c38
-rw-r--r--tools/test/h5diff/h5diffgentest.c2
-rw-r--r--tools/test/h5import/h5importtest.c28
6 files changed, 24 insertions, 88 deletions
diff --git a/tools/lib/h5diff_array.c b/tools/lib/h5diff_array.c
index 1d93df3..e211629 100644
--- a/tools/lib/h5diff_array.c
+++ b/tools/lib/h5diff_array.c
@@ -24,12 +24,8 @@
*-------------------------------------------------------------------------
*/
-#define F_FORMAT "%-15g %-15g %-15g\n"
-
-#if H5_SIZEOF_LONG_DOUBLE != 0
-#define LD_FORMAT "%-15Lg %-15Lg %-15Lg\n"
-#endif
-
+#define F_FORMAT "%-15g %-15g %-15g\n"
+#define LD_FORMAT "%-15Lg %-15Lg %-15Lg\n"
#define I_FORMAT "%-15d %-15d %-15d\n"
#define S_FORMAT "%-16s %-17s\n"
#define UI_FORMAT "%-15u %-15u %-15u\n"
@@ -39,12 +35,8 @@
#define ULLI_FORMAT "%-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u %-15" H5_PRINTF_LL_WIDTH "u\n"
/* with -p option */
-#define F_FORMAT_P "%-15.10g %-15.10g %-15.10g %-14.10g\n"
-
-#if H5_SIZEOF_LONG_DOUBLE != 0
-#define LD_FORMAT_P "%-15.10Lg %-15.10Lg %-15.10Lg %-14.10Lg\n"
-#endif
-
+#define F_FORMAT_P "%-15.10g %-15.10g %-15.10g %-14.10g\n"
+#define LD_FORMAT_P "%-15.10Lg %-15.10Lg %-15.10Lg %-14.10Lg\n"
#define I_FORMAT_P "%-15d %-15d %-15d %-14f\n"
#define UI_FORMAT_P "%-15u %-15u %-15u %-14f\n"
#define LI_FORMAT_P "%-15ld %-15ld %-15ld %-14f\n"
@@ -56,12 +48,8 @@
#define SPACES " "
/* not comparable */
-#define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n"
-
-#if H5_SIZEOF_LONG_DOUBLE != 0
-#define LD_FORMAT_P_NOTCOMP "%-15.10Lg %-15.10Lg %-15.10Lg not comparable\n"
-#endif
-
+#define F_FORMAT_P_NOTCOMP "%-15.10g %-15.10g %-15.10g not comparable\n"
+#define LD_FORMAT_P_NOTCOMP "%-15.10Lg %-15.10Lg %-15.10Lg not comparable\n"
#define I_FORMAT_P_NOTCOMP "%-15d %-15d %-15d not comparable\n"
#define UI_FORMAT_P_NOTCOMP "%-15u %-15u %-15u not comparable\n"
#define LI_FORMAT_P_NOTCOMP "%-15ld %-15ld %-15ld not comparable\n"
@@ -145,9 +133,7 @@ static hsize_t character_compare_opt(unsigned char *mem1, unsigned char *mem2, h
diff_opt_t *opts);
static hbool_t equal_float(float value, float expected, diff_opt_t *opts);
static hbool_t equal_double(double value, double expected, diff_opt_t *opts);
-#if H5_SIZEOF_LONG_DOUBLE != 0
static hbool_t equal_ldouble(long double value, long double expected, diff_opt_t *opts);
-#endif
static int print_data(diff_opt_t *opts);
static void print_pos(diff_opt_t *opts, hsize_t elemtno, size_t u);
@@ -162,10 +148,8 @@ static hsize_t diff_float_element(unsigned char *mem1, unsigned char *mem2, hsiz
diff_opt_t *opts);
static hsize_t diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
diff_opt_t *opts);
-#if H5_SIZEOF_LONG_DOUBLE != 0
static hsize_t diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
diff_opt_t *opts);
-#endif
static hsize_t diff_schar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
diff_opt_t *opts);
static hsize_t diff_uchar_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
@@ -191,12 +175,7 @@ static hsize_t diff_ullong_element(unsigned char *mem1, unsigned char *mem2, hsi
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
typedef enum dtype_t { FLT_FLOAT, FLT_DOUBLE, FLT_LDOUBLE } dtype_t;
-#else
-
-typedef enum dtype_t { FLT_FLOAT, FLT_DOUBLE } dtype_t;
-#endif
/*-------------------------------------------------------------------------
* XCAO, 11/10/2010
@@ -278,7 +257,6 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_
return nfound;
} /* nelmts */
}
-#if H5_SIZEOF_LONG_DOUBLE != 0
else if (H5Tequal(opts->m_tid, H5T_NATIVE_LDOUBLE)) {
for (i = 0; i < opts->hs_nelmts; i++) {
nfound += diff_ldouble_element(mem1, mem2, i, opts);
@@ -289,7 +267,6 @@ diff_array(void *_mem1, void *_mem2, diff_opt_t *opts, hid_t container1_id, hid_
return nfound;
} /* nelmts */
}
-#endif
break;
case H5T_INTEGER:
@@ -2034,7 +2011,6 @@ diff_double_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
* Return: number of differences found
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
static hsize_t
diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx, diff_opt_t *opts)
@@ -2200,7 +2176,6 @@ diff_ldouble_element(unsigned char *mem1, unsigned char *mem2, hsize_t elem_idx,
return nfound;
}
-#endif /* H5_SIZEOF_LONG_DOUBLE */
/*-------------------------------------------------------------------------
* Function: diff_schar_element
@@ -3203,7 +3178,6 @@ equal_double(double value, double expected, diff_opt_t *opts)
*-------------------------------------------------------------------------
*/
-#if H5_SIZEOF_LONG_DOUBLE != 0
static hbool_t
equal_ldouble(long double value, long double expected, diff_opt_t *opts)
{
@@ -3244,8 +3218,6 @@ equal_ldouble(long double value, long double expected, diff_opt_t *opts)
return FALSE;
}
-#endif /* #if H5_SIZEOF_LONG_DOUBLE !=0 */
-
/*-------------------------------------------------------------------------
* Function: equal_float
*
diff --git a/tools/lib/h5diff_util.c b/tools/lib/h5diff_util.c
index e487a12..c40de9d 100644
--- a/tools/lib/h5diff_util.c
+++ b/tools/lib/h5diff_util.c
@@ -133,10 +133,8 @@ print_type(hid_t type)
parallel_print("H5T_NATIVE_FLOAT");
else if (H5Tequal(type, H5T_NATIVE_DOUBLE))
parallel_print("H5T_NATIVE_DOUBLE");
-#if H5_SIZEOF_LONG_DOUBLE != 0
else if (H5Tequal(type, H5T_NATIVE_LDOUBLE))
parallel_print("H5T_NATIVE_LDOUBLE");
-#endif
else
parallel_print("undefined float");
break;
diff --git a/tools/lib/h5tools_str.c b/tools/lib/h5tools_str.c
index bd14483..4e8dcc1 100644
--- a/tools/lib/h5tools_str.c
+++ b/tools/lib/h5tools_str.c
@@ -705,7 +705,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
HDmemcpy(&tempdouble, vp, sizeof(double));
h5tools_str_append(str, OPT(info->fmt_double, "%g"), tempdouble);
-#if H5_SIZEOF_LONG_DOUBLE != 0
}
else if (sizeof(long double) == nsize) {
/* if (H5Tequal(type, H5T_NATIVE_LDOUBLE)) */
@@ -713,7 +712,6 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
HDmemcpy(&templdouble, vp, sizeof(long double));
h5tools_str_append(str, "%Lg", templdouble);
-#endif
}
else {
size_t i;
diff --git a/tools/src/h5import/h5import.c b/tools/src/h5import/h5import.c
index 509cc87..a1895e6 100644
--- a/tools/src/h5import/h5import.c
+++ b/tools/src/h5import/h5import.c
@@ -467,14 +467,12 @@ readIntegerData(FILE *strm, struct Input *in)
H5DT_INT16 temp16;
H5DT_INT32 *in32;
H5DT_INT32 temp32;
-#ifdef H5_SIZEOF_LONG_LONG
H5DT_INT64 *in64;
H5DT_INT64 temp64;
char buffer[256];
-#endif
- hsize_t len = 1;
- hsize_t i;
- int j;
+ hsize_t len = 1;
+ hsize_t i;
+ int j;
const char *err1 = "Unable to get integer value from file.\n";
const char *err2 = "Unrecognized input class type.\n";
@@ -589,7 +587,6 @@ readIntegerData(FILE *strm, struct Input *in)
}
break;
-#ifdef H5_SIZEOF_LONG_LONG
case 64:
in64 = (H5DT_INT64 *)in->data;
switch (in->inputClass) {
@@ -626,7 +623,6 @@ readIntegerData(FILE *strm, struct Input *in)
return (-1);
}
break;
-#endif /* ifdef H5_SIZEOF_LONG_LONG */
default:
(void)HDfprintf(stderr, "%s", err3);
@@ -643,17 +639,15 @@ readUIntegerData(FILE *strm, struct Input *in)
H5DT_UINT16 temp16;
H5DT_UINT32 *in32;
H5DT_UINT32 temp32;
-#ifdef H5_SIZEOF_LONG_LONG
H5DT_UINT64 *in64;
H5DT_UINT64 temp64;
char buffer[256];
-#endif
- hsize_t len = 1;
- hsize_t i;
- int j;
- const char *err1 = "Unable to get unsigned integer value from file.\n";
- const char *err2 = "Unrecognized input class type.\n";
- const char *err3 = "Invalid input size.\n";
+ hsize_t len = 1;
+ hsize_t i;
+ int j;
+ const char * err1 = "Unable to get unsigned integer value from file.\n";
+ const char * err2 = "Unrecognized input class type.\n";
+ const char * err3 = "Invalid input size.\n";
for (j = 0; j < in->rank; j++)
len *= in->sizeOfDimension[j];
@@ -760,7 +754,6 @@ readUIntegerData(FILE *strm, struct Input *in)
}
break;
-#ifdef H5_SIZEOF_LONG_LONG
case 64:
in64 = (H5DT_UINT64 *)in->data;
switch (in->inputClass) {
@@ -797,7 +790,6 @@ readUIntegerData(FILE *strm, struct Input *in)
return (-1);
}
break;
-#endif /* ifdef H5_SIZEOF_LONG_LONG */
default:
(void)HDfprintf(stderr, "%s", err3);
@@ -2457,9 +2449,6 @@ validateConfigurationParameters(struct Input *in)
const char *err4a = "OUTPUT-ARCHITECTURE cannot be STD if OUTPUT-CLASS is floating point (FP).\n";
const char *err4b = "OUTPUT-ARCHITECTURE cannot be IEEE if OUTPUT-CLASS is integer (IN).\n";
const char *err5 = "For OUTPUT-CLASS FP, valid values for OUTPUT-SIZE are (32, 64) .\n";
-#ifndef H5_SIZEOF_LONG_LONG
- const char *err6 = "No support for reading 64-bit integer (INPUT-CLASS: IN, TEXTIN, UIN, TEXTUIN files\n";
-#endif
/* for class STR other parameters are ignored */
if (in->inputClass == 5) /* STR */
@@ -2505,13 +2494,6 @@ validateConfigurationParameters(struct Input *in)
return (-1);
}
-#ifndef H5_SIZEOF_LONG_LONG
- if (in->inputSize == 64 &&
- (in->inputClass == 0 || in->inputClass == 4 || in->inputClass == 6 || in->inputClass == 7)) {
- (void)HDfprintf(stderr, "%s", err6);
- return -1;
- }
-#endif
return (0);
}
@@ -3250,7 +3232,6 @@ getInputClassType(struct Input *in, char *buffer)
kindex = 3;
}
-#if H5_SIZEOF_LONG_DOUBLE != 0
else if (!HDstrcmp(buffer, "H5T_NATIVE_LDOUBLE")) {
in->inputSize = H5_SIZEOF_LONG_DOUBLE;
in->configOptionVector[INPUT_SIZE] = 1;
@@ -3263,7 +3244,6 @@ getInputClassType(struct Input *in, char *buffer)
kindex = 3;
}
-#endif
else if (!HDstrcmp(buffer, "H5T_TIME: not yet implemented")) {
kindex = -1;
}
diff --git a/tools/test/h5diff/h5diffgentest.c b/tools/test/h5diff/h5diffgentest.c
index 017b8a3..f7e5c52 100644
--- a/tools/test/h5diff/h5diffgentest.c
+++ b/tools/test/h5diff/h5diffgentest.c
@@ -442,7 +442,6 @@ test_basic(const char *fname1, const char *fname2, const char *fname3)
write_dset(gid1, 2, dims2, "d2", H5T_NATIVE_DOUBLE, data14);
}
-#if H5_SIZEOF_LONG_DOUBLE != 0
{
/*-------------------------------------------------------------------------
@@ -454,7 +453,6 @@ test_basic(const char *fname1, const char *fname2, const char *fname3)
write_dset(gid1, 2, dims2, "ld", H5T_NATIVE_LDOUBLE, data15);
}
-#endif
/*-------------------------------------------------------------------------
* NaNs in H5T_NATIVE_FLOAT
diff --git a/tools/test/h5import/h5importtest.c b/tools/test/h5import/h5importtest.c
index e49125b..7dbf762 100644
--- a/tools/test/h5import/h5importtest.c
+++ b/tools/test/h5import/h5importtest.c
@@ -46,11 +46,9 @@ main(void)
int rowo4i = 11, colo4i = 21, plno4i = 51;
int rowi4i = 1, coli4i = 2, plni4i = 5;
-#ifdef H5_SIZEOF_LONG_LONG
long long row4i64[3], col4i64[4], pln4i64[5];
long long rowo4i64 = (long long)11, colo4i64 = (long long)21, plno4i64 = (long long)51;
long long rowi4i64 = (long long)1, coli4i64 = (long long)2, plni4i64 = (long long)5;
-#endif
short b16i3[5][3][4];
short row4i16[3], col4i16[4], pln4i16[5];
@@ -101,11 +99,9 @@ main(void)
col4i[0] = colo4i;
pln4i[0] = plno4i;
-#ifdef H5_SIZEOF_LONG_LONG
row4i64[0] = rowo4i64;
col4i64[0] = colo4i64;
pln4i64[0] = plno4i64;
-#endif
row4i16[0] = rowo4i16;
col4i16[0] = colo4i16;
@@ -116,33 +112,27 @@ main(void)
pln4i8[0] = plno4i8;
for (i = 1; i < nrow; i++) {
- row4[i] = row4[i - 1] + rowi4;
- row8[i] = row8[i - 1] + rowi8;
- row4i[i] = row4i[i - 1] + rowi4i;
-#ifdef H5_SIZEOF_LONG_LONG
+ row4[i] = row4[i - 1] + rowi4;
+ row8[i] = row8[i - 1] + rowi8;
+ row4i[i] = row4i[i - 1] + rowi4i;
row4i64[i] = row4i64[i - 1] + rowi4i64;
-#endif
row4i16[i] = (short)(row4i16[i - 1] + rowi4i16);
row4i8[i] = (char)(row4i8[i - 1] + rowi4i8);
}
for (j = 1; j < ncol; j++) {
- col4[j] = col4[j - 1] + coli4;
- col8[j] = col8[j - 1] + coli8;
- col4i[j] = col4i[j - 1] + coli4i;
-#ifdef H5_SIZEOF_LONG_LONG
+ col4[j] = col4[j - 1] + coli4;
+ col8[j] = col8[j - 1] + coli8;
+ col4i[j] = col4i[j - 1] + coli4i;
col4i64[j] = col4i64[j - 1] + coli4i64;
-#endif
col4i16[j] = (short)(col4i16[j - 1] + coli4i16);
col4i8[j] = (char)(col4i8[j - 1] + coli4i8);
}
for (k = 1; k < npln; k++) {
- pln4[k] = pln4[k - 1] + plni4;
- pln8[k] = pln8[k - 1] + plni8;
- pln4i[k] = pln4i[k - 1] + plni4i;
-#ifdef H5_SIZEOF_LONG_LONG
+ pln4[k] = pln4[k - 1] + plni4;
+ pln8[k] = pln8[k - 1] + plni8;
+ pln4i[k] = pln4i[k - 1] + plni4i;
pln4i64[k] = pln4i64[k - 1] + plni4i64;
-#endif
pln4i16[k] = (short)(pln4i16[k - 1] + plni4i16);
pln4i8[k] = (char)(pln4i8[k - 1] + plni4i8);
}