summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@koziol.gov>2019-07-10 03:15:36 (GMT)
committerQuincey Koziol <koziol@koziol.gov>2019-07-10 03:15:36 (GMT)
commitdb7c43d375f6997dfc44d6153e7b015da571a8c9 (patch)
tree4f2c1e23d42540d4ea86870c29f11c217e2e566e /test
parent78e13fe8b09f4398519f58552d42651712284c76 (diff)
downloadhdf5-db7c43d375f6997dfc44d6153e7b015da571a8c9.zip
hdf5-db7c43d375f6997dfc44d6153e7b015da571a8c9.tar.gz
hdf5-db7c43d375f6997dfc44d6153e7b015da571a8c9.tar.bz2
Updates to warnhist script, along with a few cleanups, and add some comments
to warning cleanups that are a bit obscure.
Diffstat (limited to 'test')
-rw-r--r--test/big.c9
-rw-r--r--test/error_test.c9
-rw-r--r--test/fheap.c9
-rw-r--r--test/file_image.c9
-rw-r--r--test/h5test.c21
-rw-r--r--test/use_disable_mdc_flushes.c8
-rw-r--r--test/vfd.c27
7 files changed, 87 insertions, 5 deletions
diff --git a/test/big.c b/test/big.c
index b3105eb..46acc5e 100644
--- a/test/big.c
+++ b/test/big.c
@@ -275,6 +275,14 @@ error:
*
*-------------------------------------------------------------------------
*/
+/* Disable warning for "format not a string literal" here -QAK */
+/*
+ * This pragma only needs to surround the snprintf() calls with
+ * 'name' in the code below, but early (4.4.7, at least) gcc only
+ * allows diagnostic pragmas to be toggled outside of functions.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static int
enough_room(hid_t fapl)
{
@@ -315,6 +323,7 @@ done:
return ret_value;
}
+#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
diff --git a/test/error_test.c b/test/error_test.c
index 5356fa7..44f6210 100644
--- a/test/error_test.c
+++ b/test/error_test.c
@@ -320,6 +320,14 @@ long_desc_cb(unsigned H5_ATTR_UNUSED n, const H5E_error2_t *err_desc, void *clie
*
*-------------------------------------------------------------------------
*/
+/* Disable warning for "format not a string literal" here -QAK */
+/*
+ * This pragma only needs to surround the snprintf() calls with
+ * 'full_desc' in the code below, but early (4.4.7, at least) gcc only
+ * allows diagnostic pragmas to be toggled outside of functions.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static herr_t
test_long_desc(void)
{
@@ -374,6 +382,7 @@ error:
return -1;
} /* end test_long_desc() */
+#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
diff --git a/test/fheap.c b/test/fheap.c
index 1ad5c11..ef47d94 100644
--- a/test/fheap.c
+++ b/test/fheap.c
@@ -539,6 +539,14 @@ get_fill_size(const fheap_test_param_t *tparam)
*
*-------------------------------------------------------------------------
*/
+/* Disable warning for "format not a string literal" here -QAK */
+/*
+ * This pragma only needs to surround the snprintf() calls with
+ * test_desc in the code below, but early (4.4.7, at least) gcc only
+ * allows diagnostic pragmas to be toggled outside of functions.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static int
begin_test(fheap_test_param_t *tparam, const char *base_desc,
fheap_heap_ids_t *keep_ids, size_t *fill_size)
@@ -567,6 +575,7 @@ begin_test(fheap_test_param_t *tparam, const char *base_desc,
/* Success */
return(0);
} /* end begin_test() */
+#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
diff --git a/test/file_image.c b/test/file_image.c
index 86dd13e..ddbec80 100644
--- a/test/file_image.c
+++ b/test/file_image.c
@@ -672,6 +672,14 @@ error:
*
******************************************************************************
*/
+/* Disable warning for "format not a string literal" here -QAK */
+/*
+ * This pragma only needs to surround the snprintf() calls with
+ * 'member_file_name' in the code below, but early (4.4.7, at least) gcc only
+ * allows diagnostic pragmas to be toggled outside of functions.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static int
test_get_file_image(const char * test_banner,
const int file_name_num,
@@ -938,6 +946,7 @@ test_get_file_image(const char * test_banner,
error:
return 1;
} /* end test_get_file_image() */
+#pragma GCC diagnostic pop
/******************************************************************************
diff --git a/test/h5test.c b/test/h5test.c
index 99b2010..d83c6e7 100644
--- a/test/h5test.c
+++ b/test/h5test.c
@@ -190,6 +190,14 @@ h5_clean_files(const char *base_name[], hid_t fapl)
*
*-------------------------------------------------------------------------
*/
+/* Disable warning for "format not a string literal" here -QAK */
+/*
+ * This pragma only needs to surround the snprintf() calls with
+ * sub_filename in the code below, but early (4.4.7, at least) gcc only
+ * allows diagnostic pragmas to be toggled outside of functions.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
void
h5_delete_test_file(const char *base_name, hid_t fapl)
{
@@ -239,6 +247,7 @@ h5_delete_test_file(const char *base_name, hid_t fapl)
return;
} /* end h5_delete_test_file() */
+#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
@@ -1344,6 +1353,14 @@ h5_dump_info_object(MPI_Info info)
*
*-------------------------------------------------------------------------
*/
+/* Disable warning for "format not a string literal" here -QAK */
+/*
+ * This pragma only needs to surround the snprintf() calls with
+ * temp in the code below, but early (4.4.7, at least) gcc only
+ * allows diagnostic pragmas to be toggled outside of functions.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
h5_stat_size_t
h5_get_file_size(const char *filename, hid_t fapl)
{
@@ -1445,12 +1462,14 @@ h5_get_file_size(const char *filename, hid_t fapl)
return(-1);
} /* end get_file_size() */
+#pragma GCC diagnostic pop
/*
* This routine is designed to provide equivalent functionality to 'printf'
* and allow easy replacement for environments which don't have stdin/stdout
* available. (i.e. Windows & the Mac)
*/
+H5_ATTR_FORMAT(printf, 1, 2)
int
print_func(const char *format, ...)
{
@@ -2016,7 +2035,7 @@ error:
*
*-------------------------------------------------------------------------
*/
-const char *
+H5_ATTR_PURE const char *
h5_get_version_string(H5F_libver_t libver)
{
return(LIBVER_NAMES[libver]);
diff --git a/test/use_disable_mdc_flushes.c b/test/use_disable_mdc_flushes.c
index 340f578..67e2226 100644
--- a/test/use_disable_mdc_flushes.c
+++ b/test/use_disable_mdc_flushes.c
@@ -108,28 +108,28 @@ parse_option(int argc, char * const argv[])
filename_g = optarg;
break;
case 'n': /* number of planes to write/read */
- if ((nplanes_g = atoi(optarg)) <= 0){
+ if ((nplanes_g = HDatoi(optarg)) <= 0){
fprintf(stderr, "bad number of planes %s, must be a positive integer\n", optarg);
usage(progname_g);
Hgoto_error(-1);
};
break;
case 's': /* use swmr file open mode */
- if ((use_swmr_g = atoi(optarg)) < 0){
+ if ((use_swmr_g = HDatoi(optarg)) < 0){
fprintf(stderr, "swmr value should be 0(no) or 1(yes)\n");
usage(progname_g);
Hgoto_error(-1);
};
break;
case 'y': /* Number of planes per chunk */
- if ((chunkplanes_g = atoi(optarg)) <= 0){
+ if ((chunkplanes_g = HDatoi(optarg)) <= 0){
fprintf(stderr, "bad number of planes per chunk %s, must be a positive integer\n", optarg);
usage(progname_g);
Hgoto_error(-1);
};
break;
case 'z': /* size of chunk=(z,z) */
- if ((chunksize_g = atoi(optarg)) <= 0){
+ if ((chunksize_g = HDatoi(optarg)) <= 0){
fprintf(stderr, "bad chunksize %s, must be a positive integer\n", optarg);
usage(progname_g);
Hgoto_error(-1);
diff --git a/test/vfd.c b/test/vfd.c
index 2305593..b196406 100644
--- a/test/vfd.c
+++ b/test/vfd.c
@@ -769,6 +769,14 @@ error:
*
*-------------------------------------------------------------------------
*/
+/* Disable warning for "format not a string literal" here -QAK */
+/*
+ * This pragma only needs to surround the snprintf() calls with
+ * 'first_name' in the code below, but early (4.4.7, at least) gcc only
+ * allows diagnostic pragmas to be toggled outside of functions.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static herr_t
test_family_opens(char *fname, hid_t fa_pl)
{
@@ -825,6 +833,7 @@ test_family_opens(char *fname, hid_t fa_pl)
error:
return -1;
} /* end test_family_opens() */
+#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
@@ -1027,6 +1036,14 @@ error:
*
*-------------------------------------------------------------------------
*/
+/* Disable warning for "format not a string literal" here -QAK */
+/*
+ * This pragma only needs to surround the snprintf() calls with
+ * 'newname_individual', etc. in the code below, but early (4.4.7, at least) gcc only
+ * allows diagnostic pragmas to be toggled outside of functions.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static herr_t
test_family_compat(void)
{
@@ -1110,6 +1127,7 @@ error:
return -1;
} /* end test_family_compat() */
+#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------
@@ -1125,6 +1143,14 @@ error:
*
*-------------------------------------------------------------------------
*/
+/* Disable warning for "format not a string literal" here -QAK */
+/*
+ * This pragma only needs to surround the snprintf() calls with
+ * 'sf_name' in the code below, but early (4.4.7, at least) gcc only
+ * allows diagnostic pragmas to be toggled outside of functions.
+ */
+#pragma GCC diagnostic push
+#pragma GCC diagnostic ignored "-Wformat-nonliteral"
static herr_t
test_multi_opens(char *fname)
{
@@ -1142,6 +1168,7 @@ test_multi_opens(char *fname)
return(fid >= 0 ? FAIL : SUCCEED);
} /* end test_multi_opens() */
+#pragma GCC diagnostic pop
/*-------------------------------------------------------------------------