mirror of
https://mirrors.tuna.tsinghua.edu.cn/git/glibc.git
synced 2026-01-12 00:20:19 +08:00
Suppress Clang warning on adding an integer to a string
Suppress Clang warning on adding an integer to a string, like:
tst-iconv-sticky-input-error.c:125:42: error: adding 'int' to a string does not append to the string [-Werror,-Wstring-plus-int]
125 | expected_output = "ABXY" + skip;
| ~~~~~~~^~~~~~
tst-iconv-sticky-input-error.c:125:42: note: use array indexing to silence this warning
125 | expected_output = "ABXY" + skip;
| ^
| & [ ]
Co-Authored-By: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
committed by
H.J. Lu
parent
77c1128bd3
commit
27a4b6421f
@@ -26,6 +26,7 @@
|
||||
#include <support/support.h>
|
||||
#include <support/test-driver.h>
|
||||
#include <stdio.h>
|
||||
#include <libc-diag.h>
|
||||
|
||||
/* FROM is the input character set, TO the output character set. If
|
||||
IGNORE is true, the iconv descriptor is set up in the same way as
|
||||
@@ -121,12 +122,15 @@ do_test (void)
|
||||
for (int skip = 0; skip < 3; ++skip)
|
||||
{
|
||||
const char *expected_output;
|
||||
DIAG_PUSH_NEEDS_COMMENT_CLANG;
|
||||
DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wstring-plus-int");
|
||||
if (do_ignore || strstr (charsets[to_idx], "//IGNORE") != NULL)
|
||||
expected_output = "ABXY" + skip;
|
||||
else
|
||||
expected_output = "AB" + skip;
|
||||
one_direction (charsets[from_idx], charsets[to_idx], do_ignore,
|
||||
"AB\xffXY" + skip, expected_output, limit);
|
||||
DIAG_POP_NEEDS_COMMENT_CLANG;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
||||
Reference in New Issue
Block a user