summaryrefslogtreecommitdiffstats
path: root/c++/test
diff options
context:
space:
mode:
authorSean McBride <sean@rogue-research.com>2021-03-04 21:06:30 (GMT)
committerGitHub <noreply@github.com>2021-03-04 21:06:30 (GMT)
commit580008d5bb39e3a9a4a92aefe06dce6941cd485b (patch)
tree449ff31910ac3efa9307c932b5f93f354ff14e94 /c++/test
parentfb210fc4fd70ce68b95a08f91eee2580552b6d21 (diff)
downloadhdf5-580008d5bb39e3a9a4a92aefe06dce6941cd485b.zip
hdf5-580008d5bb39e3a9a4a92aefe06dce6941cd485b.tar.gz
hdf5-580008d5bb39e3a9a4a92aefe06dce6941cd485b.tar.bz2
More warning fixes (#400)
* Fixed -Wunused-local-typedef warning * Fixed -Wformat warnings In one case also removed a `z` character. There was a `z%d` that I think was supposed to be `%zd` * Fixed -Wshorten-64-to-32 warnings * Fixed -Wself-assign warnings * Fixed -Wreserved-id-macro warnings * Commit format changes from clang-format, clang version 10.0.1. * Fixed -Wself-assign warnings * Fixed -Wunused-local-typedef warning * Fixed -Wformat warnings In two cases also removed a `z` character. There was a `z%d` that was supposed to be `%zd`. * Fixed -Wshorten-64-to-32 warnings * Fixed -Wreserved-id-macro warnings * Fixed -Wself-assign warnings * Format source. * Remove blank lines to pass format check. Co-authored-by: Larry Knox <lrknox@hdfgroup.org>
Diffstat (limited to 'c++/test')
-rw-r--r--c++/test/tarray.cpp27
-rw-r--r--c++/test/tattr.cpp54
2 files changed, 42 insertions, 39 deletions
diff --git a/c++/test/tarray.cpp b/c++/test/tarray.cpp
index ba71da8..ab66174 100644
--- a/c++/test/tarray.cpp
+++ b/c++/test/tarray.cpp
@@ -85,7 +85,7 @@ test_array_compound_array()
// Initialize array data to write
for (idxi = 0; idxi < SPACE1_DIM1; idxi++)
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
- wdata[idxi][idxj].i = idxi * 10 + idxj;
+ wdata[idxi][idxj].i = static_cast<int>(idxi * 10 + idxj);
for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) {
float temp = idxi * 10.0 + idxj * 2.5 + idxk;
wdata[idxi][idxj].f[idxk] = temp;
@@ -182,8 +182,9 @@ test_array_compound_array()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n",
- ii, rdims1[ii], ii, tdims1[ii]);
+ TestErrPrintf(
+ "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii,
+ rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
@@ -200,8 +201,9 @@ test_array_compound_array()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n",
- ii, rdims1[ii], ii, tdims1[ii]);
+ TestErrPrintf(
+ "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii,
+ rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
@@ -250,8 +252,9 @@ test_array_compound_array()
// Check the array dimensions
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
- TestErrPrintf("Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=%zd\n",
- ii, rdims1[ii], ii, tdims1[ii]);
+ TestErrPrintf(
+ "Array dimension information doesn't match!, rdims1[%d]=%lld, tdims1[%d]=%lld\n", ii,
+ rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
@@ -266,9 +269,9 @@ test_array_compound_array()
for (idxi = 0; idxi < SPACE1_DIM1; idxi++) {
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
if (wdata[idxi][idxj].i != rdata[idxi][idxj].i) {
- TestErrPrintf(
- "Array data information doesn't match!, wdata[%d][%d].i=%d, rdata[%d][%d].i=%d\n",
- idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i);
+ TestErrPrintf("Array data information doesn't match!, wdata[%lld][%lld].i=%d, "
+ "rdata[%lld][%lld].i=%d\n",
+ idxi, idxj, wdata[idxi][idxj].i, idxi, idxj, rdata[idxi][idxj].i);
continue;
} // end if
} // end for
@@ -387,7 +390,7 @@ test_array_info()
// Initialize array data to write
for (idxi = 0; idxi < SPACE1_DIM1; idxi++)
for (idxj = 0; idxj < ARRAY1_DIM1; idxj++) {
- wdata[idxi][idxj].i = idxi * 10 + idxj;
+ wdata[idxi][idxj].i = static_cast<int>(idxi * 10 + idxj);
for (idxk = 0; idxk < ARRAY1_DIM1; idxk++) {
float temp = idxi * 10.0 + idxj * 2.5 + idxk;
wdata[idxi][idxj].f[idxk] = temp;
@@ -459,7 +462,7 @@ test_array_info()
for (ii = 0; ii < ndims; ii++)
if (rdims1[ii] != tdims1[ii]) {
TestErrPrintf(
- "Array dimension information doesn't match!, rdims1[%d]=%zd, tdims1[%d]=z%d\n", ii,
+ "Array dimension information doesn't match!, rdims1[%d]=%llu, tdims1[%d]=z%llu\n", ii,
rdims1[ii], ii, tdims1[ii]);
continue;
} // end if
diff --git a/c++/test/tattr.cpp b/c++/test/tattr.cpp
index e308a3a..047d360 100644
--- a/c++/test/tattr.cpp
+++ b/c++/test/tattr.cpp
@@ -173,8 +173,8 @@ test_attr_basic_write()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__,
- i, attr_data1[i], i, read_data1[i]);
+ TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n",
+ __LINE__, i, attr_data1[i], i, read_data1[i]);
// Create two more attributes for this dataset, but only write to one.
Attribute ds_attr2 = dataset.createAttribute(ATTR2_NAME, PredType::NATIVE_INT, att_space);
@@ -189,7 +189,7 @@ test_attr_basic_write()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1a[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",
+ TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n",
__LINE__, i, attr_data1a[i], i, read_data1[i]);
// Close both attributes
@@ -452,8 +452,8 @@ test_attr_rename()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__,
- i, attr_data1[i], i, read_data1[i]);
+ TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu%d\n",
+ __LINE__, i, attr_data1[i], i, read_data1[i]);
// Close attribute
attr1.close();
@@ -476,7 +476,7 @@ test_attr_rename()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1a[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1a[%d]=%d,read_data1[%d]=%d\n",
+ TestErrPrintf("%d: attribute data different: attr_data1a[%llu]=%d,read_data1[%llu]=%d\n",
__LINE__, i, attr_data1a[i], i, read_data1[i]);
// Close attribute
@@ -541,7 +541,7 @@ test_attr_basic_read()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d, read_data1[%d]=%d\n",
+ TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d, read_data1[%llu]=%d\n",
__LINE__, i, attr_data1[i], i, read_data1[i]);
/*
@@ -572,9 +572,9 @@ test_attr_basic_read()
for (i = 0; i < ATTR2_DIM1; i++)
for (j = 0; j < ATTR2_DIM2; j++)
if (attr_data2[i][j] != read_data2[i][j]) {
- TestErrPrintf(
- "%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",
- __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
+ TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, "
+ "read_data2[%llu][%llu]=%d\n",
+ __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
}
PASSED();
} // end try block
@@ -776,15 +776,15 @@ test_attr_compound_read()
for (ii = 0; ii < ATTR4_DIM1; ii++)
for (jj = 0; jj < ATTR4_DIM2; jj++)
if (HDmemcmp(&attr_data4[ii][jj], &read_data4[ii][jj], sizeof(struct attr4_struct))) {
- TestErrPrintf(
- "%d:attribute data different: attr_data4[%d][%d].i=%d, read_data4[%d][%d].i=%d\n",
- __LINE__, ii, jj, attr_data4[ii][jj].i, ii, jj, read_data4[ii][jj].i);
- TestErrPrintf(
- "%d:attribute data different: attr_data4[%d][%d].d=%f, read_data4[%d][%d].d=%f\n",
- __LINE__, ii, jj, attr_data4[ii][jj].d, ii, jj, read_data4[ii][jj].d);
- TestErrPrintf(
- "%d:attribute data different: attr_data4[%d][%d].c=%c, read_data4[%d][%d].c=%c\n",
- __LINE__, ii, jj, attr_data4[ii][jj].c, ii, jj, read_data4[ii][jj].c);
+ TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].i=%d, "
+ "read_data4[%llu][%llu].i=%d\n",
+ __LINE__, ii, jj, attr_data4[ii][jj].i, ii, jj, read_data4[ii][jj].i);
+ TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].d=%f, "
+ "read_data4[%llu][%llu].d=%f\n",
+ __LINE__, ii, jj, attr_data4[ii][jj].d, ii, jj, read_data4[ii][jj].d);
+ TestErrPrintf("%d:attribute data different: attr_data4[%llu][%llu].c=%c, "
+ "read_data4[%llu][%llu].c=%c\n",
+ __LINE__, ii, jj, attr_data4[ii][jj].c, ii, jj, read_data4[ii][jj].c);
} /* end if */
// Verify name
@@ -1048,7 +1048,7 @@ test_attr_mult_read()
hsize_t dims[ATTR_MAX_DIMS]; // Attribute dimensions
int ndims = space.getSimpleExtentDims(dims);
if ((long)dims[0] != (long)ATTR1_DIM1)
- TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %d\n", __LINE__,
+ TestErrPrintf("%d:attribute dimensions different: dims[0]=%d, should be %llu\n", __LINE__,
(int)dims[0], ATTR1_DIM1);
/* Verify Datatype */
@@ -1076,8 +1076,8 @@ test_attr_mult_read()
// Verify values read in
for (i = 0; i < ATTR1_DIM1; i++)
if (attr_data1[i] != read_data1[i])
- TestErrPrintf("%d: attribute data different: attr_data1[%d]=%d,read_data1[%d]=%d\n", __LINE__,
- i, attr_data1[i], i, read_data1[i]);
+ TestErrPrintf("%d: attribute data different: attr_data1[%llu]=%d,read_data1[%llu]=%d\n",
+ __LINE__, i, attr_data1[i], i, read_data1[i]);
// Verify Name
H5std_string attr_name = attr.getName();
@@ -1131,9 +1131,9 @@ test_attr_mult_read()
for (i = 0; i < ATTR2_DIM1; i++)
for (j = 0; j < ATTR2_DIM2; j++)
if (attr_data2[i][j] != read_data2[i][j])
- TestErrPrintf(
- "%d: attribute data different: attr_data2[%d][%d]=%d, read_data2[%d][%d]=%d\n",
- __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
+ TestErrPrintf("%d: attribute data different: attr_data2[%llu][%llu]=%d, "
+ "read_data2[%llu][%llu]=%d\n",
+ __LINE__, i, j, attr_data2[i][j], i, j, read_data2[i][j]);
// Verify Name
attr_name = attr.getName();
@@ -1186,8 +1186,8 @@ test_attr_mult_read()
for (j = 0; j < ATTR3_DIM2; j++)
for (k = 0; k < ATTR3_DIM3; k++)
if (attr_data3[i][j][k] != read_data3[i][j][k])
- TestErrPrintf("%d: attribute data different: attr_data3[%d][%d][%d]=%f, "
- "read_data3[%d][%d][%d]=%f\n",
+ TestErrPrintf("%d: attribute data different: attr_data3[%llu][%llu][%llu]=%f, "
+ "read_data3[%llu][%llu][%llu]=%f\n",
__LINE__, i, j, k, attr_data3[i][j][k], i, j, k, read_data3[i][j][k]);
// Verify Name