summary refs log tree commit diff
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
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.
-rw-r--r--ChangeLog37
-rw-r--r--Makefile51
-rw-r--r--ctype/ctype.h8
-rw-r--r--libio/bits/stdio-ldbl.h6
-rw-r--r--libio/stdio.h45
-rw-r--r--locale/locale.h4
-rw-r--r--math/bits/mathcalls.h31
-rw-r--r--math/math.h12
-rw-r--r--misc/sys/cdefs.h25
-rw-r--r--scripts/begin-end-check.pl47
-rw-r--r--setjmp/setjmp.h8
-rw-r--r--signal/signal.h6
-rw-r--r--stdlib/bits/stdlib-float.h2
-rw-r--r--stdlib/bits/stdlib-ldbl.h2
-rw-r--r--stdlib/stdlib.h44
-rw-r--r--string/string.h14
-rw-r--r--sysdeps/x86/fpu/bits/mathinline.h14
-rw-r--r--time/bits/types/clock_t.h6
-rw-r--r--time/bits/types/struct_tm.h5
-rw-r--r--time/bits/types/time_t.h5
-rw-r--r--time/time.h6
-rw-r--r--wcsmbs/bits/wchar-ldbl.h4
-rw-r--r--wcsmbs/uchar.h2
-rw-r--r--wcsmbs/wchar.h51
-rw-r--r--wctype/wctype.h13
25 files changed, 37 insertions, 411 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d24cfac44..b63677c2fb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,40 @@
+2017-03-16  Joseph Myers  <joseph@codesourcery.com>
+
+	* 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.
+
 2017-03-15  Steve Ellcey  <sellcey@caviumnetworks.com>
 	    Adhemerval Zanella  <adhemerval.zanella@linaro.org>
 
diff --git a/Makefile b/Makefile
index 425cb796db..1b896b979c 100644
--- a/Makefile
+++ b/Makefile
@@ -267,57 +267,6 @@ $(objpfx)check-local-headers.out: scripts/check-local-headers.sh
 	  "$(includedir)" "$(objpfx)" < /dev/null > $@; \
 	$(evaluate-test)
 
