diff options
author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-03-25 11:23:35 -0300 |
---|---|---|
committer | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2024-04-17 16:12:40 -0300 |
commit | 0fe003b0235263f296e5c7463deadc9a7b797970 (patch) | |
tree | 452fe5c05709cd404d4c509478f716fb3ddacff6 | |
parent | 790e19f1d14a247289e18842c9d8e7c0ca1d7b79 (diff) | |
download | glibc-0fe003b0235263f296e5c7463deadc9a7b797970.tar.gz glibc-0fe003b0235263f296e5c7463deadc9a7b797970.tar.xz glibc-0fe003b0235263f296e5c7463deadc9a7b797970.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.c | 7 |
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; |