From: Zack Weinberg <zackw@panix.com>
To: libc-alpha@sourceware.org
Cc: joseph@codesourcery.com, adhemerval.zanella@linaro.org,
Wilco.Dijkstra@arm.com, fweimer@redhat.com, carlos@redhat.com,
schwab@suse.de
Subject: [PATCH 09/10] Remove bits/string2.h.
Date: Tue, 09 May 2017 15:41:00 -0000 [thread overview]
Message-ID: <20170509154103.11973-10-zackw@panix.com> (raw)
In-Reply-To: <20170509154103.11973-1-zackw@panix.com>
There's very little left in bits/string2.h at this point and it's
likely that the current generation of compilers can do all of it
without our help.
* string/bits/string2.h: Delete file.
* include/bits/string2.h: Delete file.
* string/string.h: Don't include bits/string2.h.
Remove inline optimization for mempcpy.
* string/string-inlines.c: Don't include bits/string2.h.
* string/Makefile (headers): Remove bits/string2.h.
* include/string.h: Forward __bzero and __stpcpy to __builtin
versions here.
* elf/dl-cache.c, inet/rcmd.c, inet/rexec.c, intl/dcigettext.c
* locale/loadarchive.c, locale/setlocale.c
* posix/spawn_faction_addopen.c, stdlib/putenv.c
* sunrpc/svc_simple.c, sysdeps/posix/getaddrinfo.c:
Use __strdup instead of strdup.
* sysdeps/unix/sysv/linux/internal_statvfs.c:
Use __strsep instead of strsep.
---
include/bits/string2.h | 1 -
include/string.h | 2 +
intl/dcigettext.c | 2 +-
string/Makefile | 8 ++--
string/Versions | 2 +-
string/bits/string2.h | 119 ------------------------------------------------
string/string-inlines.c | 1 -
string/string.h | 20 --------
8 files changed, 8 insertions(+), 147 deletions(-)
delete mode 100644 include/bits/string2.h
delete mode 100644 string/bits/string2.h
diff --git a/include/bits/string2.h b/include/bits/string2.h
deleted file mode 100644
index e4c4c709b5..0000000000
--- a/include/bits/string2.h
+++ /dev/null
@@ -1 +0,0 @@
-#include <string/bits/string2.h>
diff --git a/include/string.h b/include/string.h
index ce71674086..f777d617c4 100644
--- a/include/string.h
+++ b/include/string.h
@@ -44,6 +44,7 @@ extern void *__memchr (const void *__s, int __c, size_t __n)
__attribute_pure__;
extern void __bzero (void *__s, size_t __n) __THROW __nonnull ((1));
+#define __bzero(s, n) __builtin_memset (s, '\0', n)
extern int __ffs (int __i) __attribute__ ((const));
@@ -77,6 +78,7 @@ extern __typeof (strncasecmp_l) __strncasecmp_l;
libc_hidden_proto (__mempcpy)
libc_hidden_proto (__stpcpy)
+#define __stpcpy(dest, src) __builtin_stpcpy (dest, src)
libc_hidden_proto (__stpncpy)
libc_hidden_proto (__rawmemchr)
libc_hidden_proto (__strcasecmp)
diff --git a/intl/dcigettext.c b/intl/dcigettext.c
index 3843b7cbdf..7ee0337284 100644
--- a/intl/dcigettext.c
+++ b/intl/dcigettext.c
@@ -1073,7 +1073,7 @@ _nl_find_msg (struct loaded_l10nfile *domain_file,
domain->conversions = new_conversions;
/* Copy the 'encoding' string to permanent storage. */
- encoding = strdup (encoding);
+ encoding = __strdup (encoding);
if (__builtin_expect (encoding == NULL, 0))
/* Nothing we can do, no more memory. We cannot use the
translation because it might be encoded incorrectly. */
diff --git a/string/Makefile b/string/Makefile
index f317d02a8c..8a6322babb 100644
--- a/string/Makefile
+++ b/string/Makefile
@@ -22,10 +22,10 @@ subdir := string
include ../Makeconfig
-headers := string.h strings.h memory.h endian.h bits/endian.h \
- argz.h envz.h byteswap.h bits/byteswap.h bits/byteswap-16.h \
- bits/string.h bits/string2.h bits/string3.h \
- bits/strings_fortified.h bits/uintn-identity.h
+headers := string.h strings.h memory.h argz.h envz.h byteswap.h \
+ endian.h bits/byteswap.h bits/byteswap-16.h bits/endian.h \
+ bits/string.h bits/string3.h bits/strings_fortified.h \
+ bits/uintn-identity.h
routines := strcat strchr strcmp strcoll strcpy strcspn \
strverscmp strdup strndup \
diff --git a/string/Versions b/string/Versions
index 9b709d12a9..25afed063a 100644
--- a/string/Versions
+++ b/string/Versions
@@ -57,7 +57,7 @@ libc {
strcasestr; strverscmp;
}
GLIBC_2.1.1 {
- # extern inline functions used by <bits/string2.h>
+ # extern inline functions formerly used in string.h
__mempcpy_small; __stpcpy_small; __strcspn_c1; __strcspn_c2; __strcspn_c3;
__strcpy_small; __strspn_c1; __strspn_c2; __strspn_c3; __strpbrk_c2;
__strpbrk_c3; __strsep_1c; __strsep_2c; __strsep_3c; __strsep_g;
diff --git a/string/bits/string2.h b/string/bits/string2.h
deleted file mode 100644
index 6a26e2bc68..0000000000
--- a/string/bits/string2.h
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Machine-independant string function optimizations.
- Copyright (C) 1997-2017 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
- Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#ifndef _STRING_H
-# error "Never use <bits/string2.h> directly; include <string.h> instead."
-#endif
-
-#ifndef __NO_STRING_INLINES
-
-/* Unlike the definitions in the header <bits/string.h> the
- definitions contained here are not optimized down to assembler
- level. Those optimizations are not always a good idea since this
- means the code size increases a lot. Instead the definitions here
- optimize some functions in a way which do not dramatically
- increase the code size and which do not use assembler. The main
- trick is to use GCC's `__builtin_constant_p' function.
-
- Every function XXX which has a defined version in
- <bits/string.h> must be accompanied by a symbol _HAVE_STRING_ARCH_XXX
- to make sure we don't get redefinitions.
-
- We must use here macros instead of inline functions since the
- trick won't work with the latter. */
-
-#ifndef __STRING_INLINE
-# ifdef __cplusplus
-# define __STRING_INLINE inline
-# else
-# define __STRING_INLINE __extern_inline
-# endif
-#endif
-
-/* Dereferencing a pointer arg to run sizeof on it fails for the void
- pointer case, so we use this instead.
- Note that __x is evaluated twice. */
-#define __string2_1bptr_p(__x) \
- ((size_t)(const void *)((__x) + 1) - (size_t)(const void *)(__x) == 1)
-
-/* Set N bytes of S to 0. */
-#if !defined _HAVE_STRING_ARCH_memset
-# define __bzero(s, n) __builtin_memset (s, '\0', n)
-#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
-
-
-/* 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
-
-
-#ifndef _FORCE_INLINES
-# undef __STRING_INLINE
-#endif
-
-#endif /* No string inlines. */
diff --git a/string/string-inlines.c b/string/string-inlines.c
index fa4a1594b2..68aa7d072a 100644
--- a/string/string-inlines.c
+++ b/string/string-inlines.c
@@ -31,7 +31,6 @@
#undef __NO_INLINE__
#include <bits/string.h>
-#include <bits/string2.h>
#include "shlib-compat.h"
diff --git a/string/string.h b/string/string.h
index 8eed67d77d..ac872ff283 100644
--- a/string/string.h
+++ b/string/string.h
@@ -511,9 +511,6 @@ extern char *basename (const char *__filename) __THROW __nonnull ((1));
/* Get the machine-dependent optimizations (if any). */
# include <bits/string.h>
-
-/* These are generic optimizations which do not add too much inline code. */
-# include <bits/string2.h>
# endif
# if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
@@ -522,23 +519,6 @@ extern char *basename (const char *__filename) __THROW __nonnull ((1));
# endif
#endif
-#if defined __USE_GNU && defined __OPTIMIZE__ \
- && defined __extern_always_inline && __GNUC_PREREQ (3,2)
-# if !defined _FORCE_INLINES && !defined _HAVE_STRING_ARCH_mempcpy
-
-#define mempcpy(dest, src, n) __mempcpy_inline (dest, src, n)
-#define __mempcpy(dest, src, n) __mempcpy_inline (dest, src, n)
-
-__extern_always_inline void *
-__mempcpy_inline (void *__restrict __dest,
- const void *__restrict __src, size_t __n)
-{
- return (char *) memcpy (__dest, __src, __n) + __n;
-}
-
-# endif
-#endif
-
__END_DECLS
#endif /* string.h */
--
2.11.0
next prev parent reply other threads:[~2017-05-09 15:41 UTC|newest]
Thread overview: 51+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-05-09 15:41 [PATCH 00/10] All of my not-yet-reviewed patches Zack Weinberg
2017-05-09 15:41 ` Zack Weinberg [this message]
2017-05-09 15:41 ` [PATCH 03/10] The bits/types/*.h treatment for stdio and wchar Zack Weinberg
2017-05-09 21:34 ` Joseph Myers
2017-05-10 11:52 ` Zack Weinberg
2017-05-20 21:05 ` Zack Weinberg
2017-05-22 14:56 ` Joseph Myers
2017-05-09 15:41 ` [PATCH 02/10] Suppress internal declarations for most of the testsuite Zack Weinberg
2017-05-09 21:28 ` Joseph Myers
2017-05-10 11:56 ` Zack Weinberg
2017-05-12 15:40 ` H.J. Lu
2017-05-12 16:16 ` Zack Weinberg
2017-05-12 16:26 ` H.J. Lu
2017-05-15 14:18 ` [PATCH] Move tst-mutex*8* to tests-internal Tulio Magno Quites Machado Filho
2017-05-20 13:06 ` Zack Weinberg
2017-05-22 14:21 ` Stefan Liebler
2017-05-25 17:55 ` Tulio Magno Quites Machado Filho
2017-05-09 15:41 ` [PATCH 04/10] Convert signal.h from __need macros to bits/types/ headers Zack Weinberg
2017-05-09 21:36 ` Joseph Myers
2017-05-17 17:41 ` Joseph Myers
2017-05-20 21:03 ` Zack Weinberg
2017-05-09 15:41 ` [PATCH 08/10] Don't install libio.h or _G_config.h Zack Weinberg
2017-05-09 15:41 ` [PATCH 01/10] Remove _IO_MTSAFE_IO from public headers Zack Weinberg
2017-05-09 21:11 ` Joseph Myers
2017-05-09 15:41 ` [PATCH 07/10] Remove __need_IOV_MAX and __need_FOPEN_MAX Zack Weinberg
2017-05-09 15:56 ` [PATCH 10/10] Remove bits/string.h Zack Weinberg
2017-05-09 15:56 ` [PATCH 06/10] Remove __need_list_t and __need_res_state Zack Weinberg
2017-05-10 7:37 ` Florian Weimer
2017-05-20 19:37 ` Zack Weinberg
2017-05-09 15:56 ` [PATCH 05/10] Remove __need macros from errno.h (__need_Emath, __need_error_t) Zack Weinberg
2017-05-09 21:38 ` Joseph Myers
2017-05-10 7:31 ` Florian Weimer
2017-05-10 11:49 ` Joseph Myers
2017-05-10 12:03 ` Florian Weimer
2017-05-11 12:15 ` Zack Weinberg
2017-05-11 14:30 ` Joseph Myers
2017-05-11 14:46 ` Zack Weinberg
2017-05-11 14:53 ` Florian Weimer
2017-05-11 14:48 ` Florian Weimer
2017-05-11 15:26 ` Joseph Myers
2017-05-11 15:42 ` Andreas Schwab
2017-05-11 16:10 ` Joseph Myers
2017-05-11 17:20 ` Andreas Schwab
2017-05-11 16:19 ` Florian Weimer
2017-05-11 17:25 ` Andreas Schwab
2017-05-12 6:23 ` Florian Weimer
2017-05-15 8:11 ` Andreas Schwab
2017-05-15 8:13 ` Florian Weimer
2017-05-15 8:24 ` Andreas Schwab
2017-05-15 9:08 ` Florian Weimer
2017-05-11 0:12 ` [PATCH 00/10] All of my not-yet-reviewed patches Joseph Myers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170509154103.11973-10-zackw@panix.com \
--to=zackw@panix.com \
--cc=Wilco.Dijkstra@arm.com \
--cc=adhemerval.zanella@linaro.org \
--cc=carlos@redhat.com \
--cc=fweimer@redhat.com \
--cc=joseph@codesourcery.com \
--cc=libc-alpha@sourceware.org \
--cc=schwab@suse.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).