-ifneq ($(PERL),no)
-installed-headers = argp/argp.h assert/assert.h catgets/nl_types.h \
-		    crypt/crypt.h ctype/ctype.h debug/execinfo.h \
-		    dirent/dirent.h dlfcn/dlfcn.h elf/elf.h elf/link.h \
-		    gmon/sys/gmon.h gmon/sys/gmon_out.h gmon/sys/profil.h \
-		    grp/grp.h gshadow/gshadow.h iconv/iconv.h iconv/gconv.h \
-		    $(wildcard inet/netinet/*.h) \
-		    $(wildcard inet/arpa/*.h inet/protocols/*.h) \
-		    inet/aliases.h inet/ifaddrs.h inet/netinet/ip6.h \
-		    inet/netinet/icmp6.h intl/libintl.h io/sys/stat.h \
-		    io/sys/statfs.h io/sys/vfs.h io/sys/statvfs.h \
-		    io/fcntl.h io/sys/fcntl.h io/poll.h io/sys/poll.h \
-		    io/utime.h io/ftw.h io/fts.h io/sys/sendfile.h \
-		    libio/stdio.h libio/libio.h locale/locale.h \
-		    locale/langinfo.h locale/xlocale.h login/utmp.h \
-		    login/lastlog.h login/pty.h malloc/malloc.h \
-		    malloc/obstack.h malloc/mcheck.h math/math.h \
-		    math/complex.h math/fenv.h math/tgmath.h misc/sys/uio.h \
-		    $(wildcard nis/rpcsvc/*.h) nptl_db/thread_db.h \
-		    sysdeps/nptl/pthread.h sysdeps/pthread/semaphore.h \
-		    nss/nss.h posix/sys/utsname.h posix/sys/times.h \
-		    posix/sys/wait.h posix/sys/types.h posix/unistd.h \
-		    posix/glob.h posix/regex.h posix/wordexp.h posix/fnmatch.h\
-		    posix/getopt.h posix/tar.h posix/sys/unistd.h \
-		    posix/sched.h posix/re_comp.h posix/wait.h \
-		    posix/cpio.h posix/spawn.h pwd/pwd.h resolv/resolv.h \
-		    resolv/netdb.h $(wildcard resolv/arpa/*.h) \
-		    resource/sys/resource.h resource/sys/vlimit.h \
-		    resource/sys/vtimes.h resource/ulimit.h rt/aio.h \
-		    rt/mqueue.h setjmp/setjmp.h shadow/shadow.h \
-		    signal/signal.h signal/sys/signal.h socket/sys/socket.h \
-		    socket/sys/un.h stdio-common/printf.h \
-		    stdio-common/stdio_ext.h stdlib/stdlib.h stdlib/alloca.h \
-		    stdlib/monetary.h stdlib/fmtmsg.h stdlib/ucontext.h \
-		    sysdeps/generic/inttypes.h sysdeps/generic/stdint.h \
-		    stdlib/errno.h stdlib/sys/errno.h string/string.h \
-		    string/strings.h string/memory.h string/endian.h \
-		    string/argz.h string/envz.h string/byteswap.h \
-		    $(wildcard sunrpc/rpc/*.h sunrpc/rpcsvc/*.h) \
-		    sysvipc/sys/ipc.h sysvipc/sys/msg.h sysvipc/sys/sem.h \
-		    sysvipc/sys/shm.h termios/termios.h \
-		    termios/sys/termios.h termios/sys/ttychars.h time/time.h \
-		    time/sys/time.h time/sys/timeb.h wcsmbs/wchar.h \
-		    wctype/wctype.h
-
-tests-special += $(objpfx)begin-end-check.out
-$(objpfx)begin-end-check.out: scripts/begin-end-check.pl
-	$(PERL) scripts/begin-end-check.pl $(installed-headers) > $@; \
-	$(evaluate-test)
-endif
-
 ifneq "$(headers)" ""
 # Special test of all the installed headers in this directory.
 tests-special += $(objpfx)check-installed-headers-c.out
diff --git a/ctype/ctype.h b/ctype/ctype.h
index 3a58924f89..1fe89cf836 100644
--- a/ctype/ctype.h
+++ b/ctype/ctype.h
@@ -101,8 +101,6 @@ extern const __int32_t **__ctype_toupper_loc (void)
 
 #define	__exctype(name)	extern int name (int) __THROW
 
-__BEGIN_NAMESPACE_STD
-
 /* The following names are all functions:
      int isCHARACTERISTIC(int c);
    which return nonzero iff C has CHARACTERISTIC.
@@ -126,16 +124,10 @@ extern int tolower (int __c) __THROW;
 /* Return the uppercase version of C.  */
 extern int toupper (int __c) __THROW;
 
-__END_NAMESPACE_STD
-
 
 /* ISO C99 introduced one new function.  */
 #ifdef	__USE_ISOC99
-__BEGIN_NAMESPACE_C99
-
 __exctype (isblank);
-
-__END_NAMESPACE_C99
 #endif
 
 #ifdef __USE_GNU
diff --git a/libio/bits/stdio-ldbl.h b/libio/bits/stdio-ldbl.h
index bb68cf1692..caa1e538c3 100644
--- a/libio/bits/stdio-ldbl.h
+++ b/libio/bits/stdio-ldbl.h
@@ -20,7 +20,6 @@
 # error "Never include <bits/stdio-ldbl.h> directly; use <stdio.h> instead."
 #endif
 
-__BEGIN_NAMESPACE_STD
 __LDBL_REDIR_DECL (fprintf)
 __LDBL_REDIR_DECL (printf)
 __LDBL_REDIR_DECL (sprintf)
@@ -38,17 +37,13 @@ __LDBL_REDIR_DECL (fscanf)
 __LDBL_REDIR_DECL (scanf)
 __LDBL_REDIR_DECL (sscanf)
 #endif
-__END_NAMESPACE_STD
 
 #if defined __USE_ISOC99 || defined __USE_UNIX98
-__BEGIN_NAMESPACE_C99
 __LDBL_REDIR_DECL (snprintf)
 __LDBL_REDIR_DECL (vsnprintf)
-__END_NAMESPACE_C99
 #endif
 
 #ifdef	__USE_ISOC99
-__BEGIN_NAMESPACE_C99
 # if !defined __USE_GNU && !defined __REDIRECT \
      && (defined __STRICT_ANSI__ || defined __USE_XOPEN2K)
 __LDBL_REDIR1_DECL (vfscanf, __nldbl___isoc99_vfscanf)
@@ -59,7 +54,6 @@ __LDBL_REDIR_DECL (vfscanf)
 __LDBL_REDIR_DECL (vsscanf)
 __LDBL_REDIR_DECL (vscanf)
 # endif
-__END_NAMESPACE_C99
 #endif
 
 #ifdef __USE_XOPEN2K8
diff --git a/libio/stdio.h b/libio/stdio.h
index c4f734cb3c..3e01d54eb2 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -44,15 +44,8 @@ __BEGIN_DECLS
 /* Define outside of namespace so the C++ is happy.  */
 struct _IO_FILE;
 
-__BEGIN_NAMESPACE_STD
 /* The opaque type of streams.  This is the definition used elsewhere.  */
 typedef struct _IO_FILE FILE;
-__END_NAMESPACE_STD
-#if defined __USE_LARGEFILE64 || defined __USE_POSIX \
-    || defined __USE_ISOC99 || defined __USE_XOPEN \
-    || defined __USE_POSIX2
-__USING_NAMESPACE_STD(FILE)
-#endif
 
 # define __FILE_defined	1
 #endif /* FILE not defined.  */
@@ -108,13 +101,11 @@ typedef __ssize_t ssize_t;
 #endif
 
 /* The type of the second argument to `fgetpos' and `fsetpos'.  */
-__BEGIN_NAMESPACE_STD
 #ifndef __USE_FILE_OFFSET64
 typedef _G_fpos_t fpos_t;
 #else
 typedef _G_fpos64_t fpos_t;
 #endif
-__END_NAMESPACE_STD
 #ifdef __USE_LARGEFILE64
 typedef _G_fpos64_t fpos64_t;
 #endif
@@ -176,12 +167,10 @@ extern struct _IO_FILE *stderr;		/* Standard error output stream.  */
 #define stdout stdout
 #define stderr stderr
 
-__BEGIN_NAMESPACE_STD
 /* Remove file FILENAME.  */
 extern int remove (const char *__filename) __THROW;
 /* Rename file OLD to NEW.  */
 extern int rename (const char *__old, const char *__new) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef __USE_ATFILE
 /* Rename file OLD relative to OLDFD to NEW relative to NEWFD.  */
@@ -189,7 +178,6 @@ extern int renameat (int __oldfd, const char *__old, int __newfd,
 		     const char *__new) __THROW;
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Create a temporary file and open it read/write.
 
    This function is a possible cancellation point and therefore not
@@ -210,7 +198,6 @@ extern FILE *tmpfile64 (void) __wur;
 
 /* Generate a temporary filename.  */
 extern char *tmpnam (char *__s) __THROW __wur;
-__END_NAMESPACE_STD
 
 #ifdef __USE_MISC
 /* This is the reentrant variant of `tmpnam'.  The only difference is
@@ -232,7 +219,6 @@ extern char *tempnam (const char *__dir, const char *__pfx)
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Close STREAM.
 
    This function is a possible cancellation point and therefore not
@@ -243,7 +229,6 @@ extern int fclose (FILE *__stream);
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int fflush (FILE *__stream);
-__END_NAMESPACE_STD
 
 #ifdef __USE_MISC
 /* Faster versions when locking is not required.
@@ -266,7 +251,6 @@ extern int fcloseall (void);
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 #ifndef __USE_FILE_OFFSET64
 /* Open a file and create a new stream for it.
 
@@ -295,7 +279,6 @@ extern FILE *__REDIRECT (freopen, (const char *__restrict __filename,
 #  define freopen freopen64
 # endif
 #endif
-__END_NAMESPACE_STD
 #ifdef __USE_LARGEFILE64
 extern FILE *fopen64 (const char *__restrict __filename,
 		      const char *__restrict __modes) __wur;
@@ -329,7 +312,6 @@ extern FILE *open_memstream (char **__bufloc, size_t *__sizeloc) __THROW __wur;
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* If BUF is NULL, make STREAM unbuffered.
    Else make it use buffer BUF, of size BUFSIZ.  */
 extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
@@ -338,7 +320,6 @@ extern void setbuf (FILE *__restrict __stream, char *__restrict __buf) __THROW;
    else allocate an internal buffer N bytes long.  */
 extern int setvbuf (FILE *__restrict __stream, char *__restrict __buf,
 		    int __modes, size_t __n) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef	__USE_MISC
 /* If BUF is NULL, make STREAM unbuffered.
@@ -351,7 +332,6 @@ extern void setlinebuf (FILE *__stream) __THROW;
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Write formatted output to STREAM.
 
    This function is a possible cancellation point and therefore not
@@ -381,10 +361,8 @@ extern int vprintf (const char *__restrict __format, _G_va_list __arg);
 /* Write formatted output to S from argument list ARG.  */
 extern int vsprintf (char *__restrict __s, const char *__restrict __format,
 		     _G_va_list __arg) __THROWNL;
-__END_NAMESPACE_STD
 
 #if defined __USE_ISOC99 || defined __USE_UNIX98
-__BEGIN_NAMESPACE_C99
 /* Maximum chars of output to write in MAXLEN.  */
 extern int snprintf (char *__restrict __s, size_t __maxlen,
 		     const char *__restrict __format, ...)
@@ -393,7 +371,6 @@ extern int snprintf (char *__restrict __s, size_t __maxlen,
 extern int vsnprintf (char *__restrict __s, size_t __maxlen,
 		      const char *__restrict __format, _G_va_list __arg)
      __THROWNL __attribute__ ((__format__ (__printf__, 3, 0)));
-__END_NAMESPACE_C99
 #endif
 
 #if __GLIBC_USE (LIB_EXT2)
@@ -420,7 +397,6 @@ extern int dprintf (int __fd, const char *__restrict __fmt, ...)
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Read formatted input from STREAM.
 
    This function is a possible cancellation point and therefore not
@@ -463,10 +439,7 @@ extern int __isoc99_sscanf (const char *__restrict __s,
 # endif
 #endif
 
-__END_NAMESPACE_STD
-
 #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
@@ -521,12 +494,9 @@ extern int __isoc99_vsscanf (const char *__restrict __s,
 #   define vsscanf __isoc99_vsscanf
 #  endif
 # endif
-
-__END_NAMESPACE_C99
 #endif /* Use ISO C9x.  */
 
 
-__BEGIN_NAMESPACE_STD
 /* Read a character from STREAM.
 
    These functions are possible cancellation points and therefore not
@@ -539,7 +509,6 @@ extern int getc (FILE *__stream);
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int getchar (void);
-__END_NAMESPACE_STD
 
 /* The C standard explicitly says this is a macro, so we always do the
    optimization for it.  */
@@ -565,7 +534,6 @@ extern int fgetc_unlocked (FILE *__stream);
 #endif /* Use MISC.  */
 
 
-__BEGIN_NAMESPACE_STD
 /* Write a character to STREAM.
 
    These functions are possible cancellation points and therefore not
@@ -581,7 +549,6 @@ extern int putc (int __c, FILE *__stream);
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern int putchar (int __c);
-__END_NAMESPACE_STD
 
 /* The C standard explicitly says this can be a macro,
    so we always do the optimization for it.  */
@@ -617,7 +584,6 @@ extern int putw (int __w, FILE *__stream);
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Get a newline-terminated string of finite length from STREAM.
 
    This function is a possible cancellation point and therefore not
@@ -637,7 +603,6 @@ extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
    marked with __THROW.  */
 extern char *gets (char *__s) __wur __attribute_deprecated__;
 #endif
-__END_NAMESPACE_STD
 
 #ifdef __USE_GNU
 /* This function does the same as `fgets' but does not lock the stream.
@@ -681,7 +646,6 @@ extern _IO_ssize_t getline (char **__restrict __lineptr,
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Write a string to STREAM.
 
    This function is a possible cancellation point and therefore not
@@ -714,7 +678,6 @@ extern size_t fread (void *__restrict __ptr, size_t __size,
    marked with __THROW.  */
 extern size_t fwrite (const void *__restrict __ptr, size_t __size,
 		      size_t __n, FILE *__restrict __s);
-__END_NAMESPACE_STD
 
 #ifdef __USE_GNU
 /* This function does the same as `fputs' but does not lock the stream.
@@ -741,7 +704,6 @@ extern size_t fwrite_unlocked (const void *__restrict __ptr, size_t __size,
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Seek to a certain position on STREAM.
 
    This function is a possible cancellation point and therefore not
@@ -757,7 +719,6 @@ extern long int ftell (FILE *__stream) __wur;
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern void rewind (FILE *__stream);
-__END_NAMESPACE_STD
 
 /* The Single Unix Specification, Version 2, specifies an alternative,
    more adequate interface for the two functions above which deal with
@@ -789,7 +750,6 @@ extern __off64_t __REDIRECT (ftello, (FILE *__stream), ftello64);
 # endif
 #endif
 
-__BEGIN_NAMESPACE_STD
 #ifndef __USE_FILE_OFFSET64
 /* Get STREAM's position.
 
@@ -812,7 +772,6 @@ extern int __REDIRECT (fsetpos,
 #  define fsetpos fsetpos64
 # endif
 #endif
-__END_NAMESPACE_STD
 
 #ifdef __USE_LARGEFILE64
 extern int fseeko64 (FILE *__stream, __off64_t __off, int __whence);
@@ -821,14 +780,12 @@ extern int fgetpos64 (FILE *__restrict __stream, fpos64_t *__restrict __pos);
 extern int fsetpos64 (FILE *__stream, const fpos64_t *__pos);
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Clear the error and EOF indicators for STREAM.  */
 extern void clearerr (FILE *__stream) __THROW;
 /* Return the EOF indicator for STREAM.  */
 extern int feof (FILE *__stream) __THROW __wur;
 /* Return the error indicator for STREAM.  */
 extern int ferror (FILE *__stream) __THROW __wur;
-__END_NAMESPACE_STD
 
 #ifdef __USE_MISC
 /* Faster versions when locking is not required.  */
@@ -838,13 +795,11 @@ extern int ferror_unlocked (FILE *__stream) __THROW __wur;
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Print a message describing the meaning of the value of errno.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
 extern void perror (const char *__s);
-__END_NAMESPACE_STD
 
 /* Provide the declarations for `sys_errlist' and `sys_nerr' if they
    are available on this system.  Even if available, these variables
diff --git a/locale/locale.h b/locale/locale.h
index 20a842ea36..9a5fce9d47 100644
--- a/locale/locale.h
+++ b/locale/locale.h
@@ -47,8 +47,6 @@ __BEGIN_DECLS
 #define LC_IDENTIFICATION __LC_IDENTIFICATION
 
 
-__BEGIN_NAMESPACE_STD
-
 /* Structure giving information about numeric and monetary notation.  */
 struct lconv
 {
@@ -126,8 +124,6 @@ extern char *setlocale (int __category, const char *__locale) __THROW;
 /* Return the numeric/monetary information for the current locale.  */
 extern struct lconv *localeconv (void) __THROW;
 
-__END_NAMESPACE_STD
-
 
 #ifdef	__USE_XOPEN2K8
 /* The concept of one static locale per category is not very well
diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
index fe315fd3d1..0d341fbfe1 100644
--- a/math/bits/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -49,7 +49,6 @@
 
 /* Trigonometric functions.  */
 
-_Mdouble_BEGIN_NAMESPACE
 /* Arc cosine of X.  */
 __MATHCALL (acos,, (_Mdouble_ __x));
 /* Arc sine of X.  */
@@ -74,7 +73,6 @@ __MATHCALL (cosh,, (_Mdouble_ __x));
 __MATHCALL (sinh,, (_Mdouble_ __x));
 /* Hyperbolic tangent of X.  */
 __MATHCALL (tanh,, (_Mdouble_ __x));
-_Mdouble_END_NAMESPACE
 
 #ifdef __USE_GNU
 /* Cosine and sine of X.  */
@@ -83,19 +81,16 @@ __MATHDECL_VEC (void,sincos,,
 #endif
 
 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Hyperbolic arc cosine of X.  */
 __MATHCALL (acosh,, (_Mdouble_ __x));
 /* Hyperbolic arc sine of X.  */
 __MATHCALL (asinh,, (_Mdouble_ __x));
 /* Hyperbolic arc tangent of X.  */
 __MATHCALL (atanh,, (_Mdouble_ __x));
-__END_NAMESPACE_C99
 #endif
 
 /* Exponential and logarithmic functions.  */
 
-_Mdouble_BEGIN_NAMESPACE
 /* Exponential function of X.  */
 __MATHCALL_VEC (exp,, (_Mdouble_ __x));
 
@@ -113,7 +108,6 @@ __MATHCALL (log10,, (_Mdouble_ __x));
 
 /* Break VALUE into integral and fractional parts.  */
 __MATHCALL (modf,, (_Mdouble_ __x, _Mdouble_ *__iptr)) __nonnull ((2));
-_Mdouble_END_NAMESPACE
 
 #if __GLIBC_USE (IEC_60559_FUNCS_EXT)
 /* Compute exponent to base ten.  */
@@ -125,7 +119,6 @@ __MATHCALL (pow10,, (_Mdouble_ __x));
 #endif
 
 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Return exp(X) - 1.  */
 __MATHCALL (expm1,, (_Mdouble_ __x));
 
@@ -134,48 +127,38 @@ __MATHCALL (log1p,, (_Mdouble_ __x));
 
 /* Return the base 2 signed integral exponent of X.  */
 __MATHCALL (logb,, (_Mdouble_ __x));
-__END_NAMESPACE_C99
 #endif
 
 #ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Compute base-2 exponential of X.  */
 __MATHCALL (exp2,, (_Mdouble_ __x));
 
 /* Compute base-2 logarithm of X.  */
 __MATHCALL (log2,, (_Mdouble_ __x));
-__END_NAMESPACE_C99
 #endif
 
 
 /* Power functions.  */
 
-_Mdouble_BEGIN_NAMESPACE
 /* Return X to the Y power.  */
 __MATHCALL_VEC (pow,, (_Mdouble_ __x, _Mdouble_ __y));
 
 /* Return the square root of X.  */
 __MATHCALL (sqrt,, (_Mdouble_ __x));
-_Mdouble_END_NAMESPACE
 
 #if defined __USE_XOPEN || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Return `sqrt(X*X + Y*Y)'.  */
 __MATHCALL (hypot,, (_Mdouble_ __x, _Mdouble_ __y));
-__END_NAMESPACE_C99
 #endif
 
 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Return the cube root of X.  */
 __MATHCALL (cbrt,, (_Mdouble_ __x));
-__END_NAMESPACE_C99
 #endif
 
 
 /* Nearest integer, absolute value, and remainder functions.  */
 
-_Mdouble_BEGIN_NAMESPACE
 /* Smallest integral value not less than X.  */
 __MATHCALLX (ceil,, (_Mdouble_ __x), (__const__));
 
@@ -187,7 +170,6 @@ __MATHCALLX (floor,, (_Mdouble_ __x), (__const__));
 
 /* Floating-point modulo remainder of X/Y.  */
 __MATHCALL (fmod,, (_Mdouble_ __x, _Mdouble_ __y));
-_Mdouble_END_NAMESPACE
 
 #ifdef __USE_MISC
 # if (!defined __cplusplus \
@@ -210,17 +192,13 @@ __MATHCALL (significand,, (_Mdouble_ __x));
 #endif /* Use misc.  */
 
 #ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Return X with its signed changed to Y's.  */
 __MATHCALLX (copysign,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
-__END_NAMESPACE_C99
 #endif
 
 #ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Return representation of qNaN for double type.  */
 __MATHCALLX (nan,, (const char *__tagb), (__const__));
-__END_NAMESPACE_C99
 #endif
 
 
@@ -245,19 +223,15 @@ __MATHCALL (yn,, (int, _Mdouble_));
 
 
 #if defined __USE_XOPEN || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Error and gamma functions.  */
 __MATHCALL (erf,, (_Mdouble_));
 __MATHCALL (erfc,, (_Mdouble_));
 __MATHCALL (lgamma,, (_Mdouble_));
-__END_NAMESPACE_C99
 #endif
 
 #ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* True gamma function.  */
 __MATHCALL (tgamma,, (_Mdouble_));
-__END_NAMESPACE_C99
 #endif
 
 #if defined __USE_MISC || (defined __USE_XOPEN && !defined __USE_XOPEN2K)
@@ -274,7 +248,6 @@ __MATHCALL (lgamma,_r, (_Mdouble_, int *__signgamp));
 
 
 #if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Return the integer nearest X in the direction of the
    prevailing rounding mode.  */
 __MATHCALL (rint,, (_Mdouble_ __x));
@@ -359,10 +332,6 @@ __MATHCALLX (fmin,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
 __MATHCALL (fma,, (_Mdouble_ __x, _Mdouble_ __y, _Mdouble_ __z));
 #endif /* Use ISO C99.  */
 
-#if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__END_NAMESPACE_C99
-#endif
-
 #if __GLIBC_USE (IEC_60559_BFP_EXT)
 /* Round X to nearest integer value, rounding halfway cases to even.  */
 __MATHCALLX (roundeven,, (_Mdouble_ __x), (__const__));
diff --git a/math/math.h b/math/math.h
index fde307005c..c7895b735f 100644
--- a/math/math.h
+++ b/math/math.h
@@ -208,13 +208,9 @@ enum
 #define _Mdouble_		double
 #define __MATH_PRECNAME(name,r)	__CONCAT(name,r)
 #define __MATH_DECLARING_DOUBLE  1
-#define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_STD
-#define _Mdouble_END_NAMESPACE   __END_NAMESPACE_STD
 #include <bits/mathcalls-helper-functions.h>
 #include <bits/mathcalls.h>
 #undef	_Mdouble_
-#undef _Mdouble_BEGIN_NAMESPACE
-#undef _Mdouble_END_NAMESPACE
 #undef	__MATH_PRECNAME
 #undef __MATH_DECLARING_DOUBLE
 
@@ -230,13 +226,9 @@ enum
 # define _Mdouble_		_Mfloat_
 # define __MATH_PRECNAME(name,r) name##f##r
 # define __MATH_DECLARING_DOUBLE  0
-# define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99
-# define _Mdouble_END_NAMESPACE   __END_NAMESPACE_C99
 # include <bits/mathcalls-helper-functions.h>
 # include <bits/mathcalls.h>
 # undef	_Mdouble_
-# undef _Mdouble_BEGIN_NAMESPACE
-# undef _Mdouble_END_NAMESPACE
 # undef	__MATH_PRECNAME
 # undef __MATH_DECLARING_DOUBLE
 
@@ -277,14 +269,10 @@ extern long double __REDIRECT_NTH (nexttowardl,
 #  define _Mdouble_		_Mlong_double_
 #  define __MATH_PRECNAME(name,r) name##l##r
 #  define __MATH_DECLARING_DOUBLE  0
-#  define _Mdouble_BEGIN_NAMESPACE __BEGIN_NAMESPACE_C99
-#  define _Mdouble_END_NAMESPACE   __END_NAMESPACE_C99
 #  define __MATH_DECLARE_LDOUBLE   1
 #  include <bits/mathcalls-helper-functions.h>
 #  include <bits/mathcalls.h>
 #  undef _Mdouble_
-#  undef _Mdouble_BEGIN_NAMESPACE
-#  undef _Mdouble_END_NAMESPACE
 #  undef __MATH_PRECNAME
 #  undef __MATH_DECLARING_DOUBLE
 
diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h
index e5fe4f89d9..b03ebda22f 100644
--- a/misc/sys/cdefs.h
+++ b/misc/sys/cdefs.h
@@ -112,31 +112,6 @@
 #endif
 
 
-/* The standard library needs the functions from the ISO C90 standard
-   in the std namespace.  At the same time we want to be safe for
-   future changes and we include the ISO C99 code in the non-standard
-   namespace __c99.  The C++ wrapper header take case of adding the
-   definitions to the global namespace.  */
-#if defined __cplusplus && defined _GLIBCPP_USE_NAMESPACES
-# define __BEGIN_NAMESPACE_STD	namespace std {
-# define __END_NAMESPACE_STD	}
-# define __USING_NAMESPACE_STD(name) using std::name;
-# define __BEGIN_NAMESPACE_C99	namespace __c99 {
-# define __END_NAMESPACE_C99	}
-# define __USING_NAMESPACE_C99(name) using __c99::name;
-#else
-/* For compatibility we do not add the declarations into any
-   namespace.  They will end up in the global namespace which is what
-   old code expects.  */
-# define __BEGIN_NAMESPACE_STD
-# define __END_NAMESPACE_STD
-# define __USING_NAMESPACE_STD(name)
-# define __BEGIN_NAMESPACE_C99
-# define __END_NAMESPACE_C99
-# define __USING_NAMESPACE_C99(name)
-#endif
-
-
 /* Fortify support.  */
 #define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
 #define __bos0(ptr) __builtin_object_size (ptr, 0)
diff --git a/scripts/begin-end-check.pl b/scripts/begin-end-check.pl
deleted file mode 100644
index 1616931bb0..0000000000
--- a/scripts/begin-end-check.pl
+++ /dev/null
@@ -1,47 +0,0 @@
-#!/usr/bin/perl
-
-use strict;
-use warnings;
-
-# Check __BEGIN_NAMESPACE ... __END_NAMESPACE pairing in an include file.
-
-my $code = 0;
-for my $path (@ARGV) {
-    my $localcode = 0;
-    my @stack;
-
-    open my $in, '<', $path
-        or die "open $path failed: $!";
-
-    while (<$in>) {
-        if ( /^\s*__BEGIN_(.*)\b/ ) {
-            push @stack, $1;
-        }
-        elsif ( /^\s*__END_(.*)\b/ ) {
-            if (@stack) {
-                my $tag = pop @stack;
-		if ($1 ne $tag) {
-                    print "$path:$.: BEGIN $tag paired with END $1\n";
-		    $localcode = 1;
-		}
-            }
-            else {
-                print "$path:$.: END $1 does not match a begin\n";
-		$localcode = 1;
-            }
-        }
-    }
-
-    if (@stack) {
-	print "$path: Unmatched begin tags " . join (' ', @stack) ."\n";
-	$localcode = 1;
-    }
-
-    if ($localcode == 0) {
-	print "$path: OK\n";
-    } else {
-	$code = $localcode;
-    }
-}
-
-exit $code;
diff --git a/setjmp/setjmp.h b/setjmp/setjmp.h
index 98a5ea4c7c..e10adaf1fc 100644
--- a/setjmp/setjmp.h
+++ b/setjmp/setjmp.h
@@ -43,16 +43,12 @@ struct __jmp_buf_tag
   };
 
 
-__BEGIN_NAMESPACE_STD
-
 typedef struct __jmp_buf_tag jmp_buf[1];
 
 /* Store the calling environment in ENV, also saving the signal mask.
    Return 0.  */
 extern int setjmp (jmp_buf __env) __THROWNL;
 
-__END_NAMESPACE_STD
-
 /* Store the calling environment in ENV, also saving the
    signal mask if SAVEMASK is nonzero.  Return 0.
    This is the internal name for `sigsetjmp'.  */
@@ -67,15 +63,11 @@ extern int _setjmp (struct __jmp_buf_tag __env[1]) __THROWNL;
 #define setjmp(env)	_setjmp (env)
 
 
-__BEGIN_NAMESPACE_STD
-
 /* Jump to the environment saved in ENV, making the
    `setjmp' call there return VAL, or 1 if VAL is 0.  */
 extern void longjmp (struct __jmp_buf_tag __env[1], int __val)
      __THROWNL __attribute__ ((__noreturn__));
 
-__END_NAMESPACE_STD
-
 #if defined __USE_MISC || defined __USE_XOPEN
 /* Same.  Usually `_longjmp' is used with `_setjmp', which does not save
    the signal mask.  But it is how ENV was saved that determines whether
diff --git a/signal/signal.h b/signal/signal.h
index 2c7f9e1043..84f2a1f11e 100644
--- a/signal/signal.h
+++ b/signal/signal.h
@@ -36,9 +36,7 @@ __BEGIN_DECLS
 #if defined __need_sig_atomic_t || defined _SIGNAL_H
 # ifndef __sig_atomic_t_defined
 #  define __sig_atomic_t_defined
-__BEGIN_NAMESPACE_STD
 typedef __sig_atomic_t sig_atomic_t;
-__END_NAMESPACE_STD
 # endif
 # undef __need_sig_atomic_t
 #endif
@@ -96,7 +94,6 @@ extern __sighandler_t sysv_signal (int __sig, __sighandler_t __handler)
 /* Set the handler for the signal SIG to HANDLER, returning the old
    handler, or SIG_ERR on error.
    By default `signal' has the BSD semantic.  */
-__BEGIN_NAMESPACE_STD
 #ifdef __USE_MISC
 extern __sighandler_t signal (int __sig, __sighandler_t __handler)
      __THROW;
@@ -110,7 +107,6 @@ extern __sighandler_t __REDIRECT_NTH (signal,
 #  define signal __sysv_signal
 # endif
 #endif
-__END_NAMESPACE_STD
 
 #ifdef __USE_XOPEN
 /* The X/Open definition of `signal' conflicts with the BSD version.
@@ -133,10 +129,8 @@ extern int kill (__pid_t __pid, int __sig) __THROW;
 extern int killpg (__pid_t __pgrp, int __sig) __THROW;
 #endif /* Use misc || X/Open Unix.  */
 
-__BEGIN_NAMESPACE_STD
 /* Raise signal SIG, i.e., send SIG to yourself.  */
 extern int raise (int __sig) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef __USE_MISC
 /* SVID names for the same things.  */
diff --git a/stdlib/bits/stdlib-float.h b/stdlib/bits/stdlib-float.h
index 8052668486..aba8e94596 100644
--- a/stdlib/bits/stdlib-float.h
+++ b/stdlib/bits/stdlib-float.h
@@ -21,11 +21,9 @@
 #endif
 
 #ifdef __USE_EXTERN_INLINES
-__BEGIN_NAMESPACE_STD
 __extern_inline double
 __NTH (atof (const char *__nptr))
 {
   return strtod (__nptr, (char **) NULL);
 }
-__END_NAMESPACE_STD
 #endif /* Optimizing and Inlining.  */
diff --git a/stdlib/bits/stdlib-ldbl.h b/stdlib/bits/stdlib-ldbl.h
index 85d9ee1556..2f568db45a 100644
--- a/stdlib/bits/stdlib-ldbl.h
+++ b/stdlib/bits/stdlib-ldbl.h
@@ -21,9 +21,7 @@
 #endif
 
 #ifdef	__USE_ISOC99
-__BEGIN_NAMESPACE_C99
 __LDBL_REDIR1_DECL (strtold, strtod)
-__END_NAMESPACE_C99
 #endif
 
 #ifdef __USE_GNU
diff --git a/stdlib/stdlib.h b/stdlib/stdlib.h
index 7cfbcafe79..c1f389253a 100644
--- a/stdlib/stdlib.h
+++ b/stdlib/stdlib.h
@@ -51,7 +51,6 @@ __BEGIN_DECLS
 # endif
 #endif	/* X/Open or XPG7 and <sys/wait.h> not included.  */
 
-__BEGIN_NAMESPACE_STD
 /* Returned by `div'.  */
 typedef struct
   {
@@ -68,10 +67,8 @@ typedef struct
   } ldiv_t;
 # define __ldiv_t_defined	1
 #endif
-__END_NAMESPACE_STD
 
 #if defined __USE_ISOC99 && !defined __lldiv_t_defined
-__BEGIN_NAMESPACE_C99
 /* Returned by `lldiv'.  */
 __extension__ typedef struct
   {
@@ -79,7 +76,6 @@ __extension__ typedef struct
     long long int rem;		/* Remainder.  */
   } lldiv_t;
 # define __lldiv_t_defined	1
-__END_NAMESPACE_C99
 #endif
 
 
@@ -98,7 +94,6 @@ __END_NAMESPACE_C99
 extern size_t __ctype_get_mb_cur_max (void) __THROW __wur;
 
 
-__BEGIN_NAMESPACE_STD
 /* Convert a string to a floating-point number.  */
 extern double atof (const char *__nptr)
      __THROW __attribute_pure__ __nonnull ((1)) __wur;
@@ -108,25 +103,19 @@ extern int atoi (const char *__nptr)
 /* Convert a string to a long integer.  */
 extern long int atol (const char *__nptr)
      __THROW __attribute_pure__ __nonnull ((1)) __wur;
-__END_NAMESPACE_STD
 
 #ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Convert a string to a long long integer.  */
 __extension__ extern long long int atoll (const char *__nptr)
      __THROW __attribute_pure__ __nonnull ((1)) __wur;
-__END_NAMESPACE_C99
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Convert a string to a floating-point number.  */
 extern double strtod (const char *__restrict __nptr,
 		      char **__restrict __endptr)
      __THROW __nonnull ((1));
-__END_NAMESPACE_STD
 
 #ifdef	__USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Likewise for `float' and `long double' sizes of floating-point numbers.  */
 extern float strtof (const char *__restrict __nptr,
 		     char **__restrict __endptr) __THROW __nonnull ((1));
@@ -134,10 +123,8 @@ extern float strtof (const char *__restrict __nptr,
 extern long double strtold (const char *__restrict __nptr,
 			    char **__restrict __endptr)
      __THROW __nonnull ((1));
-__END_NAMESPACE_C99
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Convert a string to a long integer.  */
 extern long int strtol (const char *__restrict __nptr,
 			char **__restrict __endptr, int __base)
@@ -146,7 +133,6 @@ extern long int strtol (const char *__restrict __nptr,
 extern unsigned long int strtoul (const char *__restrict __nptr,
 				  char **__restrict __endptr, int __base)
      __THROW __nonnull ((1));
-__END_NAMESPACE_STD
 
 #ifdef __USE_MISC
 /* Convert a string to a quadword integer.  */
@@ -162,7 +148,6 @@ extern unsigned long long int strtouq (const char *__restrict __nptr,
 #endif /* Use misc.  */
 
 #ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Convert a string to a quadword integer.  */
 __extension__
 extern long long int strtoll (const char *__restrict __nptr,
@@ -173,7 +158,6 @@ __extension__
 extern unsigned long long int strtoull (const char *__restrict __nptr,
 					char **__restrict __endptr, int __base)
      __THROW __nonnull ((1));
-__END_NAMESPACE_C99
 #endif /* ISO C99 or use MISC.  */
 
 /* Convert a floating-point number to a string.  */
@@ -247,7 +231,6 @@ extern long double strtold_l (const char *__restrict __nptr,
 
 
 #ifdef __USE_EXTERN_INLINES
-__BEGIN_NAMESPACE_STD
 __extern_inline int
 __NTH (atoi (const char *__nptr))
 {
@@ -258,16 +241,13 @@ __NTH (atol (const char *__nptr))
 {
   return strtol (__nptr, (char **) NULL, 10);
 }
-__END_NAMESPACE_STD
 
 # ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 __extension__ __extern_inline long long int
 __NTH (atoll (const char *__nptr))
 {
   return strtoll (__nptr, (char **) NULL, 10);
 }
-__END_NAMESPACE_C99
 # endif
 #endif /* Optimizing and Inlining.  */
 
@@ -343,12 +323,10 @@ extern int setstate_r (char *__restrict __statebuf,
 #endif	/* Use extended X/Open || misc. */
 
 
-__BEGIN_NAMESPACE_STD
 /* Return a random integer between 0 and RAND_MAX inclusive.  */
 extern int rand (void) __THROW;
 /* Seed the random number generator with the given number.  */
 extern void srand (unsigned int __seed) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef __USE_POSIX199506
 /* Reentrant interface according to POSIX.1.  */
@@ -431,15 +409,12 @@ extern int lcong48_r (unsigned short int __param[7],
 # endif	/* Use misc.  */
 #endif	/* Use misc or X/Open.  */
 
-__BEGIN_NAMESPACE_STD
 /* Allocate SIZE bytes of memory.  */
 extern void *malloc (size_t __size) __THROW __attribute_malloc__ __wur;
 /* Allocate NMEMB elements of SIZE bytes each, all initialized to 0.  */
 extern void *calloc (size_t __nmemb, size_t __size)
      __THROW __attribute_malloc__ __wur;
-__END_NAMESPACE_STD
 
-__BEGIN_NAMESPACE_STD
 /* Re-allocate the previously allocated block
    in PTR, making the new block SIZE bytes long.  */
 /* __attribute_malloc__ is not used, because if realloc returns
@@ -449,7 +424,6 @@ extern void *realloc (void *__ptr, size_t __size)
      __THROW __attribute_warn_unused_result__;
 /* Free a block allocated by `malloc', `realloc' or `calloc'.  */
 extern void free (void *__ptr) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef	__USE_MISC
 /* Free a block.  An alias for `free'.	(Sun Unices).  */
@@ -478,7 +452,6 @@ extern void *aligned_alloc (size_t __alignment, size_t __size)
      __THROW __attribute_malloc__ __attribute_alloc_size__ ((2)) __wur;
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Abort execution and generate a core-dump.  */
 extern void abort (void) __THROW __attribute__ ((__noreturn__));
 
@@ -495,7 +468,6 @@ extern "C++" int at_quick_exit (void (*__func) (void))
 extern int at_quick_exit (void (*__func) (void)) __THROW __nonnull ((1));
 # endif
 #endif
-__END_NAMESPACE_STD
 
 #ifdef	__USE_MISC
 /* Register a function to be called with the status
@@ -504,7 +476,6 @@ extern int on_exit (void (*__func) (int __status, void *__arg), void *__arg)
      __THROW __nonnull ((1));
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Call all functions registered with `atexit' and `on_exit',
    in the reverse of the order in which they were registered,
    perform stdio cleanup, and terminate program execution with STATUS.  */
@@ -516,21 +487,16 @@ extern void exit (int __status) __THROW __attribute__ ((__noreturn__));
    execution with STATUS.  */
 extern void quick_exit (int __status) __THROW __attribute__ ((__noreturn__));
 #endif
-__END_NAMESPACE_STD
 
 #ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 /* Terminate the program with STATUS without calling any of the
    functions registered with `atexit' or `on_exit'.  */
 extern void _Exit (int __status) __THROW __attribute__ ((__noreturn__));
-__END_NAMESPACE_C99
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Return the value of envariable NAME, or NULL if it doesn't exist.  */
 extern char *getenv (const char *__name) __THROW __nonnull ((1)) __wur;
-__END_NAMESPACE_STD
 
 #ifdef __USE_GNU
 /* This function is similar to the above but returns NULL if the
@@ -676,13 +642,11 @@ extern int mkostemps64 (char *__template, int __suffixlen, int __flags)
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Execute the given line as a shell command.
 
    This function is a cancellation point and therefore not marked with
    __THROW.  */
 extern int system (const char *__command) __wur;
-__END_NAMESPACE_STD
 
 
 #ifdef	__USE_GNU
@@ -716,7 +680,6 @@ typedef __compar_fn_t comparison_fn_t;
 typedef int (*__compar_d_fn_t) (const void *, const void *, void *);
 #endif
 
-__BEGIN_NAMESPACE_STD
 /* Do a binary search for KEY in BASE, which consists of NMEMB elements
    of SIZE bytes each, using COMPAR to perform the comparisons.  */
 extern void *bsearch (const void *__key, const void *__base,
@@ -741,7 +704,6 @@ extern void qsort_r (void *__base, size_t __nmemb, size_t __size,
 /* Return the absolute value of X.  */
 extern int abs (int __x) __THROW __attribute__ ((__const__)) __wur;
 extern long int labs (long int __x) __THROW __attribute__ ((__const__)) __wur;
-__END_NAMESPACE_STD
 
 #ifdef __USE_ISOC99
 __extension__ extern long long int llabs (long long int __x)
@@ -749,7 +711,6 @@ __extension__ extern long long int llabs (long long int __x)
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Return the `div_t', `ldiv_t' or `lldiv_t' representation
    of the value of NUMER over DENOM. */
 /* GCC may have built-ins for these someday.  */
@@ -757,14 +718,11 @@ extern div_t div (int __numer, int __denom)
      __THROW __attribute__ ((__const__)) __wur;
 extern ldiv_t ldiv (long int __numer, long int __denom)
      __THROW __attribute__ ((__const__)) __wur;
-__END_NAMESPACE_STD
 
 #ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 __extension__ extern lldiv_t lldiv (long long int __numer,
 				    long long int __denom)
      __THROW __attribute__ ((__const__)) __wur;
-__END_NAMESPACE_C99
 #endif
 
 
@@ -824,7 +782,6 @@ extern int qfcvt_r (long double __value, int __ndigit,
 #endif	/* misc */
 
 
-__BEGIN_NAMESPACE_STD
 /* Return the length of the multibyte character
    in S, which is no longer than N.  */
 extern int mblen (const char *__s, size_t __n) __THROW;
@@ -844,7 +801,6 @@ extern size_t mbstowcs (wchar_t *__restrict  __pwcs,
 extern size_t wcstombs (char *__restrict __s,
 			const wchar_t *__restrict __pwcs, size_t __n)
      __THROW;
-__END_NAMESPACE_STD
 
 
 #ifdef __USE_MISC
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
diff --git a/sysdeps/x86/fpu/bits/mathinline.h b/sysdeps/x86/fpu/bits/mathinline.h
index 3cab929ff7..bcd99bdf74 100644
--- a/sysdeps/x86/fpu/bits/mathinline.h
+++ b/sysdeps/x86/fpu/bits/mathinline.h
@@ -120,7 +120,6 @@
 /* The gcc, version 2.7 or below, has problems with all this inlining
    code.  So disable it for this version of the compiler.  */
 # if __GNUC_PREREQ (2, 8)
-__BEGIN_NAMESPACE_C99
 
 /* Test for negative number.  Used in the signbit() macro.  */
 __MATH_INLINE int
@@ -154,7 +153,6 @@ __NTH (__signbitl (long double __x))
   return (__u.__i[2] & 0x8000) != 0;
 }
 
-__END_NAMESPACE_C99
 # endif
 #endif
 
@@ -168,7 +166,6 @@ __END_NAMESPACE_C99
    there's no need to define any of these inline functions.  */
 
 #  ifdef __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 
 /* Round to nearest integer.  */
 #   ifdef __SSE_MATH__
@@ -279,12 +276,10 @@ __NTH (fmin (double __x, double __y))
 }
 #   endif
 
-__END_NAMESPACE_C99
 #  endif
 
 #  if defined __SSE4_1__ && defined __SSE2_MATH__
 #   if defined __USE_XOPEN_EXTENDED || defined __USE_ISOC99
-__BEGIN_NAMESPACE_C99
 
 /* Round to nearest integer.  */
 __MATH_INLINE double
@@ -336,10 +331,8 @@ __NTH (nearbyintf (float __x))
 }
 #    endif
 
-__END_NAMESPACE_C99
 #   endif
 
-__BEGIN_NAMESPACE_STD
 /* Smallest integral value not less than X.  */
 __MATH_INLINE double
 __NTH (ceil (double __x))
@@ -348,9 +341,7 @@ __NTH (ceil (double __x))
   __asm ("roundsd $2, %1, %0" : "=x" (__res) : "xm" (__x));
   return __res;
 }
-__END_NAMESPACE_STD
 
-__BEGIN_NAMESPACE_C99
 __MATH_INLINE float
 __NTH (ceilf (float __x))
 {
@@ -358,9 +349,7 @@ __NTH (ceilf (float __x))
   __asm ("roundss $2, %1, %0" : "=x" (__res) : "xm" (__x));
   return __res;
 }
-__END_NAMESPACE_C99
 
-__BEGIN_NAMESPACE_STD
 /* Largest integer not greater than X.  */
 __MATH_INLINE double
 __NTH (floor (double __x))
@@ -369,9 +358,7 @@ __NTH (floor (double __x))
   __asm ("roundsd $1, %1, %0" : "=x" (__res) : "xm" (__x));
   return __res;
 }
-__END_NAMESPACE_STD
 
-__BEGIN_NAMESPACE_C99
 __MATH_INLINE float
 __NTH (floorf (float __x))
 {
@@ -379,7 +366,6 @@ __NTH (floorf (float __x))
   __asm ("roundss $1, %1, %0" : "=x" (__res) : "xm" (__x));
   return __res;
 }
-__END_NAMESPACE_C99
 #  endif
 # endif
 #endif
diff --git a/time/bits/types/clock_t.h b/time/bits/types/clock_t.h
index b8cbaf2cb6..ce97248f88 100644
--- a/time/bits/types/clock_t.h
+++ b/time/bits/types/clock_t.h
@@ -3,13 +3,7 @@
 
 #include <bits/types.h>
 
-__BEGIN_NAMESPACE_STD
 /* Returned by `clock'.  */
 typedef __clock_t clock_t;
-__END_NAMESPACE_STD
-
-#if defined __USE_XOPEN || defined __USE_POSIX
-__USING_NAMESPACE_STD(clock_t)
-#endif
 
 #endif
diff --git a/time/bits/types/struct_tm.h b/time/bits/types/struct_tm.h
index 8f5af16715..b13b631228 100644
--- a/time/bits/types/struct_tm.h
+++ b/time/bits/types/struct_tm.h
@@ -4,7 +4,6 @@
 #include <bits/types.h>
 
 /* ISO C `broken-down time' structure.  */
-__BEGIN_NAMESPACE_STD
 struct tm
 {
   int tm_sec;			/* Seconds.	[0-60] (1 leap second) */
@@ -25,9 +24,5 @@ struct tm
   const char *__tm_zone;	/* Timezone abbreviation.  */
 # endif
 };
-__END_NAMESPACE_STD
-#if defined __USE_XOPEN || defined __USE_POSIX
-__USING_NAMESPACE_STD(tm)
-#endif
 
 #endif
diff --git a/time/bits/types/time_t.h b/time/bits/types/time_t.h
index 16e5269184..ab8287c6fe 100644
--- a/time/bits/types/time_t.h
+++ b/time/bits/types/time_t.h
@@ -3,12 +3,7 @@
 
 #include <bits/types.h>
 
-__BEGIN_NAMESPACE_STD
 /* Returned by `time'.  */
 typedef __time_t time_t;
-__END_NAMESPACE_STD
-#ifdef __USE_POSIX
-__USING_NAMESPACE_STD(time_t)
-#endif
 
 #endif
diff --git a/time/time.h b/time/time.h
index 7f98338abe..bb4994feee 100644
--- a/time/time.h
+++ b/time/time.h
@@ -67,7 +67,6 @@ typedef __pid_t pid_t;
 
 __BEGIN_DECLS
 
-__BEGIN_NAMESPACE_STD
 /* Time used by the program so far (user time + system time).
    The result / CLOCKS_PER_SECOND is program time in seconds.  */
 extern clock_t clock (void) __THROW;
@@ -89,7 +88,6 @@ extern time_t mktime (struct tm *__tp) __THROW;
 extern size_t strftime (char *__restrict __s, size_t __maxsize,
 			const char *__restrict __format,
 			const struct tm *__restrict __tp) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef __USE_XOPEN
 /* Parse S according to FORMAT and store binary time information in TP.
@@ -116,7 +114,6 @@ extern char *strptime_l (const char *__restrict __s,
 #endif
 
 
-__BEGIN_NAMESPACE_STD
 /* Return the `struct tm' representation of *TIMER
    in Universal Coordinated Time (aka Greenwich Mean Time).  */
 extern struct tm *gmtime (const time_t *__timer) __THROW;
@@ -124,7 +121,6 @@ extern struct tm *gmtime (const time_t *__timer) __THROW;
 /* Return the `struct tm' representation
    of *TIMER in the local timezone.  */
 extern struct tm *localtime (const time_t *__timer) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef __USE_POSIX
 /* Return the `struct tm' representation of *TIMER in UTC,
@@ -138,14 +134,12 @@ extern struct tm *localtime_r (const time_t *__restrict __timer,
 			       struct tm *__restrict __tp) __THROW;
 #endif	/* POSIX */
 
-__BEGIN_NAMESPACE_STD
 /* Return a string of the form "Day Mon dd hh:mm:ss yyyy\n"
    that is the representation of TP in this format.  */
 extern char *asctime (const struct tm *__tp) __THROW;
 
 /* Equivalent to `asctime (localtime (timer))'.  */
 extern char *ctime (const time_t *__timer) __THROW;
-__END_NAMESPACE_STD
 
 #ifdef __USE_POSIX
 /* Reentrant versions of the above functions.  */
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>
diff --git a/wctype/wctype.h b/wctype/wctype.h
index 20cb820e4d..73165bbda2 100644
--- a/wctype/wctype.h
+++ b/wctype/wctype.h
@@ -46,11 +46,9 @@
 #ifndef __iswxxx_defined
 # define __iswxxx_defined	1
 
-__BEGIN_NAMESPACE_C99
 /* Scalar type that can hold values which represent locale-specific
    character classifications.  */
 typedef unsigned long int wctype_t;
-__END_NAMESPACE_C99
 
 # ifndef _ISwbit
 /* The characteristics are stored always in network byte order (big
@@ -101,7 +99,6 @@ enum
 
 __BEGIN_DECLS
 
-__BEGIN_NAMESPACE_C99
 /*
  * Wide-character classification functions: 7.15.2.1.
  */
@@ -173,29 +170,21 @@ extern wctype_t wctype (const char *__property) __THROW;
 /* Determine whether the wide-character WC has the property described by
    DESC.  */
 extern int iswctype (wint_t __wc, wctype_t __desc) __THROW;
-__END_NAMESPACE_C99
 
 
 /*
  * Wide-character case-mapping functions: 7.15.3.1.
  */
 
-__BEGIN_NAMESPACE_C99
 /* Scalar type that can hold values which represent locale-specific
    character mappings.  */
 typedef const __int32_t *wctrans_t;
-__END_NAMESPACE_C99
-#ifdef __USE_GNU
-__USING_NAMESPACE_C99(wctrans_t)
-#endif
 
-__BEGIN_NAMESPACE_C99
 /* Converts an uppercase letter to the corresponding lowercase letter.  */
 extern wint_t towlower (wint_t __wc) __THROW;
 
 /* Converts an lowercase letter to the corresponding uppercase letter.  */
 extern wint_t towupper (wint_t __wc) __THROW;
-__END_NAMESPACE_C99
 
 __END_DECLS
 
@@ -212,14 +201,12 @@ __END_DECLS
 
 __BEGIN_DECLS
 
-__BEGIN_NAMESPACE_C99
 /* Construct value that describes a mapping between wide characters
    identified by the string argument PROPERTY.  */
 extern wctrans_t wctrans (const char *__property) __THROW;
 
 /* Map the wide character WC using the mapping described by DESC.  */
 extern wint_t towctrans (wint_t __wc, wctrans_t __desc) __THROW;
-__END_NAMESPACE_C99
 
 # ifdef __USE_XOPEN2K8
 /* Declare the interface to extended locale model.  */