From 2be6e9e3633e05315a287ec0a647dd336b828ae5 Mon Sep 17 00:00:00 2001 From: Dana Robinson <43805+derobins@users.noreply.github.com> Date: Wed, 10 Nov 2021 13:04:19 -0800 Subject: [PATCH] Quiets const warning in H5RS code (#1181) --- src/H5RS.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/H5RS.c b/src/H5RS.c index 141ea2e4958..35d4436a8a4 100644 --- a/src/H5RS.c +++ b/src/H5RS.c @@ -174,8 +174,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 */ + /* 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_DIAG_OFF("cast-qual") ret_value->s = (char *)s; + H5_GCC_DIAG_ON("cast-qual") + ret_value->wrapped = 1; ret_value->n = 1;