1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Hide memset/bzero from compiler

Hide memset/bzero from compiler to silence Clang error:

./tester.c:1345:29: error: 'size' argument to memset is '0'; did you mean to transpose the last two arguments? [-Werror,-Wmemset-transposed-args]
 1345 |   (void) memset(one+2, 'y', 0);
      |                             ^
./tester.c:1345:29: note: parenthesize the third argument to silence
./tester.c:1432:16: error: 'size' argument to bzero is '0' [-Werror,-Wsuspicious-bzero]
 1432 |   bzero(one+2, 0);
      |                ^
./tester.c:1432:16: note: parenthesize the second argument to silence

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Reviewed-by: Sam James <sam@gentoo.org>
This commit is contained in:
H.J. Lu
2024-12-18 02:38:26 +08:00
parent eb02fb7739
commit 3d54e957c9

View File

@ -50,6 +50,15 @@ DIAG_IGNORE_NEEDS_COMMENT (11, "-Wstringop-overread");
#include <strings.h> #include <strings.h>
#include <fcntl.h> #include <fcntl.h>
static __typeof (bzero) * volatile bzero_indirect = bzero;
static __typeof (memset) * volatile memset_indirect = memset;
#undef bzero
#undef memset
#define bzero bzero_indirect
#define memset memset_indirect
/* This file tests a range of corner cases of string functions, /* This file tests a range of corner cases of string functions,
including cases where truncation occurs or where sizes specified including cases where truncation occurs or where sizes specified
are larger than the actual buffers, which result in various are larger than the actual buffers, which result in various