about summary refs log tree commit diff
path: root/wcsmbs
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 /wcsmbs
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 'wcsmbs')
-rw-r--r--wcsmbs/bits/wchar-ldbl.h4
-rw-r--r--wcsmbs/uchar.h2
-rw-r--r--wcsmbs/wchar.h51
3 files changed, 0 insertions, 57 deletions
diff --git a/wcsmbs/bits/wchar-ldbl.h b/wcsmbs/bits/wchar-ldbl.h
index 2c45aa7ff9..a4d1d4d1e9 100644
--- a/wcsmbs/bits/wchar-ldbl.h
+++ b/wcsmbs/bits/wchar-ldbl.h
@@ -21,7 +21,6 @@
 #endif
 
 #if defined __USE_ISOC95 || defined __USE_UNIX98
-__BEGIN_NAMESPACE_C99
 __LDBL_REDIR_DECL (fwprintf);
 __LDBL_REDIR_DECL (wprintf);
 __LDBL_REDIR_DECL (swprintf);
@@ -39,11 +38,9 @@ __LDBL_REDIR_DECL (fwscanf);
 __LDBL_REDIR_DECL (wscanf);
 __LDBL_REDIR_DECL (swscanf);
 # endif
-__END_NAMESPACE_C99
 #endif
 
 #ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 __LDBL_REDIR1_DECL (wcstold, wcstod);
 # if !defined __USE_GNU && !defined __REDIRECT \
      && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
@@ -55,7 +52,6 @@ __LDBL_REDIR_DECL (vfwscanf);
 __LDBL_REDIR_DECL (vwscanf);
 __LDBL_REDIR_DECL (vswscanf);
 # endif
-__END_NAMESPACE_C99
 #endif
 
 #ifdef __USE_GNU
diff --git a/wcsmbs/uchar.h b/wcsmbs/uchar.h
index ee771fefe6..a6569825fd 100644
--- a/wcsmbs/uchar.h
+++ b/wcsmbs/uchar.h
@@ -31,10 +31,8 @@
 #include <wchar.h>
 
 #ifndef __mbstate_t_defined
-__BEGIN_NAMESPACE_C99
 /* Public type.  */
 typedef __mbstate_t mbstate_t;
-__END_NAMESPACE_C99
 # define __mbstate_t_defined 1
 #endif
 
diff --git a/wcsmbs/wchar.h b/wcsmbs/wchar.h
index de7ef8bf4f..79be9fc41d 100644
--- a/wcsmbs/wchar.h
+++ b/wcsmbs/wchar.h
@@ -60,15 +60,6 @@
    member of the extended character set.  */
 #  define _WINT_T
 typedef unsigned int wint_t;
-# else
-/* Work around problems with the <stddef.h> file which doesn't put
-   wint_t in the std namespace.  */
-#  if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES \
-      && defined __WINT_TYPE__
-__BEGIN_NAMESPACE_STD
-typedef __WINT_TYPE__ wint_t;
-__END_NAMESPACE_STD
-#  endif
 # endif
 
 /* Tell the caller that we provide correct C++ prototypes.  */
@@ -102,17 +93,11 @@ typedef struct
 #ifdef _WCHAR_H
 
 # ifndef __mbstate_t_defined
-__BEGIN_NAMESPACE_C99
 /* Public type.  */
 typedef __mbstate_t mbstate_t;
-__END_NAMESPACE_C99
 #  define __mbstate_t_defined 1
 # endif
 
-#ifdef __USE_GNU
-__USING_NAMESPACE_C99(mbstate_t)
-#endif
-
 #ifndef WCHAR_MIN
 /* These constants might also be defined in <inttypes.h>.  */
 # define WCHAR_MIN __WCHAR_MIN
@@ -132,18 +117,11 @@ __USING_NAMESPACE_C99(mbstate_t)
 
 __BEGIN_DECLS
 
-__BEGIN_NAMESPACE_STD
 /* This incomplete type is defined in <time.h> but needed here because
    of `wcsftime'.  */
 struct tm;
-__END_NAMESPACE_STD
-/* XXX We have to clean this up at some point.  Since tm is in the std
-   namespace but wcsftime is in __c99 the type wouldn't be found
-   without inserting it in the global namespace.  */
-__USING_NAMESPACE_STD(tm)
 
 
-__BEGIN_NAMESPACE_STD
 /* Copy SRC to DEST.  */
 extern wchar_t *wcscpy (wchar_t *__restrict __dest,
 			const wchar_t *__restrict __src)
