testpar/t_2Gio.c: Fix a typo that I think was introduced by a

previous warnings PR.  An array element was assigned to
        itself---shape[2]Â =Â shape[2];---instead of being assigned to
        chunk[2].

fortran/src/H5Pf.c: move conditional compilation controlled by
        H5_NO_DEPRECATED_SYMBOLS outside of a function for readability.

fortran/src/H5match_types.c: put a variable's declaration under the same
        conditional compilation (H5_FORTRAN_HAVE_C_LONG_DOUBLE) as its
        use.

For now, skip compilation of some unused debug dump routines in the JNI.
While I'm in the JNI, delete a set-but-unused variable.

src/H5Z.c: condition a variable declaration on H5_NO_DEPRECATED_SYMBOLS
        so that it's not declared but unused or vice versa.

test/cache_common.h: add an #include in to get some symbols we need to
        avoid implicit declaration warnings.

test/dsets.c: use a more conventional conditional-compilation syntax.

test/dt_arith.c, test/fillval.c: initialize a bunch of uninitialized
        variables before use.

test/vfd.c: pass the expected type of `void **` to posix_memalign(3)
        instead of `int **`.

testpar/t_bigio.c: explicitly compare with 0 instead of using ! when
        "equal to 0?" is the question not "is false?"  Repair some
        indentation while I'm here.

testpar/testpar.h: repair misaligned line-continuation backslashes in a
        macro that probably should be a function so that we don't have
        to fiddle with the line continuation to begin with.

tools/src/h5repack/h5repack_main.c: fix some compiler fussing about
        enums.

tools/test/perform/pio_engine.c: the compiler fusses if you cast a
        function call returning double directly to off_t.  It's ok if
        you cast a variable that's a double to off_t, however.  Write
        and use a new function, sqrto(), to avoid the cast warnings.
This commit is contained in:
David Young 2020-01-29 11:43:55 -06:00
parent f554a4fb54
commit f19e06b59e
14 changed files with 89 additions and 55 deletions

View File

