diff options
| author | Adhemerval Zanella <adhemerval.zanella@linaro.org> | 2022-03-25 11:23:35 -0300 |
|---|---|---|
| committer | H.J. Lu <hjl.tools@gmail.com> | 2024-12-22 17:35:33 +0800 |
| commit | 27a4b6421f488753aab982dfa2b873498fe58fa2 (patch) | |
| tree | de09f49be85eb6a028e0565656535315fafafa5d /dirent | |
| parent | 77c1128bd35009285820a5e92aa585bb74e2a5ae (diff) | |
| download | glibc-27a4b6421f488753aab982dfa2b873498fe58fa2.tar.xz glibc-27a4b6421f488753aab982dfa2b873498fe58fa2.zip | |
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>
Diffstat (limited to 'dirent')
| -rw-r--r-- | dirent/tst-readdir-long.c | 4 | ||||
| -rw-r--r-- | dirent/tst-rewinddir.c | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/dirent/tst-readdir-long.c b/dirent/tst-readdir-long.c index 409318fa52..2a9db5901d 100644 --- a/dirent/tst-readdir-long.c +++ b/dirent/tst-readdir-long.c @@ -26,6 +26,7 @@ #include <support/support.h> #include <support/xdirent.h> #include <support/readdir.h> +#include <libc-diag.h> /* If positive, at this length an EMSGSIZE error is injected. */ static _Atomic int inject_error_at_length; @@ -59,7 +60,10 @@ add_directory_entry (struct support_fuse_dirstream *d, uint64_t offset) if (offset <= 1) { type = DT_DIR; + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wstring-plus-int"); name = ".." + !offset; /* "." or "..". */ + DIAG_POP_NEEDS_COMMENT_CLANG; ino = 1; } else if (length == 1000) diff --git a/dirent/tst-rewinddir.c b/dirent/tst-rewinddir.c index 1479766ebe..891c7e7e48 100644 --- a/dirent/tst-rewinddir.c +++ b/dirent/tst-rewinddir.c @@ -24,17 +24,21 @@ #include <support/readdir.h> #include <support/support.h> #include <support/xdirent.h> +#include <libc-diag.h> /* Return the file name at the indicated directory offset. */ static char * name_at_offset (unsigned int offset) { + DIAG_PUSH_NEEDS_COMMENT_CLANG; + DIAG_IGNORE_NEEDS_COMMENT_CLANG (13, "-Wstring-plus-int"); if (offset <= 1) return xstrdup (".." + !offset); /* "." or "..". */ else /* Pad the name with a lot of zeros, so that the dirent buffer gets filled more quickly. */ return xasprintf ("file%0240u", offset); + DIAG_POP_NEEDS_COMMENT_CLANG; } /* This many directory entries, including "." and "..". */ |
