summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2022-07-11 17:28:02 (GMT)
committerGitHub <noreply@github.com>2022-07-11 17:28:02 (GMT)
commite269f9036474b9d5b3c88d865e7bb20ecad5c54c (patch)
treeaa5313f198b044605d6b135cd4499cc2f91eacee /src
parent0412d3f292b255da700d865fd1eb990e05c038bb (diff)
downloadhdf5-e269f9036474b9d5b3c88d865e7bb20ecad5c54c.zip
hdf5-e269f9036474b9d5b3c88d865e7bb20ecad5c54c.tar.gz
hdf5-e269f9036474b9d5b3c88d865e7bb20ecad5c54c.tar.bz2
Misc clang warning fixes (#1869)
* Minor clang warning fixes in src and test * Fixes clang warnings in high-level library * clang format-nonliteral warning fixes * Committing clang-format changes * Fixed int -> float clang cast warnings in h5diff * Quiets some warnings in flex/bison generated code * Suppress overlong string warning for libinfo on clang Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src')
-rw-r--r--src/H5FDfamily.c5
-rw-r--r--src/H5HFcache.c12
-rw-r--r--src/H5make_libsettings.c2
3 files changed, 15 insertions, 4 deletions
diff --git a/src/H5FDfamily.c b/src/H5FDfamily.c
index fa4eb6f..e6ba5a7 100644
--- a/src/H5FDfamily.c
+++ b/src/H5FDfamily.c
@@ -1531,8 +1531,11 @@ H5FD__family_delete(const char *filename, hid_t fapl_id)
HGOTO_ERROR(H5E_VFL, H5E_CANTALLOC, FAIL, "unable to allocate temporary member name")
/* Sanity check to make sure that generated names are unique */
+ H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
HDsnprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 0);
HDsnprintf(temp, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, 1);
+ H5_GCC_CLANG_DIAG_ON("format-nonliteral")
+
if (!HDstrcmp(member_name, temp)) {
if (default_config) {
temp = H5MM_xfree(temp);
@@ -1549,7 +1552,9 @@ H5FD__family_delete(const char *filename, hid_t fapl_id)
current_member = 0;
while (1) {
/* Fix up the filename with the current member's number */
+ H5_GCC_CLANG_DIAG_OFF("format-nonliteral")
HDsnprintf(member_name, H5FD_FAM_MEMB_NAME_BUF_SIZE, filename, current_member);
+ H5_GCC_CLANG_DIAG_ON("format-nonliteral")
/* Attempt to delete the member files. If the first file throws an error
* we always consider this an error. With subsequent member files, however,
diff --git a/src/H5HFcache.c b/src/H5HFcache.c
index 331b580..f5a03f5 100644
--- a/src/H5HFcache.c
+++ b/src/H5HFcache.c
@@ -742,9 +742,11 @@ H5HF__cache_hdr_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG_UN
HDassert(len == hdr->heap_size);
/* Set the shared heap header's file context for this operation */
- H5_GCC_CLANG_DIAG_OFF("discarded-qualifiers")
+ H5_GCC_DIAG_OFF("discarded-qualifiers")
+ H5_CLANG_DIAG_OFF("incompatible-pointer-types-discards-qualifiers")
hdr->f = f;
- H5_GCC_CLANG_DIAG_ON("discarded-qualifiers")
+ H5_GCC_DIAG_ON("discarded-qualifiers")
+ H5_CLANG_DIAG_ON("incompatible-pointer-types-discards-qualifiers")
/* Magic number */
H5MM_memcpy(image, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC);
@@ -1330,9 +1332,11 @@ H5HF__cache_iblock_serialize(const H5F_t *f, void *_image, size_t H5_ATTR_NDEBUG
hdr = iblock->hdr;
/* Set the shared heap header's file context for this operation */
- H5_GCC_CLANG_DIAG_OFF("discarded-qualifiers")
+ H5_GCC_DIAG_OFF("discarded-qualifiers")
+ H5_CLANG_DIAG_OFF("incompatible-pointer-types-discards-qualifiers")
hdr->f = f;
- H5_GCC_CLANG_DIAG_ON("discarded-qualifiers")
+ H5_GCC_DIAG_ON("discarded-qualifiers")
+ H5_CLANG_DIAG_ON("incompatible-pointer-types-discards-qualifiers")
/* Magic number */
H5MM_memcpy(image, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC);
diff --git a/src/H5make_libsettings.c b/src/H5make_libsettings.c
index 6d9c3c9..10579e4 100644
--- a/src/H5make_libsettings.c
+++ b/src/H5make_libsettings.c
@@ -71,6 +71,7 @@ insert_libhdf5_settings(FILE *flibinfo)
*/
HDfprintf(flibinfo, "#include \"H5private.h\"\n");
HDfprintf(flibinfo, "H5_GCC_DIAG_OFF(\"larger-than=\")\n\n");
+ HDfprintf(flibinfo, "H5_CLANG_DIAG_OFF(\"overlength-strings\")\n\n");
/* Print variable definition and the string. Do not use const or some
* platforms (AIX?) will have issues.
@@ -110,6 +111,7 @@ insert_libhdf5_settings(FILE *flibinfo)
/* Re-enable warnings for large arrays */
HDfprintf(rawoutstream, "H5_GCC_DIAG_ON(\"larger-than=\")\n");
+ HDfprintf(rawoutstream, "H5_CLANG_DIAG_OFF(\"overlength-strings\")\n");
#else
/* Print variable definition and an empty string. Do not use const or some
* platforms (AIX?) will have issues.