This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] Remove defines to builtins in string2.h
On 11/22/2016 03:35 PM, Wilco Dijkstra wrote:
As discussed in https://sourceware.org/ml/libc-alpha/2016-11/msg00625.html,
for C90 functions there is no need to use define to use the GCC builtin as
an optimization. Also other headers already ensure (most) non-C90 symbols
are redirected to avoid name space clashes.
-#ifndef _HAVE_STRING_ARCH_strchr
-# define strchr(s, c) __builtin_strchr (s, c)
-#endif
Please remove the definition of _HAVE_STRING_ARCH_strchr as well (from
sysdeps/x86/bits/string.h).
-/* Copy SRC to DEST, returning pointer to final NUL byte. */
-#ifdef __USE_GNU
-# ifndef _HAVE_STRING_ARCH_stpcpy
-# define __stpcpy(dest, src) __builtin_stpcpy (dest, src)
-/* In glibc we use this function frequently but for namespace reasons
- we have to use the name `__stpcpy'. */
-# define stpcpy(dest, src) __stpcpy (dest, src)
-# endif
-#endif
I'm surprised to see stpcpy in this patch because the first paragraph
says this change is exclusively about C90 functions, and stpcpy isn't one.
-/* Copy no more than N characters of SRC to DEST. */
-#ifndef _HAVE_STRING_ARCH_strncpy
-# define strncpy(dest, src, n) __builtin_strncpy (dest, src, n)
-#endif
_HAVE_STRING_ARCH_strncpy needs removal.
-#ifndef _HAVE_STRING_ARCH_strncat
-# ifdef _USE_STRING_ARCH_strchr
These two need to be removed as well. I'm not listing the other feature
macros which can be removed.
-#if !defined _HAVE_STRING_ARCH_strsep
-# ifdef __USE_MISC
-# define strsep(s, reject) __strsep (s, reject)
-# endif
-#endif
See above, not a C90 function.
Thanks,
Florian