@@ -169,7 +147,6 @@ extern int wcscmp (const wchar_t *__s1, const wchar_t *__s2)
 /* Compare N wide-characters of S1 and S2.  */
 extern int wcsncmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
      __THROW __attribute_pure__ __nonnull ((1, 2));
-__END_NAMESPACE_STD
 
 #ifdef __USE_XOPEN2K8
 /* Compare S1 and S2, ignoring case.  */
@@ -190,7 +167,6 @@ extern int wcsncasecmp_l (const wchar_t *__s1, const wchar_t *__s2,
 			  size_t __n, __locale_t __loc) __THROW;
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Compare S1 and S2, both interpreted as appropriate to the
    LC_COLLATE category of the current locale.  */
 extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
@@ -199,7 +175,6 @@ extern int wcscoll (const wchar_t *__s1, const wchar_t *__s2) __THROW;
    `wcscoll' to the original strings.  */
 extern size_t wcsxfrm (wchar_t *__restrict __s1,
 		       const wchar_t *__restrict __s2, size_t __n) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef __USE_XOPEN2K8
 /* Similar to the two functions above but take the information from
@@ -220,7 +195,6 @@ extern size_t wcsxfrm_l (wchar_t *__s1, const wchar_t *__s2,
 extern wchar_t *wcsdup (const wchar_t *__s) __THROW __attribute_malloc__;
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Find the first occurrence of WC in WCS.  */
 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
 extern "C++" wchar_t *wcschr (wchar_t *__wcs, wchar_t __wc)
@@ -241,7 +215,6 @@ extern "C++" const wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
 extern wchar_t *wcsrchr (const wchar_t *__wcs, wchar_t __wc)
      __THROW __attribute_pure__;
 #endif
-__END_NAMESPACE_STD
 
 #ifdef __USE_GNU
 /* This function is similar to `wcschr'.  But it returns a pointer to
@@ -250,7 +223,6 @@ extern wchar_t *wcschrnul (const wchar_t *__s, wchar_t __wc)
      __THROW __attribute_pure__;
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Return the length of the initial segmet of WCS which
    consists entirely of wide characters not in REJECT.  */
 extern size_t wcscspn (const wchar_t *__wcs, const wchar_t *__reject)
