aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhemerval Zanella <adhemerval.zanella@linaro.org>2022-03-25 11:23:35 -0300
committerAdhemerval Zanella <adhemerval.zanella@linaro.org>2024-02-09 10:29:18 -0300
commitda6415da48882f2b115e21a5b63f7f8e397ab529 (patch)
treefa34154fb5222c4a138d4f7355e6e7da991a1dfa
parente295575a073fb0105f8bc3053566c0274aee67c9 (diff)
downloadglibc-da6415da48882f2b115e21a5b63f7f8e397ab529.tar
glibc-da6415da48882f2b115e21a5b63f7f8e397ab529.tar.gz
glibc-da6415da48882f2b115e21a5b63f7f8e397ab529.tar.bz2
glibc-da6415da48882f2b115e21a5b63f7f8e397ab529.zip
posix: Suppress clang warning on bug-regex24
clang complains that adding a 'regoff_t' to a string doe snot append to it, and the printf idea below is to make rm_so an offset.
-rw-r--r--posix/bug-regex24.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/posix/bug-regex24.c b/posix/bug-regex24.c
index 97c5c3508a..7a655cbc4d 100644
--- a/posix/bug-regex24.c
+++ b/posix/bug-regex24.c
@@ -1,6 +1,7 @@
#include <regex.h>
#include <stdio.h>
#include <string.h>
+#include <libc-diag.h>
#define str "civic"
@@ -45,11 +46,17 @@ do_test (void)
{
int len = m[i].rm_eo - m[i].rm_so;
+ /* clang complains that adding a 'regoff_t' to a string does not
+ append to it, and the printf idea below is to make rm_so as
+ an offset to str. */
+ DIAG_PUSH_NEEDS_COMMENT_CLANG;
+ DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wstring-plus-int");
printf ("m[%d] = \"%.*s\"\n", i, len, str + m[i].rm_so);
if (strlen (expected[i]) != len
|| memcmp (expected[i], str + m[i].rm_so, len) != 0)
result = 1;
+ DIAG_POP_NEEDS_COMMENT_CLANG;
}
return result;