[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

string handling backport from CVS



Anyone object if I add:

2004-05-26  Jakub Jelinek  <jakub@redhat.com>

        * include/string.h (mempcpy, stpcpy): Add
libc_hidden_builtin_proto.
        * 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
is
        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
are
        constant.
        (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
completeness)

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)

Tks,
Jeff Bailey

-- 
I never know what to expect when you respond to my postings. No insult
intended, you are merely a surprise :)
 - Carlos O'Donnell

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: