summary refs log tree commit diff
path: root/string
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2017-03-16 13:31:57 +0000
committerJoseph Myers <joseph@codesourcery.com>2017-03-16 13:31:57 +0000
commit2072f5c34ede81dde9e0d953d57a0690a66b0f12 (patch)
tree0833e169e1c3e9b24ef64e9010f7bb1e862f7da8 /string
parentd6fc3f6516cd20f195758086fbbbe3f17a8a6d95 (diff)
downloadglibc-2072f5c34ede81dde9e0d953d57a0690a66b0f12.tar.gz
glibc-2072f5c34ede81dde9e0d953d57a0690a66b0f12.tar.xz
glibc-2072f5c34ede81dde9e0d953d57a0690a66b0f12.zip
Remove C++ namespace handling from glibc headers.
glibc headers include some code (not particularly consistent or
systematic) to put various declarations in C++ namespaces std and
__c99, if _GLIBCPP_USE_NAMESPACES is defined.

As noted in <https://gcc.gnu.org/ml/libstdc++/2017-03/msg00025.html>,
this macro was removed from libstdc++ in 2000.  I don't expect
compilation with such old versions of libstdc++ to work with current
glibc headers anyway (whereas old *binaries* are expected to stay
working with current glibc); this patch (which should be a no-op with
any libstdc++ version postdating that removal) removes all this code
from the glibc headers.

The begin-end-check.pl test, whose comments say it is about checking
these namespace macro calls, is also removed.  The code in that test
would have covered __BEGIN_DECLS / __END_DECLS as well, but if those
weren't properly matched it would show up with the
check-installed-headers-cxx tests, so I don't think there is an actual
use for keeping begin-end-check.pl with the namespace code removed.

Tested for x86_64 and x86 (testsuite, and that installed stripped
shared libraries are unchanged by the patch).

	* misc/sys/cdefs.h (__BEGIN_NAMESPACE_STD): Remove macro.
	(__END_NAMESPACE_STD): Likewise.
	(__USING_NAMESPACE_STD): Likewise.
	(__BEGIN_NAMESPACE_C99): Likewise.
	(__END_NAMESPACE_C99): Likewise.
	(__USING_NAMESPACE_C99): Likewise.
	* math/math.h (_Mdouble_BEGIN_NAMESPACE): Do not define and
	undefine macro.
	(_Mdouble_END_NAMESPACE): Likewise.
	* ctype/ctype.h: Do not handle C++ namespaces.
	* libio/bits/stdio-ldbl.h: Likewise.
	* libio/stdio.h: Likewise.
	* locale/locale.h: Likewise.
	* math/bits/mathcalls.h: Likewise.
	* setjmp/setjmp.h: Likewise.
	* signal/signal.h: Likewise.
	* stdlib/bits/stdlib-float.h: Likewise.
	* stdlib/bits/stdlib-ldbl.h: Likewise.
	* stdlib/stdlib.h: Likewise.
	* string/string.h: Likewise.
	* sysdeps/x86/fpu/bits/mathinline.h: Likewise.
	* time/bits/types/clock_t.h: Likewise.
	* time/bits/types/struct_tm.h: Likewise.
	* time/bits/types/time_t.h: Likewise.
	* time/time.h: Likewise.
	* wcsmbs/bits/wchar-ldbl.h: Likewise.
	* wcsmbs/uchar.h: Likewise.
	* wcsmbs/wchar.h: Likewise.
	[_GLIBCPP_USE_NAMESPACES] (wint_t): Remove conditional definition.
	* wctype/wctype.h: Do not handle C++ namespaces.
	* scripts/begin-end-check.pl: Remove.
	* Makefile (installed-headers): Likewise.
	(tests-special): Do not add $(objpfx)begin-end-check.out.
	($(objpfx)begin-end-check.out): Remove.
Diffstat (limited to 'string')
-rw-r--r--string/string.h14
1 files changed, 0 insertions, 14 deletions
diff --git a/string/string.h b/string/string.h
index 053cf334a7..8eed67d77d 100644
--- a/string/string.h
+++ b/string/string.h
@@ -38,7 +38,6 @@ __BEGIN_DECLS
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Copy N bytes of SRC to DEST.  */
 extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
 		     size_t __n) __THROW __nonnull ((1, 2));
@@ -46,7 +45,6 @@ extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
    correct behavior for overlapping strings.  */
 extern void *memmove (void *__dest, const void *__src, size_t __n)
      __THROW __nonnull ((1, 2));
-__END_NAMESPACE_STD
 
 /* Copy no more than N bytes of SRC to DEST, stopping when C is found.
    Return the position in DEST one byte past where C was copied,
@@ -58,7 +56,6 @@ extern void *memccpy (void *__restrict __dest, const void *__restrict __src,
 #endif /* Misc || X/Open.  */
 
 
-__BEGIN_NAMESPACE_STD
 /* Set N bytes of S to C.  */
 extern void *memset (void *__s, int __c, size_t __n) __THROW __nonnull ((1));
 
@@ -93,7 +90,6 @@ memchr (const void *__s, int __c, size_t __n) __THROW
 extern void *memchr (const void *__s, int __c, size_t __n)
       __THROW __attribute_pure__ __nonnull ((1));
 #endif
-__END_NAMESPACE_STD
 
 #ifdef __USE_GNU
 /* Search in S for C.  This is similar to `memchr' but there is no
@@ -121,7 +117,6 @@ extern void *memrchr (const void *__s, int __c, size_t __n)
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Copy SRC to DEST.  */
 extern char *strcpy (char *__restrict __dest, const char *__restrict __src)
      __THROW __nonnull ((1, 2));
@@ -151,7 +146,6 @@ extern int strcoll (const char *__s1, const char *__s2)
 extern size_t strxfrm (char *__restrict __dest,
 		       const char *__restrict __src, size_t __n)
      __THROW __nonnull ((2));
-__END_NAMESPACE_STD
 
 #ifdef __USE_XOPEN2K8
 # include <xlocale.h>
@@ -203,7 +197,6 @@ extern char *strndup (const char *__string, size_t __n)
     }))
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Find the first occurrence of C in S.  */
 #ifdef __CORRECT_ISO_CPP_STRING_H_PROTO
 extern "C++"
@@ -258,7 +251,6 @@ strrchr (const char *__s, int __c) __THROW
 extern char *strrchr (const char *__s, int __c)
      __THROW __attribute_pure__ __nonnull ((1));
 #endif
-__END_NAMESPACE_STD
 
 #ifdef __USE_GNU
 /* This function is similar to `strchr'.  But it returns a pointer to
@@ -274,7 +266,6 @@ extern char *strchrnul (const char *__s, int __c)
 # endif
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Return the length of the initial segment of S which
    consists entirely of characters not in REJECT.  */
 extern size_t strcspn (const char *__s, const char *__reject)
@@ -342,7 +333,6 @@ extern char *strstr (const char *__haystack, const char *__needle)
 /* Divide S into tokens separated by characters in DELIM.  */
 extern char *strtok (char *__restrict __s, const char *__restrict __delim)
      __THROW __nonnull ((2));
-__END_NAMESPACE_STD
 
 /* Divide S into tokens separated by characters in DELIM.  Information
    passed between calls are stored in SAVE_PTR.  */
@@ -389,11 +379,9 @@ extern void *mempcpy (void *__restrict __dest,
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Return the length of S.  */
 extern size_t strlen (const char *__s)
      __THROW __attribute_pure__ __nonnull ((1));
-__END_NAMESPACE_STD
 
 #ifdef	__USE_XOPEN2K8
 /* Find the length of STRING, but scan at most MAXLEN characters.
@@ -403,10 +391,8 @@ extern size_t strnlen (const char *__string, size_t __maxlen)
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Return a string describing the meaning of the `errno' code in ERRNUM.  */
 extern char *strerror (int __errnum) __THROW;
-__END_NAMESPACE_STD
 #ifdef __USE_XOPEN2K
 /* Reentrant version of `strerror'.
    There are 2 flavors of `strerror_r', GNU which returns the string