Re: string handling backport from CVS
At Mon, 19 Jul 2004 23:10:57 -0400,
Jeff Bailey wrote:
> Anyone object if I add:
> 2004-05-26 Jakub Jelinek <email@example.com>
> * include/string.h (mempcpy, stpcpy): Add
> * string/bits/string2.h (memset): Disable macro for GCC 3.0+.
> (__mempcpy): Use __builtin_mempcpy for GCC 3.4+.
> (strchr): For GCC 3.2+, only use __rawmemchr if second argument
> constant '\0' and first argument is not constant.
> (__stpcpy): Use __builtin_stpcpy for GCC 3.4+.
> (strncpy): Remove #ifdef _USE_STRING_ARCH_mempcpy variant.
> For GCC 3.2+ use __builtin_strncpy.
> (strncat): For GCC 3.2+ use __builtin_strncat.
> (strcmp): For GCC 3.2+ use __builtin_strcmp if both arguments
> (strcspn, strspn, strpbrk): For GCC 3.2+, use builtin function
> if both arguments are constant.
> (There's a follow up patch to this that should also be included for
> To glibc? Using the gcc builtins fixes a segfault on the Hurd where
> threads are used in a statically linked executable. Like the root
> filesystem. =)
> I don't know enough about string handling in gcc to know for certain how
> safe this is. I will cheerfully test on i386, sparc, ia64 and hppa to
> make sure though.
> (I'll do this if no objections by the end of OLS)
I have no objection because you tested it, but I think it's good idea
that you provide the patch.