@@ -289,7 +261,6 @@ extern wchar_t *wcstok (wchar_t *__restrict __s,
 
 /* Return the number of wide characters in S.  */
 extern size_t wcslen (const wchar_t *__s) __THROW __attribute_pure__;
-__END_NAMESPACE_STD
 
 #ifdef __USE_XOPEN
 /* Another name for `wcsstr' from XPG4.  */
@@ -312,7 +283,6 @@ extern size_t wcsnlen (const wchar_t *__s, size_t __maxlen)
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Search N wide characters of S for C.  */
 #ifdef __CORRECT_ISO_CPP_WCHAR_H_PROTO
 extern "C++" wchar_t *wmemchr (wchar_t *__s, wchar_t __c, size_t __n)
@@ -340,7 +310,6 @@ extern wchar_t *wmemmove (wchar_t *__s1, const wchar_t *__s2, size_t __n)
 
 /* Set N wide characters of S to C.  */
 extern wchar_t *wmemset (wchar_t *__s, wchar_t __c, size_t __n) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef __USE_GNU
 /* Copy N wide characters of SRC to DEST and return pointer to following
@@ -351,7 +320,6 @@ extern wchar_t *wmempcpy (wchar_t *__restrict __s1,
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Determine whether C constitutes a valid (one-byte) multibyte
    character.  */
 extern wint_t btowc (int __c) __THROW;
@@ -379,7 +347,6 @@ extern size_t __mbrlen (const char *__restrict __s, size_t __n,
 			mbstate_t *__restrict __ps) __THROW;
 extern size_t mbrlen (const char *__restrict __s, size_t __n,
 		      mbstate_t *__restrict __ps) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef __USE_EXTERN_INLINES
 /* Define inline function as optimization.  */
@@ -406,7 +373,6 @@ __NTH (mbrlen (const char *__restrict __s, size_t __n,
 	  ? mbrtowc (NULL, __s, __n, __ps) : __mbrlen (__s, __n, NULL)); }
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Write wide character representation of multibyte character string
    SRC to DST.  */
 extern size_t mbsrtowcs (wchar_t *__restrict __dst,
@@ -418,7 +384,6 @@ extern size_t mbsrtowcs (wchar_t *__restrict __dst,
 extern size_t wcsrtombs (char *__restrict __dst,
 			 const wchar_t **__restrict __src, size_t __len,
 			 mbstate_t *__restrict __ps) __THROW;
-__END_NAMESPACE_STD
 
 
 #ifdef	__USE_XOPEN2K8
@@ -448,25 +413,20 @@ extern int wcswidth (const wchar_t *__s, size_t __n) __THROW;
 #endif	/* Use X/Open.  */
 
 
-__BEGIN_NAMESPACE_STD
 /* Convert initial portion of the wide string NPTR to `double'
    representation.  */
 extern double wcstod (const wchar_t *__restrict __nptr,
 		      wchar_t **__restrict __endptr) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float wcstof (const wchar_t *__restrict __nptr,
 		     wchar_t **__restrict __endptr) __THROW;
 extern long double wcstold (const wchar_t *__restrict __nptr,
 			    wchar_t **__restrict __endptr) __THROW;
-__END_NAMESPACE_C99
 #endif /* C99 */
 
 
-__BEGIN_NAMESPACE_STD
 /* Convert initial portion of wide string NPTR to `long int'
    representation.  */
 extern long int wcstol (const wchar_t *__restrict __nptr,
@@ -477,10 +437,8 @@ extern long int wcstol (const wchar_t *__restrict __nptr,
 extern unsigned long int wcstoul (const wchar_t *__restrict __nptr,
 				  wchar_t **__restrict __endptr, int __base)
      __THROW;
-__END_NAMESPACE_STD
 
 #ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Convert initial portion of wide string NPTR to `long long int'
    representation.  */
 __extension__
@@ -494,7 +452,6 @@ __extension__
 extern unsigned long long int wcstoull (const wchar_t *__restrict __nptr,
 					wchar_t **__restrict __endptr,
 					int __base) __THROW;
-__END_NAMESPACE_C99
 #endif /* ISO C99.  */
 
 #ifdef __USE_GNU
@@ -587,7 +544,6 @@ extern __FILE *open_wmemstream (wchar_t **__bufloc, size_t *__sizeloc) __THROW;
 #endif
 
 #if defined __USE_ISOC95 || defined __USE_UNIX98
-__BEGIN_NAMESPACE_STD
 
 /* Select orientation for stream.  */
 extern int fwide (__FILE *__fp, int __mode) __THROW;
@@ -683,11 +639,9 @@ extern int __isoc99_swscanf (const wchar_t *__restrict __s,
 #  endif
 # endif
 
-__END_NAMESPACE_STD
 #endif /* Use ISO C95, C99 and Unix98. */
 
 #ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Read formatted input from S into argument list ARG.
 
    This function is a possible cancellation point and therefore not
@@ -739,11 +693,9 @@ extern int __isoc99_vswscanf (const wchar_t *__restrict __s,
 #  endif
 # endif
 
-__END_NAMESPACE_C99
 #endif /* Use ISO C99. */
 
 
-__BEGIN_NAMESPACE_STD
 /* Read a character from STREAM.
 
    These functions are possible cancellation points and therefore not
@@ -793,7 +745,6 @@ extern int fputws (const wchar_t *__restrict __ws,
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern wint_t ungetwc (wint_t __wc, __FILE *__stream);
-__END_NAMESPACE_STD
 
 
 #ifdef __USE_GNU
@@ -854,14 +805,12 @@ extern int fputws_unlocked (const wchar_t *__restrict __ws,
 #endif
 
 
-__BEGIN_NAMESPACE_C99
 /* Format TP into S according to FORMAT.
    Write no more than MAXSIZE wide characters and return the number
    of wide characters written, or 0 if it would exceed MAXSIZE.  */
 extern size_t wcsftime (wchar_t *__restrict __s, size_t __maxsize,
 			const wchar_t *__restrict __format,
 			const struct tm *__restrict __tp) __THROW;
-__END_NAMESPACE_C99
 
 # ifdef __USE_GNU
 # include <xlocale.h>