summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDana Robinson <43805+derobins@users.noreply.github.com>2021-11-10 21:04:19 (GMT)
committerGitHub <noreply@github.com>2021-11-10 21:04:19 (GMT)
commitf12228c9f26f27a3c0a68811eb86fa665174ffd7 (patch)
treeec34a4b97511a14ce1a641f321e82c0de23ba74c /src
parenta777e3075ef51adb15d2618c6d2fa4687444a098 (diff)
downloadhdf5-f12228c9f26f27a3c0a68811eb86fa665174ffd7.zip
hdf5-f12228c9f26f27a3c0a68811eb86fa665174ffd7.tar.gz
hdf5-f12228c9f26f27a3c0a68811eb86fa665174ffd7.tar.bz2
Quiets const warning in H5RS code (#1181)
Diffstat (limited to 'src')
-rw-r--r--src/H5RS.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/H5RS.c b/src/H5RS.c
index ceae19c..117c8ea 100644
--- a/src/H5RS.c
+++ b/src/H5RS.c
@@ -313,8 +313,16 @@ H5RS_wrap(const char *s)
if (NULL == (ret_value = H5FL_MALLOC(H5RS_str_t)))
HGOTO_ERROR(H5E_RS, H5E_CANTALLOC, NULL, "memory allocation failed")
- /* Set the internal fields */
- ret_value->s = (char *)s;
+ /* Set the internal fields
+ *
+ * We ignore warnings about storing a const char pointer in the struct
+ * since we never modify or free the string when the wrapped struct
+ * field is set to TRUE.
+ */
+ H5_GCC_CLANG_DIAG_OFF("cast-qual")
+ ret_value->s = (char *)s;
+ H5_GCC_CLANG_DIAG_ON("cast-qual")
+
ret_value->len = HDstrlen(s);
ret_value->end = ret_value->s + ret_value->len;