1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00

* posix/bits/unistd.h: Avoid calling __*_chk variants if we can

determine the call will never trigger a failure.

	* sysdeps/i386/i686/memset_chk.S: Remove alias and warning.
	* sysdeps/x86_64/memset_chk.S: Likewise.

2005-02-24  Roland McGrath  <roland@redhat.com>

	* debug/Versions (libc: GLIBC_2.4): Remove
	__memset_zero_constant_len_parameter.
	* sysdeps/generic/memset_chk.c: Remove alias and warning.
	* misc/sys/cdefs.h (__warndecl): New macro.
	* debug/warning-nop.c: New file.
	* string/bits/string3.h (memset): Call __warn_memset_zero_len with no
	arguments, instead of calling __memset_zero_constant_len_parameter.
	Use __warndecl for __warn_memset_zero_len.
	* debug/Makefile (routines): Add $(static-only-routines).
	(static-only-routines): New variable.
This commit is contained in:
Ulrich Drepper
2005-03-01 00:35:23 +00:00
parent cffa6970f9
commit 61062f5630
12 changed files with 83 additions and 34 deletions

View File

@@ -85,11 +85,11 @@ __mempcpy_ichk (void *__restrict __dest, const void *__restrict __src,
especially problematic if the intended fill value is zero. In this
case no work is done at all. We detect these problems by referring
non-existing functions. */
extern char *__memset_zero_constant_len_parameter (void *, int, size_t,
size_t);
__warndecl (__warn_memset_zero_len,
"memset used with constant zero length parameter; this could be due to transposed parameters");
#define memset(dest, ch, len) \
(__builtin_constant_p (len) && (len) == 0 \
? __memset_zero_constant_len_parameter (dest, ch, len, 0) \
? (__warn_memset_zero_len (), (void) (ch), (void) (len), (void *) (dest)) \
: ((__bos0 (dest) != (size_t) -1) \
? __builtin___memset_chk (dest, ch, len, __bos0 (dest)) \
: __memset_ichk (dest, ch, len)))