@ -488,12 +488,26 @@ h5pget_fill_value_c (hid_t_f *prp_id, hid_t_f *type_id, void *fillvalue)
* Removed extra length parameters EP 7/6/00
* SOURCE
*/
#ifdef H5_NO_DEPRECATED_SYMBOLS
int_f
h5pget_version_c (hid_t_f H5_ATTR_UNUSED *prp_id, int_f * boot,int_f * freelist, int_f * stab, int_f *shhdr)
/******/
{
/*
* Fill in fake values [since we need a file ID to call H5Fget_info :-( -QAK ]
*/
*boot = (int_f)0;
*freelist = (int_f)0;
*stab = (int_f)0;
*shhdr = (int_f)0;
return 0;
}
#else /* H5_NO_DEPRECATED_SYMBOLS */
int_f
h5pget_version_c (hid_t_f *prp_id, int_f * boot,int_f * freelist, int_f * stab, int_f *shhdr)
/******/
{
int ret_value = -1;
#ifndef H5_NO_DEPRECATED_SYMBOLS
herr_t ret;
unsigned c_boot;
unsigned c_freelist;
@ -504,25 +518,16 @@ h5pget_version_c (hid_t_f *prp_id, int_f * boot,int_f * freelist, int_f * stab,
* Call H5Pget_version function.
*/
ret = H5Pget_version((hid_t)*prp_id, &c_boot, &c_freelist, &c_stab, &c_shhdr);
if (ret < 0) return ret_value;
if (ret < 0) return -1;
*boot = (int_f)c_boot;
*freelist = (int_f)c_freelist;
*stab = (int_f)c_stab;
*shhdr = (int_f)c_shhdr;
#else /* H5_NO_DEPRECATED_SYMBOLS */
/*
* Fill in fake values [since we need a file ID to call H5Fget_info :-( -QAK ]
*/
*boot = (int_f)0;
*freelist = (int_f)0;
*stab = (int_f)0;
*shhdr = (int_f)0;
#endif /* H5_NO_DEPRECATED_SYMBOLS */
ret_value = 0;
return ret_value;
return 0;
}
#endif /* H5_NO_DEPRECATED_SYMBOLS */
/****if* H5Pf/h5pget_userblock_c
* NAME

View File

@ -153,7 +153,9 @@ int main(void)
int FORTRAN_NUM_INTEGER_KINDS=H5_FORTRAN_NUM_INTEGER_KINDS;
int H5_FORTRAN_NUM_REAL_KINDS;
#if H5_FORTRAN_HAVE_C_LONG_DOUBLE!=0
int found_long_double = 0;
#endif
/* Open target files */
c_header = fopen(CFILE, "w");

View File

@ -28,6 +28,8 @@ extern "C" {
#include "hdf5.h"
#include "h5util.h"
#define SKIP_UNUSED_DUMP_ROUTINES
/* size of hyperslab buffer when a dataset is bigger than H5TOOLS_MALLOCSIZE */
hsize_t H5TOOLS_BUFSIZE = (32 * 1024 * 1024); /* 32 MB */
int H5TOOLS_TEXT_BLOCK = 16; /* Number of elements on a line in a text export file */
@ -52,8 +54,10 @@ void *edata;
/* Local Prototypes */
/********************/
#ifndef SKIP_UNUSED_DUMP_ROUTINES
static int h5str_dump_region_blocks(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
static int h5str_dump_region_points(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_obj);
#endif
static int h5str_is_zero(const void *_mem, size_t size);
static hid_t h5str_get_native_type(hid_t type);
static hid_t h5str_get_little_endian_type(hid_t type);
@ -708,7 +712,6 @@ h5str_sprintf
unsigned char *ucptr = (unsigned char *) in_buf;
static char fmt_llong[8], fmt_ullong[8];
H5T_class_t tclass = H5T_NO_CLASS;
H5T_str_t pad;
size_t typeSize = 0;
H5T_sign_t nsign = H5T_SGN_ERROR;
hid_t mtid = H5I_INVALID_HID;
@ -814,7 +817,6 @@ h5str_sprintf
else {
tmp_str = cptr;
}
pad = H5Tget_strpad(tid);
/* Check for NULL pointer for string */
if (!tmp_str) {
@ -1482,6 +1484,7 @@ done:
return ret_value;
} /* end h5str_dump_region_blocks_data */
#ifndef SKIP_UNUSED_DUMP_ROUTINES
static int
h5str_dump_region_blocks
(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
@ -1569,6 +1572,7 @@ done:
return ret_value;
} /* end h5str_dump_region_blocks */
#endif
/*-------------------------------------------------------------------------
* Purpose: Print the data values from a dataset referenced by region points.
@ -1701,6 +1705,7 @@ done:
return ret_value;
} /* end h5str_dump_region_points_data */
#ifndef SKIP_UNUSED_DUMP_ROUTINES
static int
h5str_dump_region_points
(JNIEnv *env, h5str_t *str, hid_t region, hid_t region_id)
@ -1776,6 +1781,7 @@ done:
return ret_value;
} /* end h5str_dump_region_points */
#endif
static int
h5str_is_zero

View File

@ -215,8 +215,10 @@ herr_t
H5Zregister(const void *cls)
{
const H5Z_class2_t *cls_real = (const H5Z_class2_t *) cls; /* "Real" class pointer */
H5Z_class2_t cls_new; /* Translated class struct */
herr_t ret_value = SUCCEED; /* Return value */
#ifndef H5_NO_DEPRECATED_SYMBOLS
H5Z_class2_t cls_new; /* Translated class struct */
#endif
FUNC_ENTER_API(FAIL)
H5TRACE1("e", "*x", cls);

View File

@ -25,6 +25,7 @@
/* Include library header files */
#include "H5ACprivate.h"
#include "H5MFprivate.h"
#include "H5Cpkg.h"
#include "H5Fpkg.h"
#include "H5Iprivate.h"

View File

@ -2331,9 +2331,9 @@ H5_ATTR_UNUSED
hsize_t shuffle_size; /* Size of dataset with shuffle filter */
#if(defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_SZIP)
#if defined(H5_HAVE_FILTER_DEFLATE) || defined(H5_HAVE_FILTER_SZIP)
hsize_t combo_size; /* Size of dataset with multiple filters */
#endif /* defined H5_HAVE_FILTER_DEFLATE | defined H5_HAVE_FILTER_SZIP */
#endif /* defined(H5_HAVE_FILTER_DEFLATE) || defined(H5_HAVE_FILTER_SZIP) */
/* test the H5Zget_filter_info function */
if(test_get_filter_info() < 0) goto error;

View File

@ -770,7 +770,7 @@ static int test_particular_fp_integer(void)
/* Print errors */
if(dst_c != SCHAR_MAX) {
double x;
double x = 0.;
signed char y;
if(0 == fails_this_test++)
@ -814,7 +814,7 @@ static int test_particular_fp_integer(void)
/* Print errors */
if(dst_i != fill_value) {
float x;
float x = 0.;
int y;
if(0 == fails_this_test++)
@ -2723,16 +2723,16 @@ my_isnan(dtype_t type, void *val)
char s[256];
if (FLT_FLOAT==type) {
float x;
float x = 0.;
HDmemcpy(&x, val, sizeof(float));
retval = (x!=x);
} else if (FLT_DOUBLE==type) {
double x;
double x = 0.;
HDmemcpy(&x, val, sizeof(double));
retval = (x!=x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (FLT_LDOUBLE==type) {
long double x;
long double x = 0.;
HDmemcpy(&x, val, sizeof(long double));
retval = (x!=x);
#endif
@ -2746,18 +2746,18 @@ my_isnan(dtype_t type, void *val)
*/
if (!retval) {
if (FLT_FLOAT==type) {
float x;
float x = 0.;
HDmemcpy(&x, val, sizeof(float));
HDsnprintf(s, sizeof(s), "%g", (double)x);
} else if (FLT_DOUBLE==type) {
double x;
double x = 0.;
HDmemcpy(&x, val, sizeof(double));
HDsnprintf(s, sizeof(s), "%g", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE && H5_SIZEOF_LONG_DOUBLE!=0
} else if (FLT_LDOUBLE==type) {
long double x;
long double x = 0.;
HDmemcpy(&x, val, sizeof(long double));
HDsnprintf(s, sizeof(s), "%Lg", x);
@ -3197,7 +3197,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
int check_expo[2];
if (FLT_FLOAT==dst_type) {
float x;
float x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
if (underflow &&
HDfabsf(x) <= FLT_MIN && HDfabsf(hw_f) <= FLT_MIN)
@ -3208,7 +3208,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
check_mant[0] = HDfrexpf(x, check_expo+0);
check_mant[1] = HDfrexpf(hw_f, check_expo+1);
} else if (FLT_DOUBLE==dst_type) {
double x;
double x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
if (underflow &&
HDfabs(x) <= DBL_MIN && HDfabs(hw_d) <= DBL_MIN)
@ -3220,7 +3220,7 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
check_mant[1] = HDfrexp(hw_d, check_expo+1);
#if H5_SIZEOF_LONG_DOUBLE !=0 && (H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE)
} else {
long double x;
long double x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
/* dst is largest float, no need to check underflow. */
check_mant[0] = (double)HDfrexpl(x, check_expo+0);
@ -3265,16 +3265,16 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDprintf(" %02x", saved[j*src_size+ENDIAN(src_size,k,sendian)]);
HDprintf("%*s", (int)(3*MAX(0, (ssize_t)dst_size-(ssize_t)src_size)), "");
if (FLT_FLOAT==src_type) {
float x;
float x = 0.;
HDmemcpy(&x, &saved[j*src_size], sizeof(float));
HDprintf(" %29.20e\n", (double)x);
} else if (FLT_DOUBLE==src_type) {
double x;
double x = 0.;
HDmemcpy(&x, &saved[j*src_size], sizeof(double));
HDprintf(" %29.20e\n", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
} else {
long double x;
long double x = 0.;
HDmemcpy(&x, &saved[j*src_size], sizeof(long double));
HDfprintf(stdout," %29.20Le\n", x);
#endif
@ -3285,16 +3285,16 @@ test_conv_flt_1 (const char *name, int run_test, hid_t src, hid_t dst)
HDprintf(" %02x", buf[j*dst_size+ENDIAN(dst_size,k,dendian)]);
HDprintf("%*s", (int)(3*MAX(0, (ssize_t)src_size-(ssize_t)dst_size)), "");
if (FLT_FLOAT==dst_type) {
float x;
float x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(float));
HDprintf(" %29.20e\n", (double)x);
} else if (FLT_DOUBLE==dst_type) {
double x;
double x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(double));
HDprintf(" %29.20e\n", x);
#if H5_SIZEOF_LONG_DOUBLE!=H5_SIZEOF_DOUBLE
} else {
long double x;
long double x = 0.;
HDmemcpy(&x, &buf[j*dst_size], sizeof(long double));
HDfprintf(stdout," %29.20Le\n", x);
#endif

View File

@ -762,6 +762,11 @@ test_rdwr_cases(hid_t file, hid_t dcpl, const char *dname, void *_fillval,
comp_datatype *buf_c=NULL;
H5D_space_status_t allocation;
fill_c.a = 0;
fill_c.x = 0;
fill_c.y = 0;
fill_c.z = 0;
if(datatype == H5T_INTEGER) {
fillval = *(int*)_fillval;
}

View File

@ -562,6 +562,7 @@ test_direct(void)
size_t mbound;
size_t fbsize;
size_t cbsize;
void *proto_points = NULL, *proto_check = NULL;
int *points = NULL, *check = NULL, *p1 = NULL, *p2 = NULL;
int wdata2[DSET2_DIM] = {11,12,13,14};
int rdata2[DSET2_DIM];
@ -633,10 +634,12 @@ test_direct(void)
/* Allocate aligned memory for data set 1. For data set 1, everything is aligned including
* memory address, size of data, and file address. */
if(0 != HDposix_memalign(&points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
if(0 != HDposix_memalign(&proto_points, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
if(0 != HDposix_memalign(&check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
points = proto_points;
if(0 != HDposix_memalign(&proto_check, (size_t)FBSIZE, (size_t)(DSET1_DIM1 * DSET1_DIM2 * sizeof(int))))
TEST_ERROR;
check = proto_check;
/* Initialize the dset1 */
p1 = points;
@ -746,10 +749,10 @@ error:
H5Fclose(file);
} H5E_END_TRY;
if(points)
HDfree(points);
if(check)
HDfree(check);
if(proto_points)
HDfree(proto_points);
if(proto_check)
HDfree(proto_check);
return -1;
#endif /*H5_HAVE_DIRECT*/

View File

@ -625,7 +625,7 @@ static int MpioTest2G( MPI_Comm comm )
VRFY((dcpl_id >= 0), "H5P_DATASET_CREATE");
chunk[0] = 4;
chunk[1] = shape[1];
shape[2] = shape[2];
chunk[2] = shape[2];
status = H5Pset_chunk(dcpl_id, 3, chunk);
VRFY((status >= 0), "H5Pset_chunk succeeded");

View File

@ -15,7 +15,7 @@ const char *FILENAME[3]={ "bigio_test.h5",
/* Define some handy debugging shorthands, routines, ... */
/* debugging tools */
#define MAIN_PROCESS (!mpi_rank_g) /* define process 0 as main process */
#define MAIN_PROCESS (mpi_rank_g == 0) /* define process 0 as main process */
/* Constants definitions */
#define RANK 2
@ -1131,7 +1131,7 @@ single_rank_independent_io(void)
void *data = NULL;
fapl_id = H5Pcreate(H5P_FILE_ACCESS);
VRFY_G((fapl_id >= 0), "H5P_FILE_ACCESS");
VRFY_G((fapl_id >= 0), "H5P_FILE_ACCESS");
H5Pset_fapl_mpio(fapl_id, MPI_COMM_SELF, MPI_INFO_NULL);
file_id = H5Fcreate(FILENAME[1], H5F_ACC_TRUNC, H5P_DEFAULT, fapl_id);

View File

@ -44,12 +44,12 @@
* This will allow program to continue and can be used for debugging.
* (The "do {...} while(0)" is to group all the statements as one unit.)
*/
#define VRFY_IMPL(val, mesg, rankvar) do { \
#define VRFY_IMPL(val, mesg, rankvar) do { \
if (val) { \
MESG(mesg); \
} \
else { \
HDprintf("Proc %d: ", rankvar); \
HDprintf("Proc %d: ", rankvar); \
HDprintf("*** Parallel ERROR ***\n"); \
HDprintf(" VRFY (%s) failed at line %4d in %s\n", \
mesg, (int)__LINE__, __FILE__); \

View File

@ -412,7 +412,7 @@ set_sort_order(const char *form)
static
int parse_command_line(int argc, const char **argv, pack_opt_t* options)
{
int opt;
int bound, opt;
int ret_value = 0;
/* parse command line options */
@ -492,19 +492,21 @@ int parse_command_line(int argc, const char **argv, pack_opt_t* options)
break;
case 'j':
options->low_bound = (H5F_libver_t)HDatoi(opt_arg);
if (options->low_bound < H5F_LIBVER_EARLIEST || options->low_bound > H5F_LIBVER_LATEST) {
bound = HDatoi(opt_arg);
if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) {
error_msg("in parsing low bound\n");
goto done;
}
options->low_bound = bound;
break;
case 'k':
options->high_bound = (H5F_libver_t)HDatoi(opt_arg);
if (options->high_bound < H5F_LIBVER_EARLIEST || options->high_bound > H5F_LIBVER_LATEST) {
bound = HDatoi(opt_arg);
if (bound < H5F_LIBVER_EARLIEST || bound > H5F_LIBVER_LATEST) {
error_msg("in parsing high bound\n");
goto done;
}
options->high_bound = bound;
break;
case 'c':

View File

@ -129,6 +129,7 @@ static herr_t do_fopen(parameters *param, char *fname, file_descr *fd /*out*/,
int flags);
static herr_t do_fclose(iotype iot, file_descr *fd);
static void do_cleanupfile(iotype iot, char *fname);
static off_t sqrto(off_t);
/*
* Function: do_pio
@ -199,7 +200,7 @@ do_pio(parameters param)
bsize = buf_size; /* Actual buffer size */
}
else {
snbytes = (off_t)sqrt((double)nbytes); /* General dataset size */
snbytes = sqrto(nbytes); /* General dataset size */
bsize = buf_size * blk_size; /* Actual buffer size */
}
@ -596,7 +597,7 @@ do_write(results *res, file_descr *fd, parameters *parms, long ndsets,
/* nbytes is always the number of bytes per dataset (1D or 2D). If the
dataspace is 2D, snbytes is the size of a side of the dataset square.
*/
snbytes = (off_t)sqrt((double)nbytes);
snbytes = sqrto(nbytes);
/* Contiguous Pattern: */
if (!parms->interleaved) {
@ -1489,6 +1490,13 @@ done:
return ret_code;
}
static off_t
sqrto(off_t x)
{
double root_x = sqrt((double)x);
return (off_t)root_x;
}
/*
* Function: do_read
* Purpose: read the required amount of data from the file.
@ -1581,7 +1589,7 @@ do_read(results *res, file_descr *fd, parameters *parms, long ndsets,
/* nbytes is always the number of bytes per dataset (1D or 2D). If the
dataspace is 2D, snbytes is the size of a side of the 'dataset square'.
*/
snbytes = (off_t)sqrt((double)nbytes);
snbytes = sqrto(nbytes);
bsize = buf_size * blk_size;