From patchwork Tue Nov 22 14:35:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Wilco Dijkstra X-Patchwork-Id: 17704 Received: (qmail 43601 invoked by alias); 22 Nov 2016 14:36:04 -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 43583 invoked by uid 89); 22 Nov 2016 14:36:03 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.2 spammy=stpcpy, C90, weren't, c90 X-HELO: EUR02-AM5-obe.outbound.protection.outlook.com From: Wilco Dijkstra To: "libc-alpha@sourceware.org" CC: nd Subject: [PATCH v2] Remove defines to builtins in string2.h Date: Tue, 22 Nov 2016 14:35:50 +0000 Message-ID: References: In-Reply-To: authentication-results: spf=none (sender IP is ) smtp.mailfrom=Wilco.Dijkstra@arm.com; x-microsoft-exchange-diagnostics: 1; AM5PR0802MB2609; 7:VwPUAaVYwEgTb6S10EfjuyIxIT2ZOzUpQ6o4aGYKV2ke7ThywNBOPS1cx6IxYGgcnLs0WbUngj2aGLSokDkovIEyrztRna8SVLtfpWfeozyqeCbdnirmtEtOW1A/4ikmkcFow5xXm0tsw8y7JWiyEBzHPJvQBHkr6tCrkTxddgFp23MXWUaexMVZ45hdlGp1mlaKrdOcwiaL/RqKxLiXmhCa1g7YRlUMM1DN/N7DFTOwzfneA1s7f4zwyjhXW8uQXtFLXGTeGraJjdUPt3UOJGRsUJEgYkDPu3+w5bIjPTrfqBukZb3URVIGOtCyVmacVhrd0Fiujd7VdjgDOEgF3eZPuqGAvzXPTDFuVI0Xa2g= x-ms-office365-filtering-correlation-id: 362ac452-eef7-4b09-526d-08d412e4db5a x-microsoft-antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001); SRVR:AM5PR0802MB2609; nodisclaimer: True x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(180628864354917); x-exchange-antispam-report-cfa-test: BCL:0; PCL:0; RULEID:(6060326)(6040307)(6045199)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026)(6041248)(6061324); SRVR:AM5PR0802MB2609; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0802MB2609; x-forefront-prvs: 0134AD334F x-forefront-antispam-report: SFV:NSPM; SFS:(10009020)(6009001)(7916002)(377424004)(199003)(54534003)(189002)(2351001)(2900100001)(106116001)(105586002)(86362001)(3660700001)(106356001)(6506003)(8936002)(9686002)(68736007)(38730400001)(2501003)(76576001)(2950100002)(6916009)(7696004)(81156014)(101416001)(81166006)(110136003)(4326007)(305945005)(77096005)(3846002)(102836003)(450100001)(6116002)(76176999)(74316002)(5660300001)(50986999)(8676002)(7846002)(33656002)(2906002)(7736002)(54356999)(92566002)(189998001)(97736004)(122556002)(5640700001)(66066001)(4001150100001)(3280700002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0802MB2609; H:AM5PR0802MB2610.eurprd08.prod.outlook.com; FPR:; SPF:None; PTR:InfoNoRecords; A:1; MX:1; LANG:en; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM MIME-Version: 1.0 X-OriginatorOrg: arm.com X-MS-Exchange-CrossTenant-originalarrivaltime: 22 Nov 2016 14:35:50.6974 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: f34e5979-57d9-4aaa-ad4d-b122a662184d X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0802MB2609 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. So remove the defines for strchr, __stpcpy, stpcpy, strncpy, strncat, strcspn, strspn, strpbrk and strsep from string/bits/string2.h. The strncat define only uses the #else as _USE_STRING_ARCH_strchr is never defined unless _HAVE_STRING_ARCH_strncat is defined too. elf/check-localplt and linknamespace test pass so the redirections weren't required or useful. ChangeLog: 2015-11-22 Wilco Dijkstra * string/bits/string2.h (strchr) Remove define. (stpcpy): Likewise. (__stpcpy): Likewise. (strncpy): Likewise. (strncat): Likewise. (strcspn): Likewise. (strspn): Likewise. (strpbrk): Likewise. (strsep): Likewise.  -- diff --git a/string/bits/string2.h b/string/bits/string2.h index 8fa35d52e7c8e3ff592573fa64472da526e8616d..941e9bff015a89908dbf61044a1787bcb4026b89 100644 --- a/string/bits/string2.h +++ b/string/bits/string2.h @@ -58,45 +58,6 @@ #endif -#ifndef _HAVE_STRING_ARCH_strchr -# define strchr(s, c) __builtin_strchr (s, c) -#endif - - -/* 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 - - -/* 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 - - -/* Append no more than N characters from SRC onto DEST. */ -#ifndef _HAVE_STRING_ARCH_strncat -# ifdef _USE_STRING_ARCH_strchr -# define strncat(dest, src, n) \ - (__extension__ ({ char *__dest = (dest); \ - __builtin_constant_p (src) && __builtin_constant_p (n) \ - ? (strlen (src) < ((size_t) (n)) \ - ? strcat (__dest, src) \ - : (*((char *) __mempcpy (strchr (__dest, '\0'), \ - src, n)) = '\0', __dest)) \ - : strncat (dest, src, n); })) -# else -# define strncat(dest, src, n) __builtin_strncat (dest, src, n) -# endif -#endif - - /* Compare characters of S1 and S2. */ #ifndef _HAVE_STRING_ARCH_strcmp # define strcmp(s1, s2) \ @@ -155,32 +116,6 @@ #endif -/* Return the length of the initial segment of S which - consists entirely of characters not in REJECT. */ -#ifndef _HAVE_STRING_ARCH_strcspn -# define strcspn(s, reject) __builtin_strcspn (s, reject) -#endif - - -/* Return the length of the initial segment of S which - consists entirely of characters in ACCEPT. */ -#ifndef _HAVE_STRING_ARCH_strspn -# define strspn(s, accept) __builtin_strspn (s, accept) -#endif - - -/* Find the first occurrence in S of any character in ACCEPT. */ -#ifndef _HAVE_STRING_ARCH_strpbrk -# define strpbrk(s, accept) __builtin_strpbrk (s, accept) -#endif - - -#if !defined _HAVE_STRING_ARCH_strsep -# ifdef __USE_MISC -# define strsep(s, reject) __strsep (s, reject) -# endif -#endif - /* We need the memory allocation functions for inline strdup(). Referring to stdlib.h (even minimally) is not allowed in any of the tight standards compliant modes. */