From patchwork Sun May 24 15:27:06 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?b?T25kxZllaiBCw61sa2E=?= X-Patchwork-Id: 475979 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 124B21402B6 for ; Mon, 25 May 2015 01:27:52 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=sourceware.org header.i=@sourceware.org header.b=xP3cATJg; dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:references :mime-version:content-type:in-reply-to; q=dns; s=default; b=xVAq ooHlc2gj7ZIU4RFemmp8JwsSKH3KlhqclJ3bIIXd0IblIpQAKu94h6J66IULjieS YhuThnixsIWqAtuZIkfMRHkUUNRwRnZ4VrtLvzoAdoWmmlHX9CJqsGKXswGEj+4g kZd0GmBOjl1l6IXXPZC6yczJR7H7LPtSaaaCMAQ= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:date:from:to:subject:message-id:references :mime-version:content-type:in-reply-to; s=default; bh=9kT7LnxLA4 d3PsUcKbAR/KvZU2M=; b=xP3cATJgjreC+/45w2l3/o9J0svmH4GRciLyFnEjUO So53C8Rga4JH1bC2iYF/A1hKmPjWksGNokjWOSk/bD0qxz+J5oNEDoCIBJX3cJXO hLAskkffbOsnnQdtdVl216PcTwz0fml/IGF2o3B/iZ7nQVEGGq/0heXRhF1WnCrD g= Received: (qmail 44615 invoked by alias); 24 May 2015 15:27:45 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Delivered-To: mailing list libc-alpha@sourceware.org Received: (qmail 44604 invoked by uid 89); 24 May 2015 15:27:44 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.0 required=5.0 tests=AWL, BAYES_05, FREEMAIL_FROM, SPF_NEUTRAL autolearn=no version=3.3.2 X-HELO: popelka.ms.mff.cuni.cz Date: Sun, 24 May 2015 17:27:06 +0200 From: =?utf-8?B?T25kxZllaiBCw61sa2E=?= To: libc-alpha@sourceware.org Subject: Re: [PATCH 2/*] Remove pre-gcc 3.4 string inline optimizations. Message-ID: <20150524152706.GB31589@domone> References: <20150524150715.GA31589@domone> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20150524150715.GA31589@domone> User-Agent: Mutt/1.5.20 (2009-06-14) As described before this removes optimization for gcc older than 3.4. Change is mechanical of checking which defines evaluate to false. Also ok to commit? * string/bits/string2.h [!_GNUC_PREREQ (3,4)] Remove. diff --git a/string/bits/string2.h b/string/bits/string2.h index 7645176..a595c74 100644 --- a/string/bits/string2.h +++ b/string/bits/string2.h @@ -92,111 +92,6 @@ __STRING2_COPY_TYPE (8); #define __string2_1bptr_p(__x) \ ((size_t)(const void *)((__x) + 1) - (size_t)(const void *)(__x) == 1) -/* Set N bytes of S to C. */ -#if !defined _HAVE_STRING_ARCH_memset -# if !__GNUC_PREREQ (3, 0) -# if _STRING_ARCH_unaligned -# define memset(s, c, n) \ - (__extension__ (__builtin_constant_p (n) && (n) <= 16 \ - ? ((n) == 1 \ - ? __memset_1 (s, c) \ - : __memset_gc (s, c, n)) \ - : (__builtin_constant_p (c) && (c) == '\0' \ - ? ({ void *__s = (s); __bzero (__s, n); __s; }) \ - : memset (s, c, n)))) - -# define __memset_1(s, c) ({ void *__s = (s); \ - *((__uint8_t *) __s) = (__uint8_t) c; __s; }) - -# define __memset_gc(s, c, n) \ - ({ void *__s = (s); \ - union { \ - unsigned int __ui; \ - unsigned short int __usi; \ - unsigned char __uc; \ - } *__u = __s; \ - __uint8_t __c = (__uint8_t) (c); \ - \ - /* This `switch' statement will be removed at compile-time. */ \ - switch ((unsigned int) (n)) \ - { \ - case 15: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 11: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 7: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 3: \ - __u->__usi = (unsigned short int) __c * 0x0101; \ - __u = __extension__ ((void *) __u + 2); \ - __u->__uc = (unsigned char) __c; \ - break; \ - \ - case 14: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 10: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 6: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 2: \ - __u->__usi = (unsigned short int) __c * 0x0101; \ - break; \ - \ - case 13: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 9: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 5: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 1: \ - __u->__uc = (unsigned char) __c; \ - break; \ - \ - case 16: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 12: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 8: \ - __u->__ui = __c * 0x01010101; \ - __u = __extension__ ((void *) __u + 4); \ - case 4: \ - __u->__ui = __c * 0x01010101; \ - case 0: \ - break; \ - } \ - \ - __s; }) -# else -# define memset(s, c, n) \ - (__extension__ (__builtin_constant_p (c) && (c) == '\0' \ - ? ({ void *__s = (s); __bzero (__s, n); __s; }) \ - : memset (s, c, n))) -# endif -# endif - -/* GCC < 3.0 optimizes memset(s, 0, n) but not bzero(s, n). - The optimization is broken before EGCS 1.1. - GCC 3.0+ has __builtin_bzero as well, but at least till GCC 3.4 - if it decides to call the library function, it calls memset - and not bzero. */ -# if __GNUC_PREREQ (2, 91) -# define __bzero(s, n) __builtin_memset (s, '\0', n) -# endif - -#endif - - /* Copy N bytes from SRC to DEST, returning pointer to byte following the last copied. */ #ifdef __USE_GNU @@ -204,186 +99,11 @@ __STRING2_COPY_TYPE (8); # ifndef _HAVE_STRING_ARCH_mempcpy # if __GNUC_PREREQ (3, 4) # define __mempcpy(dest, src, n) __builtin_mempcpy (dest, src, n) -# elif __GNUC_PREREQ (3, 0) -# define __mempcpy(dest, src, n) \ - (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ - && __string2_1bptr_p (src) && n <= 8 \ - ? __builtin_memcpy (dest, src, n) + (n) \ - : __mempcpy (dest, src, n))) -# else -# define __mempcpy(dest, src, n) \ - (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ - && __string2_1bptr_p (src) && n <= 8 \ - ? __mempcpy_small (dest, __mempcpy_args (src), n) \ - : __mempcpy (dest, src, n))) # endif /* In glibc we use this function frequently but for namespace reasons we have to use the name `__mempcpy'. */ # define mempcpy(dest, src, n) __mempcpy (dest, src, n) # endif - -# if !__GNUC_PREREQ (3, 0) || defined _FORCE_INLINES -# if _STRING_ARCH_unaligned -# ifndef _FORCE_INLINES -# define __mempcpy_args(src) \ - ((const char *) (src))[0], ((const char *) (src))[2], \ - ((const char *) (src))[4], ((const char *) (src))[6], \ - __extension__ __STRING2_SMALL_GET16 (src, 0), \ - __extension__ __STRING2_SMALL_GET16 (src, 4), \ - __extension__ __STRING2_SMALL_GET32 (src, 0), \ - __extension__ __STRING2_SMALL_GET32 (src, 4) -# endif -__STRING_INLINE void *__mempcpy_small (void *, char, char, char, char, - __uint16_t, __uint16_t, __uint32_t, - __uint32_t, size_t); -__STRING_INLINE void * -__mempcpy_small (void *__dest1, - char __src0_1, char __src2_1, char __src4_1, char __src6_1, - __uint16_t __src0_2, __uint16_t __src4_2, - __uint32_t __src0_4, __uint32_t __src4_4, - size_t __srclen) -{ - union { - __uint32_t __ui; - __uint16_t __usi; - unsigned char __uc; - unsigned char __c; - } *__u = __dest1; - switch ((unsigned int) __srclen) - { - case 1: - __u->__c = __src0_1; - __u = __extension__ ((void *) __u + 1); - break; - case 2: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 2); - break; - case 3: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 2); - __u->__c = __src2_1; - __u = __extension__ ((void *) __u + 1); - break; - case 4: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - break; - case 5: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__c = __src4_1; - __u = __extension__ ((void *) __u + 1); - break; - case 6: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 2); - break; - case 7: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 2); - __u->__c = __src6_1; - __u = __extension__ ((void *) __u + 1); - break; - case 8: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__ui = __src4_4; - __u = __extension__ ((void *) __u + 4); - break; - } - return (void *) __u; -} -# else -# ifndef _FORCE_INLINES -# define __mempcpy_args(src) \ - ((const char *) (src))[0], \ - __extension__ ((__STRING2_COPY_ARR2) \ - { { ((const char *) (src))[0], ((const char *) (src))[1] } }), \ - __extension__ ((__STRING2_COPY_ARR3) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2] } }), \ - __extension__ ((__STRING2_COPY_ARR4) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3] } }), \ - __extension__ ((__STRING2_COPY_ARR5) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4] } }), \ - __extension__ ((__STRING2_COPY_ARR6) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5] } }), \ - __extension__ ((__STRING2_COPY_ARR7) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5], \ - ((const char *) (src))[6] } }), \ - __extension__ ((__STRING2_COPY_ARR8) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5], \ - ((const char *) (src))[6], ((const char *) (src))[7] } }) -# endif -__STRING_INLINE void *__mempcpy_small (void *, char, __STRING2_COPY_ARR2, - __STRING2_COPY_ARR3, - __STRING2_COPY_ARR4, - __STRING2_COPY_ARR5, - __STRING2_COPY_ARR6, - __STRING2_COPY_ARR7, - __STRING2_COPY_ARR8, size_t); -__STRING_INLINE void * -__mempcpy_small (void *__dest, char __src1, - __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, - __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, - __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, - __STRING2_COPY_ARR8 __src8, size_t __srclen) -{ - union { - char __c; - __STRING2_COPY_ARR2 __sca2; - __STRING2_COPY_ARR3 __sca3; - __STRING2_COPY_ARR4 __sca4; - __STRING2_COPY_ARR5 __sca5; - __STRING2_COPY_ARR6 __sca6; - __STRING2_COPY_ARR7 __sca7; - __STRING2_COPY_ARR8 __sca8; - } *__u = __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__c = __src1; - break; - case 2: - __extension__ __u->__sca2 = __src2; - break; - case 3: - __extension__ __u->__sca3 = __src3; - break; - case 4: - __extension__ __u->__sca4 = __src4; - break; - case 5: - __extension__ __u->__sca5 = __src5; - break; - case 6: - __extension__ __u->__sca6 = __src6; - break; - case 7: - __extension__ __u->__sca7 = __src7; - break; - case 8: - __extension__ __u->__sca8 = __src8; - break; - } - return __extension__ ((void *) __u + __srclen); -} -# endif -# endif # endif #endif @@ -397,359 +117,20 @@ extern void *__rawmemchr (const void *__s, int __c); && (c) == '\0' \ ? (char *) __rawmemchr (s, c) \ : __builtin_strchr (s, c))) -# else -# define strchr(s, c) \ - (__extension__ (__builtin_constant_p (c) && (c) == '\0' \ - ? (char *) __rawmemchr (s, c) \ - : strchr (s, c))) -# endif -#endif - - -/* Copy SRC to DEST. */ -#if (!defined _HAVE_STRING_ARCH_strcpy && !__GNUC_PREREQ (3, 0)) \ - || defined _FORCE_INLINES -# if !defined _HAVE_STRING_ARCH_strcpy && !__GNUC_PREREQ (3, 0) -# define strcpy(dest, src) \ - (__extension__ (__builtin_constant_p (src) \ - ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 \ - ? __strcpy_small (dest, __strcpy_args (src), \ - strlen (src) + 1) \ - : (char *) memcpy (dest, src, strlen (src) + 1)) \ - : strcpy (dest, src))) -# endif - -# if _STRING_ARCH_unaligned -# ifndef _FORCE_INLINES -# define __strcpy_args(src) \ - __extension__ __STRING2_SMALL_GET16 (src, 0), \ - __extension__ __STRING2_SMALL_GET16 (src, 4), \ - __extension__ __STRING2_SMALL_GET32 (src, 0), \ - __extension__ __STRING2_SMALL_GET32 (src, 4) -# endif -__STRING_INLINE char *__strcpy_small (char *, __uint16_t, __uint16_t, - __uint32_t, __uint32_t, size_t); -__STRING_INLINE char * -__strcpy_small (char *__dest, - __uint16_t __src0_2, __uint16_t __src4_2, - __uint32_t __src0_4, __uint32_t __src4_4, - size_t __srclen) -{ - union { - __uint32_t __ui; - __uint16_t __usi; - unsigned char __uc; - } *__u = (void *) __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__uc = '\0'; - break; - case 2: - __u->__usi = __src0_2; - break; - case 3: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 2); - __u->__uc = '\0'; - break; - case 4: - __u->__ui = __src0_4; - break; - case 5: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__uc = '\0'; - break; - case 6: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - break; - case 7: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 2); - __u->__uc = '\0'; - break; - case 8: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__ui = __src4_4; - break; - } - return __dest; -} -# else -# ifndef _FORCE_INLINES -# define __strcpy_args(src) \ - __extension__ ((__STRING2_COPY_ARR2) \ - { { ((const char *) (src))[0], '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR3) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR4) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR5) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR6) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR7) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5], \ - '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR8) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5], \ - ((const char *) (src))[6], '\0' } }) -# endif -__STRING_INLINE char *__strcpy_small (char *, __STRING2_COPY_ARR2, - __STRING2_COPY_ARR3, - __STRING2_COPY_ARR4, - __STRING2_COPY_ARR5, - __STRING2_COPY_ARR6, - __STRING2_COPY_ARR7, - __STRING2_COPY_ARR8, size_t); -__STRING_INLINE char * -__strcpy_small (char *__dest, - __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, - __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, - __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, - __STRING2_COPY_ARR8 __src8, size_t __srclen) -{ - union { - char __c; - __STRING2_COPY_ARR2 __sca2; - __STRING2_COPY_ARR3 __sca3; - __STRING2_COPY_ARR4 __sca4; - __STRING2_COPY_ARR5 __sca5; - __STRING2_COPY_ARR6 __sca6; - __STRING2_COPY_ARR7 __sca7; - __STRING2_COPY_ARR8 __sca8; - } *__u = (void *) __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__c = '\0'; - break; - case 2: - __extension__ __u->__sca2 = __src2; - break; - case 3: - __extension__ __u->__sca3 = __src3; - break; - case 4: - __extension__ __u->__sca4 = __src4; - break; - case 5: - __extension__ __u->__sca5 = __src5; - break; - case 6: - __extension__ __u->__sca6 = __src6; - break; - case 7: - __extension__ __u->__sca7 = __src7; - break; - case 8: - __extension__ __u->__sca8 = __src8; - break; - } - return __dest; -} # endif #endif - /* Copy SRC to DEST, returning pointer to final NUL byte. */ #ifdef __USE_GNU # if !defined _HAVE_STRING_ARCH_stpcpy || defined _FORCE_INLINES # ifndef _HAVE_STRING_ARCH_stpcpy # if __GNUC_PREREQ (3, 4) # define __stpcpy(dest, src) __builtin_stpcpy (dest, src) -# elif __GNUC_PREREQ (3, 0) -# define __stpcpy(dest, src) \ - (__extension__ (__builtin_constant_p (src) \ - ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 \ - ? __builtin_strcpy (dest, src) + strlen (src) \ - : ((char *) (__mempcpy) (dest, src, strlen (src) + 1) \ - - 1)) \ - : __stpcpy (dest, src))) -# else -# define __stpcpy(dest, src) \ - (__extension__ (__builtin_constant_p (src) \ - ? (__string2_1bptr_p (src) && strlen (src) + 1 <= 8 \ - ? __stpcpy_small (dest, __stpcpy_args (src), \ - strlen (src) + 1) \ - : ((char *) (__mempcpy) (dest, src, strlen (src) + 1) \ - - 1)) \ - : __stpcpy (dest, src))) # endif /* 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 - -# if !__GNUC_PREREQ (3, 0) || defined _FORCE_INLINES -# if _STRING_ARCH_unaligned -# ifndef _FORCE_INLINES -# define __stpcpy_args(src) \ - __extension__ __STRING2_SMALL_GET16 (src, 0), \ - __extension__ __STRING2_SMALL_GET16 (src, 4), \ - __extension__ __STRING2_SMALL_GET32 (src, 0), \ - __extension__ __STRING2_SMALL_GET32 (src, 4) -# endif -__STRING_INLINE char *__stpcpy_small (char *, __uint16_t, __uint16_t, - __uint32_t, __uint32_t, size_t); -__STRING_INLINE char * -__stpcpy_small (char *__dest, - __uint16_t __src0_2, __uint16_t __src4_2, - __uint32_t __src0_4, __uint32_t __src4_4, - size_t __srclen) -{ - union { - unsigned int __ui; - unsigned short int __usi; - unsigned char __uc; - char __c; - } *__u = (void *) __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__uc = '\0'; - break; - case 2: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 1); - break; - case 3: - __u->__usi = __src0_2; - __u = __extension__ ((void *) __u + 2); - __u->__uc = '\0'; - break; - case 4: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 3); - break; - case 5: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__uc = '\0'; - break; - case 6: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 1); - break; - case 7: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__usi = __src4_2; - __u = __extension__ ((void *) __u + 2); - __u->__uc = '\0'; - break; - case 8: - __u->__ui = __src0_4; - __u = __extension__ ((void *) __u + 4); - __u->__ui = __src4_4; - __u = __extension__ ((void *) __u + 3); - break; - } - return &__u->__c; -} -# else -# ifndef _FORCE_INLINES -# define __stpcpy_args(src) \ - __extension__ ((__STRING2_COPY_ARR2) \ - { { ((const char *) (src))[0], '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR3) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR4) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR5) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR6) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR7) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5], \ - '\0' } }), \ - __extension__ ((__STRING2_COPY_ARR8) \ - { { ((const char *) (src))[0], ((const char *) (src))[1], \ - ((const char *) (src))[2], ((const char *) (src))[3], \ - ((const char *) (src))[4], ((const char *) (src))[5], \ - ((const char *) (src))[6], '\0' } }) -# endif -__STRING_INLINE char *__stpcpy_small (char *, __STRING2_COPY_ARR2, - __STRING2_COPY_ARR3, - __STRING2_COPY_ARR4, - __STRING2_COPY_ARR5, - __STRING2_COPY_ARR6, - __STRING2_COPY_ARR7, - __STRING2_COPY_ARR8, size_t); -__STRING_INLINE char * -__stpcpy_small (char *__dest, - __STRING2_COPY_ARR2 __src2, __STRING2_COPY_ARR3 __src3, - __STRING2_COPY_ARR4 __src4, __STRING2_COPY_ARR5 __src5, - __STRING2_COPY_ARR6 __src6, __STRING2_COPY_ARR7 __src7, - __STRING2_COPY_ARR8 __src8, size_t __srclen) -{ - union { - char __c; - __STRING2_COPY_ARR2 __sca2; - __STRING2_COPY_ARR3 __sca3; - __STRING2_COPY_ARR4 __sca4; - __STRING2_COPY_ARR5 __sca5; - __STRING2_COPY_ARR6 __sca6; - __STRING2_COPY_ARR7 __sca7; - __STRING2_COPY_ARR8 __sca8; - } *__u = (void *) __dest; - switch ((unsigned int) __srclen) - { - case 1: - __u->__c = '\0'; - break; - case 2: - __extension__ __u->__sca2 = __src2; - break; - case 3: - __extension__ __u->__sca3 = __src3; - break; - case 4: - __extension__ __u->__sca4 = __src4; - break; - case 5: - __extension__ __u->__sca5 = __src5; - break; - case 6: - __extension__ __u->__sca6 = __src6; - break; - case 7: - __extension__ __u->__sca7 = __src7; - break; - case 8: - __extension__ __u->__sca8 = __src8; - break; - } - return __dest + __srclen - 1; -} -# endif -# endif # endif #endif @@ -758,13 +139,6 @@ __stpcpy_small (char *__dest, #ifndef _HAVE_STRING_ARCH_strncpy # if __GNUC_PREREQ (3, 2) # define strncpy(dest, src, n) __builtin_strncpy (dest, src, n) -# else -# define strncpy(dest, src, n) \ - (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ - ? (strlen (src) + 1 >= ((size_t) (n)) \ - ? (char *) memcpy (dest, src, n) \ - : strncpy (dest, src, n)) \ - : strncpy (dest, src, n))) # endif #endif @@ -782,13 +156,6 @@ __stpcpy_small (char *__dest, : strncat (dest, src, n); })) # elif __GNUC_PREREQ (3, 2) # define strncat(dest, src, n) __builtin_strncat (dest, src, n) -# else -# define strncat(dest, src, n) \ - (__extension__ (__builtin_constant_p (src) && __builtin_constant_p (n) \ - ? (strlen (src) < ((size_t) (n)) \ - ? strcat (dest, src) \ - : strncat (dest, src, n)) \ - : strncat (dest, src, n))) # endif #endif @@ -815,27 +182,6 @@ __stpcpy_small (char *__dest, ? __builtin_strcmp (s1, s2) \ : __strcmp_gc (s1, s2, __s2_len)) \ : __builtin_strcmp (s1, s2)))); }) -# else -# define strcmp(s1, s2) \ - __extension__ \ - ({ size_t __s1_len, __s2_len; \ - (__builtin_constant_p (s1) && __builtin_constant_p (s2) \ - && (__s1_len = strlen (s1), __s2_len = strlen (s2), \ - (!__string2_1bptr_p (s1) || __s1_len >= 4) \ - && (!__string2_1bptr_p (s2) || __s2_len >= 4)) \ - ? memcmp ((const char *) (s1), (const char *) (s2), \ - (__s1_len < __s2_len ? __s1_len : __s2_len) + 1) \ - : (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \ - && (__s1_len = strlen (s1), __s1_len < 4) \ - ? (__builtin_constant_p (s2) && __string2_1bptr_p (s2) \ - ? __strcmp_cc (s1, s2, __s1_len) \ - : __strcmp_cg (s1, s2, __s1_len)) \ - : (__builtin_constant_p (s2) && __string2_1bptr_p (s2) \ - && (__s2_len = strlen (s2), __s2_len < 4) \ - ? (__builtin_constant_p (s1) && __string2_1bptr_p (s1) \ - ? __strcmp_cc (s1, s2, __s2_len) \ - : __strcmp_gc (s1, s2, __s2_len)) \ - : strcmp (s1, s2)))); }) # endif # define __strcmp_cc(s1, s2, l) \ @@ -924,21 +270,6 @@ __stpcpy_small (char *__dest, ? __strcspn_c3 (s, __r0, __r1, __r2) \ : __builtin_strcspn (s, reject)))))) \ : __builtin_strcspn (s, reject)); }) -# else -# define strcspn(s, reject) \ - __extension__ \ - ({ char __r0, __r1, __r2; \ - (__builtin_constant_p (reject) && __string2_1bptr_p (reject) \ - ? ((__r0 = ((const char *) (reject))[0], __r0 == '\0') \ - ? strlen (s) \ - : ((__r1 = ((const char *) (reject))[1], __r1 == '\0') \ - ? __strcspn_c1 (s, __r0) \ - : ((__r2 = ((const char *) (reject))[2], __r2 == '\0') \ - ? __strcspn_c2 (s, __r0, __r1) \ - : (((const char *) (reject))[3] == '\0' \ - ? __strcspn_c3 (s, __r0, __r1, __r2) \ - : strcspn (s, reject))))) \ - : strcspn (s, reject)); }) # endif # endif @@ -1000,21 +331,6 @@ __strcspn_c3 (const char *__s, int __reject1, int __reject2, ? __strspn_c3 (s, __a0, __a1, __a2) \ : __builtin_strspn (s, accept)))))) \ : __builtin_strspn (s, accept)); }) -# else -# define strspn(s, accept) \ - __extension__ \ - ({ char __a0, __a1, __a2; \ - (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \ - ? ((__a0 = ((const char *) (accept))[0], __a0 == '\0') \ - ? ((void) (s), (size_t) 0) \ - : ((__a1 = ((const char *) (accept))[1], __a1 == '\0') \ - ? __strspn_c1 (s, __a0) \ - : ((__a2 = ((const char *) (accept))[2], __a2 == '\0') \ - ? __strspn_c2 (s, __a0, __a1) \ - : (((const char *) (accept))[3] == '\0' \ - ? __strspn_c3 (s, __a0, __a1, __a2) \ - : strspn (s, accept))))) \ - : strspn (s, accept)); }) # endif # endif @@ -1076,21 +392,6 @@ __strspn_c3 (const char *__s, int __accept1, int __accept2, int __accept3) ? __strpbrk_c3 (s, __a0, __a1, __a2) \ : __builtin_strpbrk (s, accept)))))) \ : __builtin_strpbrk (s, accept)); }) -# else -# define strpbrk(s, accept) \ - __extension__ \ - ({ char __a0, __a1, __a2; \ - (__builtin_constant_p (accept) && __string2_1bptr_p (accept) \ - ? ((__a0 = ((const char *) (accept))[0], __a0 == '\0') \ - ? ((void) (s), (char *) NULL) \ - : ((__a1 = ((const char *) (accept))[1], __a1 == '\0') \ - ? strchr (s, __a0) \ - : ((__a2 = ((const char *) (accept))[2], __a2 == '\0') \ - ? __strpbrk_c2 (s, __a0, __a1) \ - : (((const char *) (accept))[3] == '\0' \ - ? __strpbrk_c3 (s, __a0, __a1, __a2) \ - : strpbrk (s, accept))))) \ - : strpbrk (s, accept)); }) # endif # endif @@ -1118,22 +419,6 @@ __strpbrk_c3 (const char *__s, int __accept1, int __accept2, int __accept3) } #endif - -/* Find the first occurrence of NEEDLE in HAYSTACK. Newer gcc versions - do this itself. */ -#if !defined _HAVE_STRING_ARCH_strstr && !__GNUC_PREREQ (2, 97) -# define strstr(haystack, needle) \ - (__extension__ (__builtin_constant_p (needle) && __string2_1bptr_p (needle) \ - ? (((const char *) (needle))[0] == '\0' \ - ? (char *) (size_t) (haystack) \ - : (((const char *) (needle))[1] == '\0' \ - ? strchr (haystack, \ - ((const char *) (needle))[0]) \ - : strstr (haystack, needle))) \ - : strstr (haystack, needle))) -#endif - - #if !defined _HAVE_STRING_ARCH_strtok_r || defined _FORCE_INLINES # ifndef _HAVE_STRING_ARCH_strtok_r # define __strtok_r(s, sep, nextp) \