This is the mail archive of the glibc-cvs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

GNU C Library master sources branch zack/testsuite-isomac created. glibc-2.25-49-g92c6a21


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU C Library master sources".

The branch, zack/testsuite-isomac has been created
        at  92c6a21befda8d7bba14d91b7b79e532726a22ae (commit)

- Log -----------------------------------------------------------------
http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=92c6a21befda8d7bba14d91b7b79e532726a22ae

commit 92c6a21befda8d7bba14d91b7b79e532726a22ae
Author: Zack Weinberg <zackw@panix.com>
Date:   Sun Nov 20 20:46:30 2016 -0500

    Suppress internal declarations for most of the testsuite.
    
    	* Makerules: New subdir configuration variables 'tests-internal'
    	and 'test-internal-extras'.  Test files in these categories will
    	still be compiled with MODULE_NAME=nonlib.  Test files in the
    	existing categories (tests, xtests, test-srcs, test-extras) are
    	now compiled with MODULE_NAME=testsuite.
    	Use cppflags-iterator.mk instead of extra-modules.mk for the
    	files in $(modules-names).  Temporary kludge some of these into
    	MODULE_NAME=testsuite with a name-based heuristic.
    	(gen-as-const-headers): Move to tests-internal.
    	(do-tests-clean, common-mostlyclean): Support tests-internal.
    	* Makeconfig (+gccwarn): Temporarily add -fmax-errors=5.
    	(built-modules): Add testsuite.
    	* Makefile: Change libof-check-installed-headers-c and
    	libof-check-installed-headers-cxx to 'testsuite'.
    	* Rules: Likewise.  Support tests-internal.
    	* extra-modules.mk: Removed.
    
    	* config.h.in: Don't check for __OPTIMIZE__ or __FAST_MATH__ here.
    	* include/libc-symbols.h: Move definitions of _GNU_SOURCE,
    	PASTE_NAME, PASTE_NAME1, IN_MODULE, IS_IN, and IS_IN_LIB to the
    	very top of the file and rationalize their order.  Immediately after
    	that, if any of IS_IN (testsuite), IS_IN_build, or __cplusplus are
    	true, define _ISOMAC and suppress everything else in this file,
    	starting with the inclusion of config.h.  Do check for inappropriate
    	definitions of __OPTIMIZE__ and __FAST_MATH__ here, but only if
    	_ISOMAC is not defined. Correct some out-of-date commentary.
    	* include/stdio.h: If _ISOMAC is defined, undefine _IO_MTSAFE_IO
    	before including libio/stdio.h (this causes the external version of
    	_IO_lock_t to be visible).
    	* include/errno.h, include/stdio.h, include/stdlib.h
    	* include/time.h, include/unistd.h, include/wchar.h: No need to
    	check __cplusplus nor use __BEGIN_DECLS/__END_DECLS.
    
    	* include/libc-diag.h: New file which defines ignore_value,
    	DIAG_PUSH_NEEDS_COMMENT, DIAG_POP_NEEDS_COMMENT,
    	DIAG_IGNORE_NEEDS_COMMENT, and DIAG_IGNORE_Os_NEEDS_COMMENT...
    	* include/libc-internal.h: ...moved from here; include libc-diag.h.
    	* malloc/tst-malloc.c, malloc/tst-memcheck.c, malloc/tst-realloc.c
    	* misc/tst-error1.c, posix/tst-dir.c, stdio-common/bug21.c
    	* stdio-common/scanf14.c, stdio-common/scanf4.c, stdio-common/scanf7.c
    	* stdio-common/test-vfprintf.c, stdio-common/tst-printf.c
    	* stdio-common/tst-printfsz.c, stdio-common/tst-sprintf.c
    	* stdio-common/tst-unlockedio.c, stdio-common/tstdiomisc.c
    	* stdlib/bug-getcontext.c, string/tester.c, time/tst-strptime2.c
    	* wcsmbs/tst-wcstof.c: Include libc-diag.h instead of libc-internal.h.
    
    	* sysdeps/generic/math_ldbl.h: Allow direct inclusion but replace the
    	"this file is empty" comment with an #error directive.
    	* sysdeps/ia64/fpu/math_ldbl.h
    	* sysdeps/ieee754/ldbl-128/math_ldbl.h
    	* sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
    	* sysdeps/ieee754/ldbl-96/math_ldbl.h
    	* sysdeps/powerpc/fpu/math_ldbl.h
    	* sysdeps/x86_64/fpu/math_ldbl.h:
    	Allow direct inclusion. Include stdint.h. Use uintNN_t instead of
    	u_intNN_t.
    
    	* sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c
    	* sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c
    	Include math_ldbl.h instead of math_private.h.
    
    	* dlfcn/Makefile: Move tst-dladdr to tests-internal.
    	* elf/Makefile: Move tst-ptrguard1-static, tst-stackguard1-static,
    	loadtest, unload, unload2, circleload1, neededtest, neededtest2,
    	neededtest3, neededtest4, tst-tls6, tst-tls7, tst-tls8, tst-dlmopen2,
    	tst-ptrguard1, tst-stackguard1, tst-_dl_addr_inside_object, and all
    	of the ifunc tests to tests-internal.
    	* inet/Makefile: Move tst-inet6_scopeid_pton to tests-internal.
    	* malloc/Makefile: Move tst-mallocstate and tst-scratch_buffer to
    	tests-internal.
    	* misc/Makefile: Move tst-atomic and tst-atomic-long to tests-internal.
    	* nptl/Makefile: Move tst-typesizes, tst-rwlock19, tst-sem11,
    	tst-sem12, tst-sem13, tst-barrier5, tst-signal7, tst-tls5,
    	tst-stackguard1, tst-sem11-static, tst-sem12-static, and
    	tst-stackguard1-static to tests-internal.  Link tests-internal
    	with libpthread also.
    	* nss/Makefile: Move tst-field and tst-cancel-getpwuid_r to
    	tests-internal.
    	* posix/Makefile: Move bug-regex5, bug-regex20, bug-regex33,
    	tst-rfc3484, tst-rfc3484-2, and tst-rfc3484-3 to tests-internal.
    	* stdlib/Makefile: Move tst-strtod1i, tst-strtod3, tst-strtod4,
    	tst-strtod5i, tst-tls-atexit, and tst-tls-atexit-nodelete to
    	tests-internal.
    
    	* inet/tst-checks-posix.c: No need to define _ISOMAC.
    	* intl/tst-gettext2.c: Provide own definition of N_.
    	* math/test-signgam-finite-c99.c: No need to define _ISOMAC.
    	* math/test-signgam-main.c: No need to define _ISOMAC.
    	* nptl/tst-join7.c: Include stdlib.h. Include stdatomic.h instead of
    	atomic.h.  Use C11 atomics instead of libc-internal atomics.
    	* nptl/tst-mutex1.c: Include libc-diag.h.  Suppress -Wnonnull for
    	call to pthread_mutexattr_destroy (NULL).
    	* posix/wordexp-test.c: Include stdint.h. Don't include
    	libc-internal.h. Define PTR_ALIGN_DOWN here.
    	* stdlib/tst-environ.c: Include libc-diag.h.  Suppress -Wnonnull for
    	call to unsetenv (NULL).
    	* stdlib/tst-strtod.c: Split locale_test to...
    	* stdlib/tst-strtod1i.c: ...this new file.
    	* stdlib/tst-strtod5.c: Split tests of __strtod_internal to...
    	* stdlib/tst-strtod5i.c: ...this new file.
    	* string/strcasestr.c: No need to include config.h.
    	* string/test-string.h: Include stdint.h. Duplicate definition of
    	inhibit_loop_to_libcall here (from libc-symbols.h).
    	* string/test-strstr.c: Provide dummy definition of
    	libc_hidden_builtin_def when including strstr.c.
    	* string/tst-endian.c: Include libc-diag.h.
    	* sysdeps/unix/sysv/linux/Makefile (CFLAGS-tst-writev.c):
    	Use sysconf (_SC_PAGESIZE) instead of __getpagesize in definition of
    	ARTIFICIAL_LIMIT.
    	* sysdeps/unix/sysv/linux/tst-setgetname.c:
    	Don't include kernel-features.h. Don't #ifndef out anything
    	based on __ASSUME macros.
    
    	* benchtests/strcoll-inputs/filelist#en_US.UTF-8:
    	Remove extra-modules.mk.

diff --git a/Makeconfig b/Makeconfig
index 97a15b5..63e5e80 100644
--- a/Makeconfig
+++ b/Makeconfig
@@ -792,7 +792,7 @@ ifeq ($(all-warnings),yes)
 else
 +gccwarn := -Wall -Wwrite-strings
 endif
-+gccwarn += -Wundef
++gccwarn += -Wundef -fmax-errors=5
 ifeq ($(enable-werror),yes)
 +gccwarn += -Werror
 endif
@@ -901,7 +901,8 @@ libio-include = -I$(..)libio
 # List of non-library modules that we build.
 built-modules = iconvprogs iconvdata ldconfig lddlibc4 libmemusage \
 		libSegFault libpcprofile librpcsvc locale-programs \
-		memusagestat nonlib nscd extramodules libnldbl libsupport
+		memusagestat nonlib nscd extramodules libnldbl libsupport \
+		testsuite
 
 in-module = $(subst -,_,$(firstword $(libof-$(basename $(@F))) \
 				    $(libof-$(<F)) \
diff --git a/Makefile b/Makefile
index 425cb79..0ce12e9 100644
--- a/Makefile
+++ b/Makefile
@@ -321,7 +321,7 @@ endif
 ifneq "$(headers)" ""
 # Special test of all the installed headers in this directory.
 tests-special += $(objpfx)check-installed-headers-c.out
-libof-check-installed-headers-c := nonlib
+libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
@@ -331,7 +331,7 @@ $(objpfx)check-installed-headers-c.out: \
 
 ifneq "$(CXX)" ""
 tests-special += $(objpfx)check-installed-headers-cxx.out
-libof-check-installed-headers-cxx := nonlib
+libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
diff --git a/Makerules b/Makerules
index e9194e5..d2f5326 100644
--- a/Makerules
+++ b/Makerules
@@ -277,7 +277,7 @@ $(common-objpfx)%.h $(common-objpfx)%.h.d: $(..)scripts/gen-as-const.awk \
 vpath %.sym $(sysdirs)
 before-compile += $(gen-as-const-headers:%.sym=$(common-objpfx)%.h)
 
-tests += $(gen-as-const-headers:%.sym=test-as-const-%)
+tests-internal += $(gen-as-const-headers:%.sym=test-as-const-%)
 generated += $(gen-as-const-headers:%.sym=test-as-const-%.c)
 $(objpfx)test-as-const-%.c: $(..)scripts/gen-as-const.awk $(..)Makerules \
 			    %.sym $(common-objpfx)%.h
@@ -798,11 +798,22 @@ endif
 # The makefile may define $(modules-names) to build additional modules.
 # These are built with $(build-module), except any in $(modules-names-nobuild).
 ifdef modules-names
-# extra-lib.mk is included once for each extra lib to define rules
-# to build it, and to add its objects to the various variables.
-# During its evaluation, $(lib) is set to the name of the library.
-extra-modules-left := $(modules-names)
-include $(patsubst %,$(..)extra-modules.mk,$(modules-names))
+# Some "additional modules" are properly part of the testsuite, and
+# should be compiled with -DMODULE_NAME=testsuite instead of
+# -DMODULE_NAME=extramodules.
+cpp-srcs-left := $(filter-out test-% tst-%,$(modules-names))
+dummy := $(file > /dev/stderr, $(subdir) modules-names-normal = $(cpp-srcs-left))
+ifneq (,$(cpp-srcs-left))
+lib := extramodules
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+endif
+
+cpp-srcs-left := $(filter test-% test-%,$(modules-names))
+dummy := $(file > /dev/stderr, $(subdir) modules-names-tests = $(cpp-srcs-left))
+ifneq (,$(cpp-srcs-left))
+lib := testsuite
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+endif
 
 extra-modules-build := $(filter-out $(modules-names-nobuild),$(modules-names))
 $(extra-modules-build:%=$(objpfx)%.so): $(objpfx)%.so: \
@@ -814,7 +825,7 @@ endif
 	     $(patsubst %.o,%.d,$(filter %.o,$(extra-objs:.os=.o))) \
 	     $(patsubst %.oS,%.d,$(filter %.oS,$(extra-objs))) \
 	     $(patsubst %.o,%.d,$(filter %.o,$(extra-test-objs:.os=.o))) \
-	     $(addsuffix .d,$(tests) $(xtests) $(test-srcs))
+	     $(addsuffix .d,$(tests) $(tests-internal) $(xtests) $(test-srcs))
 ifeq ($(build-programs),yes)
 +depfiles += $(addsuffix .d,$(others) $(sysdep-others))
 endif
@@ -1326,7 +1337,17 @@ check: tests
 .PHONY: xcheck
 xcheck: xtests
 
-all-nonlib = $(strip $(tests) $(xtests) $(test-srcs) $(test-extras) $(others))
+# The only difference between MODULE_NAME=testsuite and MODULE_NAME=nonlib is
+# that almost all internal declarations from config.h, libc-symbols.h, and
+# include/*.h are not available to 'testsuite' code, but are to 'nonlib' code.
+all-testsuite := $(strip $(tests) $(xtests) $(test-srcs) $(test-extras))
+ifneq (,$(all-testsuite))
+cpp-srcs-left = $(all-testsuite)
+lib := testsuite
+include $(patsubst %,$(..)cppflags-iterator.mk,$(cpp-srcs-left))
+endif
+
+all-nonlib := $(strip $(tests-internal) $(test-internal-extras) $(others))
 ifneq (,$(all-nonlib))
 cpp-srcs-left = $(all-nonlib)
 lib := nonlib
@@ -1540,22 +1561,32 @@ clean: common-clean
 mostlyclean: common-mostlyclean
 
 do-tests-clean:
-	-rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests) $(xtests) \
+	-rm -f $(addprefix $(objpfx),$(addsuffix .out,$(tests)
+						      $(tests-internal) \
+						      $(xtests) \
 						      $(test-srcs)) \
 				     $(addsuffix .test-result,$(tests) \
+							      $(tests-internal) \
 							      $(xtests) \
 							      $(test-srcs)))
 
 # Remove the object files.
 common-mostlyclean:
-	-rm -f $(addprefix $(objpfx),$(tests) $(xtests) $(test-srcs) \
+	-rm -f $(addprefix $(objpfx),$(tests) $(tests-internal) $(xtests) \
+				     $(test-srcs) \
 				     $(others) $(sysdep-others) stubs \
-				     $(addsuffix .o,$(tests) $(xtests) \
-						    $(test-srcs) $(others) \
+				     $(addsuffix .o,$(tests) \
+						    $(tests-internal) \
+						    $(xtests) \
+						    $(test-srcs) \
+						    $(others) \
 						    $(sysdep-others)) \
-				     $(addsuffix .out,$(tests) $(xtests) \
+				     $(addsuffix .out,$(tests) \
+						      $(tests-internal) \
+						      $(xtests) \
 						      $(test-srcs)) \
 				     $(addsuffix .test-result,$(tests) \
+							      $(tests-internal) \
 							      $(xtests) \
 							      $(test-srcs)))
 	-rm -f $(addprefix $(objpfx),$(extra-objs) $(extra-test-objs) \
diff --git a/Rules b/Rules
index 917bc96..168cf50 100644
--- a/Rules
+++ b/Rules
@@ -84,7 +84,7 @@ common-generated += dummy.o dummy.c
 ifneq "$(headers)" ""
 # Special test of all the installed headers in this directory.
 tests-special += $(objpfx)check-installed-headers-c.out
-libof-check-installed-headers-c := nonlib
+libof-check-installed-headers-c := testsuite
 $(objpfx)check-installed-headers-c.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c \
@@ -94,7 +94,7 @@ $(objpfx)check-installed-headers-c.out: \
 
 ifneq "$(CXX)" ""
 tests-special += $(objpfx)check-installed-headers-cxx.out
-libof-check-installed-headers-cxx := nonlib
+libof-check-installed-headers-cxx := testsuite
 $(objpfx)check-installed-headers-cxx.out: \
     $(..)scripts/check-installed-headers.sh $(headers)
 	$(SHELL) $(..)scripts/check-installed-headers.sh c++ \
@@ -129,12 +129,14 @@ endif
 others: $(py-const)
 
 ifeq ($(run-built-tests),no)
-tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported),$(tests)) \
+tests: $(addprefix $(objpfx),$(filter-out $(tests-unsupported), \
+                                          $(tests) $(tests-internal)) \
 			     $(test-srcs)) $(tests-special) \
 			     $(tests-printers-programs)
 xtests: tests $(xtests-special)
 else
-tests: $(tests:%=$(objpfx)%.out) $(tests-special) $(tests-printers-out)
+tests: $(tests:%=$(objpfx)%.out) $(tests-internal:%=$(objpfx)%.out) \
+       $(tests-special) $(tests-printers-out)
 xtests: tests $(xtests:%=$(objpfx)%.out) $(xtests-special)
 endif
 
@@ -143,7 +145,7 @@ xtests-special-notdir = $(patsubst $(objpfx)%, %, $(xtests-special))
 ifeq ($(run-built-tests),no)
 tests-expected =
 else
-tests-expected = $(tests) $(tests-printers)
+tests-expected = $(tests) $(tests-internal) $(tests-printers)
 endif
 tests:
 	$(..)scripts/merge-test-results.sh -s $(objpfx) $(subdir) \
@@ -156,7 +158,7 @@ xtests:
 
 ifeq ($(build-programs),yes)
 binaries-all-notests = $(others) $(sysdep-others)
-binaries-all-tests = $(tests) $(xtests) $(test-srcs)
+binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs)
 binaries-all = $(binaries-all-notests) $(binaries-all-tests)
 binaries-static-notests = $(others-static)
 binaries-static-tests = $(tests-static) $(xtests-static)
@@ -170,7 +172,7 @@ binaries-pie-notests =
 endif
 else
 binaries-all-notests =
-binaries-all-tests = $(tests) $(xtests) $(test-srcs)
+binaries-all-tests = $(tests) $(tests-internal) $(xtests) $(test-srcs)
 binaries-all = $(binaries-all-tests)
 binaries-static-notests =
 binaries-static-tests =
@@ -230,7 +232,7 @@ $(addprefix $(objpfx),$(binaries-static-tests)): %: %.o \
 	$(+link-static-tests)
 endif
 
-ifneq "$(strip $(tests) $(xtests) $(test-srcs))" ""
+ifneq "$(strip $(tests) $(tests-internal) $(xtests) $(test-srcs))" ""
 # These are the implicit rules for making test outputs
 # from the test programs and whatever input files are present.
 
diff --git a/benchtests/strcoll-inputs/filelist#en_US.UTF-8 b/benchtests/strcoll-inputs/filelist#en_US.UTF-8
index b7b3801..eb23b47 100644
--- a/benchtests/strcoll-inputs/filelist#en_US.UTF-8
+++ b/benchtests/strcoll-inputs/filelist#en_US.UTF-8
@@ -9667,7 +9667,6 @@ hr.po
 libc.pot
 ko.po
 ru.po
-extra-modules.mk
 intl
 tst-gettext4-fr.po
 tstcodeset.po
diff --git a/config.h.in b/config.h.in
index 7bfe923..2935123 100644
--- a/config.h.in
+++ b/config.h.in
@@ -1,14 +1,3 @@
-#if !defined IS_IN_build && !defined __ASSEMBLER__ && !defined _ISOMAC \
-    && !defined __OPTIMIZE__
-# error "glibc cannot be compiled without optimization"
-#endif
-
-/* Another evil option when it comes to compiling the C library is
-   --ffast-math since it alters the ABI.  */
-#if defined __FAST_MATH__ && !defined TEST_FAST_MATH
-# error "glibc must not be compiled with -ffast-math"
-#endif
-
 /* Define if building with SELinux support.  Set by --with-selinux.  */
 #undef	HAVE_SELINUX
 
diff --git a/dlfcn/Makefile b/dlfcn/Makefile
index 94f511d..ce39fc3 100644
--- a/dlfcn/Makefile
+++ b/dlfcn/Makefile
@@ -34,9 +34,10 @@ libdl-shared-only-routines := dlopenold dlfcn
 endif
 
 ifeq (yes,$(build-shared))
-tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
+tests = glrefmain failtest default errmsg1 tstcxaatexit \
 	bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
 	bug-atexit3 tstatexit bug-dl-leaf tst-rec-dlopen
+tests-internal = tst-dladdr 
 endif
 modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
 		defaultmod2 errmsg1mod modatexit modcxaatexit \
diff --git a/elf/Makefile b/elf/Makefile
index 61abeb5..138185d 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -142,43 +142,49 @@ $(inst_auditdir)/sotruss-lib.so: $(objpfx)sotruss-lib.so $(+force)
 	$(do-install-program)
 endif
 
-tests = tst-tls1 tst-tls2 tst-tls9 tst-leaks1 \
-	tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
-	tst-auxv
-tests-static = tst-tls1-static tst-tls2-static tst-stackguard1-static \
+tests-static-normal := tst-tls1-static tst-tls2-static \
 	       tst-leaks1-static tst-array1-static tst-array5-static \
-	       tst-ptrguard1-static tst-dl-iter-static \
+	       tst-dl-iter-static \
 	       tst-tlsalign-static tst-tlsalign-extern-static \
 	       tst-linkall-static tst-env-setuid tst-env-setuid-tunables
+tests-static-internal := tst-ptrguard1-static tst-stackguard1-static
+
+tests := tst-tls1 tst-tls2 tst-tls9 tst-leaks1 \
+	tst-array1 tst-array2 tst-array3 tst-array4 tst-array5 \
+	tst-auxv
+tests-internal := $(tests-static-internal)
+tests-static := $(tests-static-normal) $(tests-static-internal)
+
 ifeq (yes,$(build-shared))
 tests-static += tst-tls9-static
 tst-tls9-static-ENV = \
        LD_LIBRARY_PATH=$(objpfx):$(common-objpfx):$(common-objpfx)dlfcn
-endif
-tests += $(tests-static)
-ifeq (yes,$(build-shared))
-tests += loadtest restest1 preloadtest loadfail multiload origtest resolvfail \
-	 constload1 order noload filter unload \
+
+tests += restest1 preloadtest loadfail multiload origtest resolvfail \
+	 constload1 order noload filter \
 	 reldep reldep2 reldep3 reldep4 nodelete nodelete2 \
-	 nodlopen nodlopen2 neededtest neededtest2 \
-	 neededtest3 neededtest4 unload2 lateglobal initfirst global \
+	 nodlopen nodlopen2 lateglobal initfirst global \
 	 restest2 next dblload dblunload reldep5 reldep6 reldep7 reldep8 \
-	 circleload1 tst-tls3 tst-tls4 tst-tls5 tst-tls6 tst-tls7 tst-tls8 \
+	 tst-tls3 tst-tls4 tst-tls5 \
 	 tst-tls10 tst-tls11 tst-tls12 tst-tls13 tst-tls14 tst-tls15 \
 	 tst-tls16 tst-tls17 tst-tls18 tst-tls19 tst-tls-dlinfo \
 	 tst-align tst-align2 $(tests-execstack-$(have-z-execstack)) \
 	 tst-dlmodcount tst-dlopenrpath tst-deep1 \
-	 tst-dlmopen1 tst-dlmopen2 tst-dlmopen3 \
+	 tst-dlmopen1 tst-dlmopen3 \
 	 unload3 unload4 unload5 unload6 unload7 unload8 tst-global1 order2 \
 	 tst-audit1 tst-audit2 tst-audit8 tst-audit9 \
-	 tst-stackguard1 tst-addr1 tst-thrlock \
+	 tst-addr1 tst-thrlock \
 	 tst-unique1 tst-unique2 $(if $(CXX),tst-unique3 tst-unique4 \
 	 tst-nodelete) \
 	 tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
-	 tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
+	 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
 	 tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error tst-noload \
 	 tst-latepthread tst-tls-manydynamic tst-nodelete-dlclose
 #	 reldep9
+tests-internal += loadtest unload unload2 circleload1 \
+	 neededtest neededtest2 neededtest3 neededtest4 \
+	 tst-tls6 tst-tls7 tst-tls8 tst-dlmopen2 \
+	 tst-ptrguard1 tst-stackguard1
 ifeq ($(build-hardcoded-path-in-tests),yes)
 tests += tst-dlopen-aout
 LDFLAGS-tst-dlopen-aout = $(no-pie-ldflag)
@@ -295,15 +301,19 @@ test-extras += $(modules-names)
 # filtmod1.so has a special rule
 modules-names-nobuild := filtmod1
 
+tests += $(tests-static)
+
 ifneq (no,$(multi-arch))
-tests-static += ifuncmain1static ifuncmain1picstatic \
+tests-ifuncstatic := ifuncmain1static ifuncmain1picstatic \
 		ifuncmain2static ifuncmain2picstatic \
 		ifuncmain4static ifuncmain4picstatic \
 		ifuncmain5static ifuncmain5picstatic \
 		ifuncmain7static ifuncmain7picstatic
-
+tests-static += $(tests-ifuncstatic)
+tests-internal += $(tests-ifuncstatic)
 ifeq (yes,$(build-shared))
-tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
+tests-internal += \
+	 ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
 	 ifuncmain1staticpic \
 	 ifuncmain2 ifuncmain2pic ifuncmain3 ifuncmain4 \
 	 ifuncmain5 ifuncmain5pic ifuncmain5staticpic \
@@ -311,11 +321,11 @@ tests += ifuncmain1 ifuncmain1pic ifuncmain1vis ifuncmain1vispic \
 ifunc-test-modules = ifuncdep1 ifuncdep1pic ifuncdep2 ifuncdep2pic \
 		     ifuncdep5 ifuncdep5pic
 extra-test-objs += $(ifunc-test-modules:=.o)
-test-extras += $(ifunc-test-modules)
+test-internal-extras += $(ifunc-test-modules)
 ifeq (yes,$(have-fpie))
 ifunc-pie-tests = ifuncmain1pie ifuncmain1vispie ifuncmain1staticpie \
 		  ifuncmain5pie ifuncmain6pie ifuncmain7pie
-tests += $(ifunc-pie-tests)
+tests-internal += $(ifunc-pie-tests)
 tests-pie += $(ifunc-pie-tests)
 endif
 modules-names += ifuncmod1 ifuncmod3 ifuncmod5 ifuncmod6
@@ -357,7 +367,7 @@ endif
 # unit test driver must be able to link with the shared object
 # that is going to eventually go into an installed DSO.
 ifeq (yesyes,$(have-fpie)$(build-shared))
-tests += tst-_dl_addr_inside_object
+tests-internal += tst-_dl_addr_inside_object
 tests-pie += tst-_dl_addr_inside_object
 $(objpfx)tst-_dl_addr_inside_object: $(objpfx)dl-addr-obj.os
 CFLAGS-tst-_dl_addr_inside_object.c += $(PIE-ccflag)
diff --git a/extra-modules.mk b/extra-modules.mk
deleted file mode 100644
index 5f8e693..0000000
--- a/extra-modules.mk
+++ /dev/null
@@ -1,9 +0,0 @@
-# This file is included several times in a row, once
-# for each element of $(modules-names).  $(extra-modules-left)
-# is initialized first to $(modules-names) so that with each
-# inclusion, we advance $(module) to the next name.
-
-module := $(firstword $(extra-modules-left))
-extra-modules-left := $(filter-out $(module),$(extra-modules-left))
-
-libof-$(notdir $(module)) := extramodules
diff --git a/include/errno.h b/include/errno.h
index 7df41df..73fc32e 100644
--- a/include/errno.h
+++ b/include/errno.h
@@ -2,7 +2,7 @@
 
 #include <stdlib/errno.h>
 
-#if defined _ERRNO_H && !defined _ISOMAC && !defined __cplusplus
+#if defined _ERRNO_H && !defined _ISOMAC
 
 # if IS_IN (rtld)
 #  include <dl-sysdep.h>
diff --git a/include/libc-diag.h b/include/libc-diag.h
new file mode 100644
index 0000000..a6a413c
--- /dev/null
+++ b/include/libc-diag.h
@@ -0,0 +1,57 @@
+/* Macros for controlling diagnostic output from the compiler.  */
+#ifndef _LIBC_DIAG_H
+#define _LIBC_DIAG_H 1
+
+/* Ignore the value of an expression when a cast to void does not
+   suffice (in particular, for a call to a function declared with
+   attribute warn_unused_result).  */
+#define ignore_value(x) \
+  ({ __typeof__ (x) __ignored_value = (x); (void) __ignored_value; })
+
+/* The macros to control diagnostics are structured like this, rather
+   than a single macro that both pushes and pops diagnostic state and
+   takes the affected code as an argument, because the GCC pragmas
+   work by disabling the diagnostic for a range of source locations
+   and do not work when all the pragmas and the affected code are in a
+   single macro expansion.  */
+
+/* Push diagnostic state.  */
+#define DIAG_PUSH_NEEDS_COMMENT _Pragma ("GCC diagnostic push")
+
+/* Pop diagnostic state.  */
+#define DIAG_POP_NEEDS_COMMENT _Pragma ("GCC diagnostic pop")
+
+#define _DIAG_STR1(s) #s
+#define _DIAG_STR(s) _DIAG_STR1(s)
+
+/* Ignore the diagnostic OPTION.  VERSION is the most recent GCC
+   version for which the diagnostic has been confirmed to appear in
+   the absence of the pragma (in the form MAJOR.MINOR for GCC 4.x,
+   just MAJOR for GCC 5 and later).  Uses of this pragma should be
+   reviewed when the GCC version given is no longer supported for
+   building glibc; the version number should always be on the same
+   source line as the macro name, so such uses can be found with grep.
+   Uses should come with a comment giving more details of the
+   diagnostic, and an architecture on which it is seen if possibly
+   optimization-related and not in architecture-specific code.  This
+   macro should only be used if the diagnostic seems hard to fix (for
+   example, optimization-related false positives).  */
+#define DIAG_IGNORE_NEEDS_COMMENT(version, option)     \
+  _Pragma (_DIAG_STR (GCC diagnostic ignored option))
+
+/* Similar to DIAG_IGNORE_NEEDS_COMMENT the following macro ignores the
+   diagnostic OPTION but only if optimizations for size are enabled.
+   This is required because different warnings may be generated for
+   different optimization levels.  For example a key piece of code may
+   only generate a warning when compiled at -Os, but at -O2 you could
+   still want the warning to be enabled to catch errors.  In this case
+   you would use DIAG_IGNORE_Os_NEEDS_COMMENT to disable the warning
+   only for -Os.  */
+#ifdef __OPTIMIZE_SIZE__
+# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option) \
+  _Pragma (_DIAG_STR (GCC diagnostic ignored option))
+#else
+# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
+#endif
+
+#endif /* libc-diag.h */
diff --git a/include/libc-internal.h b/include/libc-internal.h
index e4395dd..a38a35d 100644
--- a/include/libc-internal.h
+++ b/include/libc-internal.h
@@ -74,56 +74,6 @@ extern __typeof (__profile_frequency) __profile_frequency attribute_hidden;
 #define PTR_ALIGN_UP(base, size) \
   ((__typeof__ (base)) ALIGN_UP ((uintptr_t) (base), (size)))
 
-/* Ignore the value of an expression when a cast to void does not
-   suffice (in particular, for a call to a function declared with
-   attribute warn_unused_result).  */
-#define ignore_value(x) \
-  ({ __typeof__ (x) __ignored_value = (x); (void) __ignored_value; })
-
-/* The macros to control diagnostics are structured like this, rather
-   than a single macro that both pushes and pops diagnostic state and
-   takes the affected code as an argument, because the GCC pragmas
-   work by disabling the diagnostic for a range of source locations
-   and do not work when all the pragmas and the affected code are in a
-   single macro expansion.  */
-
-/* Push diagnostic state.  */
-#define DIAG_PUSH_NEEDS_COMMENT _Pragma ("GCC diagnostic push")
-
-/* Pop diagnostic state.  */
-#define DIAG_POP_NEEDS_COMMENT _Pragma ("GCC diagnostic pop")
-
-#define _DIAG_STR1(s) #s
-#define _DIAG_STR(s) _DIAG_STR1(s)
-
-/* Ignore the diagnostic OPTION.  VERSION is the most recent GCC
-   version for which the diagnostic has been confirmed to appear in
-   the absence of the pragma (in the form MAJOR.MINOR for GCC 4.x,
-   just MAJOR for GCC 5 and later).  Uses of this pragma should be
-   reviewed when the GCC version given is no longer supported for
-   building glibc; the version number should always be on the same
-   source line as the macro name, so such uses can be found with grep.
-   Uses should come with a comment giving more details of the
-   diagnostic, and an architecture on which it is seen if possibly
-   optimization-related and not in architecture-specific code.  This
-   macro should only be used if the diagnostic seems hard to fix (for
-   example, optimization-related false positives).  */
-#define DIAG_IGNORE_NEEDS_COMMENT(version, option)	\
-  _Pragma (_DIAG_STR (GCC diagnostic ignored option))
-
-/* Similar to DIAG_IGNORE_NEEDS_COMMENT the following macro ignores the
-   diagnostic OPTION but only if optimizations for size are enabled.
-   This is required because different warnings may be generated for
-   different optimization levels.  For example a key piece of code may
-   only generate a warning when compiled at -Os, but at -O2 you could
-   still want the warning to be enabled to catch errors.  In this case
-   you would use DIAG_IGNORE_Os_NEEDS_COMMENT to disable the warning
-   only for -Os.  */
-#ifdef __OPTIMIZE_SIZE__
-# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)	\
-  _Pragma (_DIAG_STR (GCC diagnostic ignored option))
-#else
-# define DIAG_IGNORE_Os_NEEDS_COMMENT(version, option)
-#endif
+#include <libc-diag.h>
 
 #endif /* _LIBC_INTERNAL  */
diff --git a/include/libc-symbols.h b/include/libc-symbols.h
index 775d8af..fbb52ab 100644
--- a/include/libc-symbols.h
+++ b/include/libc-symbols.h
@@ -20,26 +20,33 @@
 #ifndef _LIBC_SYMBOLS_H
 #define _LIBC_SYMBOLS_H	1
 
-#define IN_MODULE PASTE_NAME (MODULE_, MODULE_NAME)
-#define IS_IN(lib) (IN_MODULE == MODULE_##lib)
+/* This file is included implicitly in the compilation of every source file,
+   using -include.  It includes config.h.  */
 
-/* Returns true if the current module is a versioned library.  Versioned
-   library names culled from shlib-versions files are assigned a MODULE_*
-   value lower than MODULE_LIBS_BEGIN.  */
-#define IS_IN_LIB (IN_MODULE > MODULE_LIBS_BEGIN)
-
-#define PASTE_NAME(a,b)      PASTE_NAME1 (a,b)
-#define PASTE_NAME1(a,b)     a##b
-
-/* This file's macros are included implicitly in the compilation of every
-   file in the C library by -imacros.
-
-   We include config.h which is generated by configure.
-   It should define for us the following symbol:
-
-   * HAVE_ASM_SET_DIRECTIVE if we have `.set B, A' instead of `A = B'.
+/* Enable declarations of GNU extensions, since we are compiling them.  */
+#define _GNU_SOURCE 1
+
+/* Use `#if IS_IN (module)` to detect what component is being compiled.  */
+#define PASTE_NAME1(a,b) a##b
+#define PASTE_NAME(a,b)	 PASTE_NAME1 (a,b)
+#define IN_MODULE	 PASTE_NAME (MODULE_, MODULE_NAME)
+#define IS_IN(lib)	 (IN_MODULE == MODULE_##lib)
+
+/* True if the current module is a versioned library.  Versioned
+   library names culled from shlib-versions files are assigned a
+   MODULE_* value greater than MODULE_LIBS_BEGIN.  */
+#define IS_IN_LIB	 (IN_MODULE > MODULE_LIBS_BEGIN)
+
+/* The testsuite, and some other ancillary code, should be compiled against
+   as close an approximation to the installed headers as possible.
+   Defining this symbol disables most internal-use-only declarations
+   provided by this header, and all those provided by other internal
+   wrapper headers.  */
+#if IS_IN (testsuite) || defined IS_IN_build || defined __cplusplus
+# define _ISOMAC 1
+#endif
 
-   */
+#ifndef _ISOMAC
 
 /* This is defined for the compilation of all C library code.  features.h
    tests this to avoid inclusion of stubs.h while compiling the library,
@@ -50,8 +57,17 @@
    itself is being compiled, or just some generator program.  */
 #define _LIBC	1
 
-/* Enable declarations of GNU extensions, since we are compiling them.  */
-#define _GNU_SOURCE	1
+/* Some files must be compiled with optimization on.  */
+#if !defined __ASSEMBLER__ && !defined __OPTIMIZE__
+# error "glibc cannot be compiled without optimization"
+#endif
+
+/* -ffast-math cannot be applied to the C library, as it alters the ABI.
+   Some test components that use -ffast-math are currently not part of
+   IS_IN (testsuite) for technical reasons, so we have a secondary override.  */
+#if defined __FAST_MATH__ && !defined TEST_FAST_MATH
+# error "glibc must not be compiled with -ffast-math"
+#endif
 
 #include <config.h>
 
@@ -887,4 +903,5 @@ for linking")
 # define inhibit_loop_to_libcall
 #endif
 
+#endif /* !_ISOMAC */
 #endif /* libc-symbols.h */
diff --git a/include/stdio.h b/include/stdio.h
index 17b5a05..6c84dff 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -1,11 +1,13 @@
 #ifndef _STDIO_H
-# if defined __need_FILE || defined __need___FILE || defined _ISOMAC
+# if defined _ISOMAC
+#  undef _IO_MTSAFE_IO
+#  include <libio/stdio.h>
+# elif defined __need_FILE || defined __need___FILE
 #  include <libio/stdio.h>
 # else
 #  include <libio/stdio.h>
 
 /* Now define the internal interfaces.  */
-__BEGIN_DECLS
 
 extern int __fcloseall (void);
 extern int __snprintf (char *__restrict __s, size_t __maxlen,
@@ -30,7 +32,6 @@ extern int __vsscanf (const char *__restrict __s,
 		      _G_va_list __arg)
      __attribute__ ((__format__ (__scanf__, 2, 0)));
 
-#  ifndef __cplusplus
 extern int __sprintf_chk (char *, int, size_t, const char *, ...) __THROW;
 extern int __snprintf_chk (char *, size_t, int, size_t, const char *, ...)
      __THROW;
@@ -52,7 +53,6 @@ extern int __obstack_printf_chk (struct obstack *, int, const char *, ...)
      __THROW;
 extern int __obstack_vprintf_chk (struct obstack *, int, const char *,
 				  _G_va_list) __THROW;
-#  endif
 
 extern int __isoc99_fscanf (FILE *__restrict __stream,
 			    const char *__restrict __format, ...) __wur;
@@ -184,7 +184,5 @@ libc_hidden_proto (__obstack_vprintf_chk)
 extern FILE * __fmemopen (void *buf, size_t len, const char *mode);
 libc_hidden_proto (__fmemopen)
 
-__END_DECLS
 # endif
-
 #endif
diff --git a/include/stdlib.h b/include/stdlib.h
index 352339e..8039876 100644
--- a/include/stdlib.h
+++ b/include/stdlib.h
@@ -13,8 +13,6 @@
 #if !defined __Need_M_And_C && !defined _ISOMAC
 # include <sys/stat.h>
 
-__BEGIN_DECLS
-
 extern __typeof (strtol_l) __strtol_l;
 extern __typeof (strtoul_l) __strtoul_l;
 extern __typeof (strtoll_l) __strtoll_l;
@@ -265,8 +263,6 @@ extern __typeof (unsetenv) unsetenv attribute_hidden;
 extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
 # endif
 
-__END_DECLS
-
 #endif
 
 #undef __Need_M_And_C
diff --git a/include/time.h b/include/time.h
index 684ceb8..8fe1818 100644
--- a/include/time.h
+++ b/include/time.h
@@ -4,8 +4,6 @@
 #ifndef _ISOMAC
 # include <xlocale.h>
 
-__BEGIN_DECLS
-
 extern __typeof (strftime_l) __strftime_l;
 libc_hidden_proto (__strftime_l)
 extern __typeof (strptime_l) __strptime_l;
@@ -112,7 +110,5 @@ extern double __difftime (time_t time1, time_t time0);
    actual clock ID.  */
 #define CLOCK_IDFIELD_SIZE	3
 
-__END_DECLS
-
 #endif
 #endif
diff --git a/include/unistd.h b/include/unistd.h
index 16d68a1..fbcea1b 100644
--- a/include/unistd.h
+++ b/include/unistd.h
@@ -2,7 +2,6 @@
 # include <posix/unistd.h>
 
 # ifndef _ISOMAC
-__BEGIN_DECLS
 
 libc_hidden_proto (_exit, __noreturn__)
 rtld_hidden_proto (_exit, __noreturn__)
@@ -188,7 +187,5 @@ extern int __getlogin_r_loginuid (char *name, size_t namesize)
 extern __typeof (__access) __access_noerrno attribute_hidden;
 #  endif
 
-__END_DECLS
 # endif
-
 #endif
diff --git a/include/wchar.h b/include/wchar.h
index 6272130..e2579a1 100644
--- a/include/wchar.h
+++ b/include/wchar.h
@@ -172,7 +172,6 @@ extern int __vfwprintf (__FILE *__restrict __s,
 			const wchar_t *__restrict __format,
 			__gnuc_va_list __arg)
      /* __attribute__ ((__format__ (__wprintf__, 2, 0))) */;
-#ifndef __cplusplus
 extern int __vfwprintf_chk (FILE *__restrict __s, int __flag,
 			    const wchar_t *__restrict __format,
 			    __gnuc_va_list __arg)
@@ -184,7 +183,6 @@ extern int __vswprintf_chk (wchar_t *__restrict __s, size_t __n,
      /* __attribute__ ((__format__ (__wprintf__, 5, 0))) */;
 libc_hidden_proto (__vfwprintf_chk)
 libc_hidden_proto (__vswprintf_chk)
-#endif
 
 extern int __isoc99_fwscanf (__FILE *__restrict __stream,
 			     const wchar_t *__restrict __format, ...);
diff --git a/inet/Makefile b/inet/Makefile
index 010792a..b333556 100644
--- a/inet/Makefile
+++ b/inet/Makefile
@@ -52,7 +52,9 @@ aux := check_pf check_native ifreq
 tests := htontest test_ifindex tst-ntoa tst-ether_aton tst-network \
 	 tst-gethnm test-ifaddrs bug-if1 test-inet6_opt tst-ether_line \
 	 tst-getni1 tst-getni2 tst-inet6_rth tst-checks tst-checks-posix \
-	 tst-sockaddr tst-inet6_scopeid_pton test-hnto-types
+	 tst-sockaddr test-hnto-types
+
+tests-internal := tst-inet6_scopeid_pton
 
 include ../Rules
 
diff --git a/inet/tst-checks-posix.c b/inet/tst-checks-posix.c
index e46b6a2..cdcb5cb 100644
--- a/inet/tst-checks-posix.c
+++ b/inet/tst-checks-posix.c
@@ -19,6 +19,5 @@
 /* Process tst-checks.c in POSIX mode.  */
 #undef _GNU_SOURCE
 #define _POSIX_C_SOURCE 200112L
-#define _ISOMAC
 
 #include "tst-checks.c"
diff --git a/intl/tst-gettext2.c b/intl/tst-gettext2.c
index bdfe76d..894e09e 100644
--- a/intl/tst-gettext2.c
+++ b/intl/tst-gettext2.c
@@ -24,6 +24,8 @@
 #include <stdlib.h>
 #include <stdio.h>
 
+#define N_(msgid) msgid
+
 struct data_t
 {
   const char *selection;
diff --git a/malloc/Makefile b/malloc/Makefile
index e93b83b..ca83228 100644
--- a/malloc/Makefile
+++ b/malloc/Makefile
@@ -25,9 +25,9 @@ include ../Makeconfig
 dist-headers := malloc.h
 headers := $(dist-headers) obstack.h mcheck.h
 tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \
-	 tst-mallocstate tst-mcheck tst-mallocfork tst-trim1 \
+	 tst-mcheck tst-mallocfork tst-trim1 \
 	 tst-malloc-usable tst-realloc tst-posix_memalign \
-	 tst-pvalloc tst-memalign tst-mallopt tst-scratch_buffer \
+	 tst-pvalloc tst-memalign tst-mallopt \
 	 tst-malloc-backtrace tst-malloc-thread-exit \
 	 tst-malloc-thread-fail tst-malloc-fork-deadlock \
 	 tst-mallocfork2 \
@@ -39,6 +39,8 @@ tests-static := \
 	 tst-interpose-static-thread \
 	 tst-malloc-usable-static \
 
+tests-internal := tst-mallocstate tst-scratch_buffer
+
 ifneq (no,$(have-tunables))
 tests += tst-malloc-usable-tunables
 tests-static += tst-malloc-usable-static-tunables
diff --git a/malloc/tst-malloc.c b/malloc/tst-malloc.c
index 740ac6c..dbc8d4a 100644
--- a/malloc/tst-malloc.c
+++ b/malloc/tst-malloc.c
@@ -19,7 +19,7 @@
 #include <errno.h>
 #include <malloc.h>
 #include <stdio.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 static int errors = 0;
 
diff --git a/malloc/tst-mcheck.c b/malloc/tst-mcheck.c
index 2e3cba9..5a66bab 100644
--- a/malloc/tst-mcheck.c
+++ b/malloc/tst-mcheck.c
@@ -19,7 +19,7 @@
 #include <errno.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 static int errors = 0;
 
diff --git a/malloc/tst-realloc.c b/malloc/tst-realloc.c
index 7f1f228..31a58bd 100644
--- a/malloc/tst-realloc.c
+++ b/malloc/tst-realloc.c
@@ -19,7 +19,7 @@
 #include <malloc.h>
 #include <stdio.h>
 #include <string.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 static int errors = 0;
 
diff --git a/math/test-signgam-finite-c99.c b/math/test-signgam-finite-c99.c
index a67a803..3dacef5 100644
--- a/math/test-signgam-finite-c99.c
+++ b/math/test-signgam-finite-c99.c
@@ -20,7 +20,6 @@
 #undef __LIBC_INTERNAL_MATH_INLINES
 #undef _GNU_SOURCE
 #undef _Mlong_double_
-#define _ISOMAC
 
 #include <math.h>
 #include <stdio.h>
diff --git a/math/test-signgam-main.c b/math/test-signgam-main.c
index 11ebbe3..e3cecf7 100644
--- a/math/test-signgam-main.c
+++ b/math/test-signgam-main.c
@@ -19,7 +19,6 @@
 #undef _LIBC
 #undef __LIBC_INTERNAL_MATH_INLINES
 #undef _GNU_SOURCE
-#define _ISOMAC
 
 #include <math.h>
 #include <stdio.h>
diff --git a/misc/Makefile b/misc/Makefile
index ed988c3..bd88253 100644
--- a/misc/Makefile
+++ b/misc/Makefile
@@ -79,8 +79,9 @@ gpl2lgpl := error.c error.h
 tests := tst-dirname tst-tsearch tst-fdset tst-efgcvt tst-mntent tst-hsearch \
 	 tst-error1 tst-pselect tst-insremque tst-mntent2 bug-hsearch1 \
 	 tst-mntent-blank-corrupt tst-mntent-blank-passno bug18240 \
-	 tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty \
-	 tst-atomic tst-atomic-long
+	 tst-preadvwritev tst-preadvwritev64 tst-makedev tst-empty
+
+tests-internal := tst-atomic tst-atomic-long
 tests-static := tst-empty
 
 ifeq ($(run-built-tests),yes)
diff --git a/misc/tst-error1.c b/misc/tst-error1.c
index a97a22c..9c4a62f 100644
--- a/misc/tst-error1.c
+++ b/misc/tst-error1.c
@@ -3,7 +3,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <wchar.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 static int
 do_test (int argc, char *argv[])
diff --git a/nptl/Makefile b/nptl/Makefile
index 6d48c0c..b02c351 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -220,8 +220,7 @@ LDLIBS-tst-once5 = -lstdc++
 CFLAGS-tst-thread_local1.o = -std=gnu++11
 LDLIBS-tst-thread_local1 = -lstdc++
 
-tests = tst-typesizes \
-	tst-attr1 tst-attr2 tst-attr3 tst-default-attr \
+tests = tst-attr1 tst-attr2 tst-attr3 tst-default-attr \
 	tst-mutex1 tst-mutex2 tst-mutex3 tst-mutex4 tst-mutex5 tst-mutex6 \
 	tst-mutex7 tst-mutex8 tst-mutex9 tst-mutex5a tst-mutex7a \
 	tst-mutexpi1 tst-mutexpi2 tst-mutexpi3 tst-mutexpi4 tst-mutexpi5 \
@@ -241,13 +240,12 @@ tests = tst-typesizes \
 	tst-rwlock4 tst-rwlock5 tst-rwlock6 tst-rwlock7 tst-rwlock8 \
 	tst-rwlock9 tst-rwlock10 tst-rwlock11 tst-rwlock12 tst-rwlock13 \
 	tst-rwlock14 tst-rwlock15 tst-rwlock16 tst-rwlock17 tst-rwlock18 \
-	tst-rwlock19 \
 	tst-once1 tst-once2 tst-once3 tst-once4 tst-once5 \
 	tst-key1 tst-key2 tst-key3 tst-key4 \
 	tst-sem1 tst-sem2 tst-sem3 tst-sem4 tst-sem5 tst-sem6 tst-sem7 \
-	tst-sem8 tst-sem9 tst-sem10 tst-sem11 tst-sem12 tst-sem13 tst-sem14 \
+	tst-sem8 tst-sem9 tst-sem10 tst-sem14 \
 	tst-sem15 tst-sem16 \
-	tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 tst-barrier5 \
+	tst-barrier1 tst-barrier2 tst-barrier3 tst-barrier4 \
 	tst-align tst-align3 \
 	tst-basic1 tst-basic2 tst-basic3 tst-basic4 tst-basic5 tst-basic6 \
 	tst-basic7 \
@@ -272,7 +270,7 @@ tests = tst-typesizes \
 	tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
 	tst-flock1 tst-flock2 \
 	tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
-	tst-signal6 tst-signal7 \
+	tst-signal6 \
 	tst-exec1 tst-exec2 tst-exec3 tst-exec4 tst-exec5 \
 	tst-exit1 tst-exit2 tst-exit3 \
 	tst-stdio1 tst-stdio2 \
@@ -297,6 +295,10 @@ tests = tst-typesizes \
 	tst-bad-schedattr \
 	tst-thread_local1 tst-mutex-errorcheck tst-robust10 \
 	tst-robust-fork tst-create-detached
+
+tests-internal := tst-typesizes tst-rwlock19 tst-sem11 tst-sem12 tst-sem13 \
+		  tst-barrier5 tst-signal7
+
 xtests = tst-setuid1 tst-setuid1-static tst-setuid2 \
 	tst-mutexpp1 tst-mutexpp6 tst-mutexpp10
 test-srcs = tst-oddstacklimit
@@ -354,8 +356,9 @@ tests += tst-cancelx2 tst-cancelx3 tst-cancelx4 tst-cancelx5 \
 	 tst-cleanupx0 tst-cleanupx1 tst-cleanupx2 tst-cleanupx3 tst-cleanupx4 \
 	 tst-oncex3 tst-oncex4
 ifeq ($(build-shared),yes)
-tests += tst-atfork2 tst-tls3 tst-tls3-malloc tst-tls4 tst-tls5 tst-_res1 \
-	 tst-fini1 tst-stackguard1
+tests += tst-atfork2 tst-tls3 tst-tls3-malloc tst-tls4 tst-_res1 \
+	 tst-fini1
+tests-internal += tst-tls5 tst-stackguard1
 tests-nolibpthread += tst-fini1
 ifeq ($(have-z-execstack),yes)
 tests += tst-execstack
@@ -422,9 +425,9 @@ tests-static += tst-locale1 tst-locale2 tst-stackguard1-static \
 		tst-cancel21-static tst-cancel24-static tst-cond8-static \
 		tst-mutex8-static tst-mutexpi8-static tst-sem11-static \
 		tst-sem12-static
-tests += tst-stackguard1-static tst-cancel21-static tst-cancel24-static \
-	 tst-cond8-static tst-mutex8-static tst-mutexpi8-static \
-	 tst-sem11-static tst-sem12-static
+tests += tst-cancel21-static tst-cancel24-static \
+	 tst-cond8-static tst-mutex8-static tst-mutexpi8-static
+tests-internal += tst-sem11-static tst-sem12-static tst-stackguard1-static
 xtests-static += tst-setuid1-static
 
 # These tests are linked with libc before libpthread
@@ -619,8 +622,9 @@ ifeq ($(build-shared),yes)
 $(addprefix $(objpfx), \
   $(filter-out $(tests-static) $(xtests-static) $(tests-reverse) \
     $(tests-nolibpthread), \
-    $(tests) $(xtests) $(test-srcs))): $(objpfx)libpthread.so \
-				       $(objpfx)libpthread_nonshared.a
+    $(tests) $(tests-internal) $(xtests) $(test-srcs))): \
+	$(objpfx)libpthread.so \
+	$(objpfx)libpthread_nonshared.a
 $(objpfx)tst-unload: $(libdl)
 # $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
 # since otherwise libpthread.so comes before libc.so when linking.
diff --git a/nptl/tst-join7mod.c b/nptl/tst-join7mod.c
index 1d9c95d..5a43404 100644
--- a/nptl/tst-join7mod.c
+++ b/nptl/tst-join7mod.c
@@ -18,17 +18,18 @@
    <http://www.gnu.org/licenses/>.  */
 
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <pthread.h>
-#include <atomic.h>
+#include <stdatomic.h>
 
 static pthread_t th;
-static int running = 1;
+static atomic_int running = 1;
 
 static void *
 test_run (void *p)
 {
-  while (atomic_load_relaxed (&running))
+  while (atomic_load_explicit (&running, memory_order_relaxed))
     printf ("Test running\n");
   printf ("Test finished\n");
   return NULL;
@@ -49,7 +50,7 @@ do_init (void)
 static void __attribute__ ((destructor))
 do_end (void)
 {
-  atomic_store_relaxed (&running, 0);
+  atomic_store_explicit (&running, 0, memory_order_relaxed);
   int ret = pthread_join (th, NULL);
 
   if (ret != 0)
diff --git a/nptl/tst-mutex1.c b/nptl/tst-mutex1.c
index 8a4f2e6..b2a4b54 100644
--- a/nptl/tst-mutex1.c
+++ b/nptl/tst-mutex1.c
@@ -20,7 +20,7 @@
 #include <stdio.h>
 #include <errno.h>
 #include <stdbool.h>
-
+#include <libc-diag.h>
 
 #ifndef ATTR
 # define ATTR NULL
@@ -45,11 +45,16 @@ do_test (void)
       return 1;
     }
 
+  /* This deliberately tests supplying a null pointer to a function whose
+     argument is marked __attribute__ ((nonnull)). */
+  DIAG_PUSH_NEEDS_COMMENT;
+  DIAG_IGNORE_NEEDS_COMMENT (5, "-Wnonnull");
   if (!ATTR_NULL && pthread_mutexattr_destroy (ATTR) != 0)
     {
       puts ("mutexattr_destroy failed");
       return 1;
     }
+  DIAG_POP_NEEDS_COMMENT;
 
   if (pthread_mutex_lock (&m) != 0)
     {
diff --git a/nss/Makefile b/nss/Makefile
index de6c47a..6d165f2 100644
--- a/nss/Makefile
+++ b/nss/Makefile
@@ -49,15 +49,15 @@ makedb-modules = xmalloc hash-string
 extra-objs		+= $(makedb-modules:=.o)
 
 tests-static            = tst-field
+tests-internal		= tst-field
 tests			= test-netdb tst-nss-test1 test-digits-dots \
-			  tst-nss-getpwent bug17079 \
-			  $(tests-static)
+			  tst-nss-getpwent bug17079
 xtests			= bug-erange
 
 # If we have a thread library then we can test cancellation against
 # some routines like getpwuid_r.
 ifeq (yes,$(have-thread-library))
-tests += tst-cancel-getpwuid_r
+tests-internal += tst-cancel-getpwuid_r
 endif
 
 # Specify rules for the nss_* modules.  We have some services.
diff --git a/posix/Makefile b/posix/Makefile
index 8f23d64..e07aae5 100644
--- a/posix/Makefile
+++ b/posix/Makefile
@@ -67,24 +67,23 @@ tests		:= tstgetopt testfnm runtests runptests	     \
 		   tst-mmap tst-mmap-offset tst-getaddrinfo tst-truncate \
 		   tst-truncate64 tst-fork tst-fnmatch tst-regexloc tst-dir \
 		   tst-chmod bug-regex1 bug-regex2 bug-regex3 bug-regex4 \
-		   tst-gnuglob tst-regex bug-regex5 bug-regex6 bug-regex7 \
+		   tst-gnuglob tst-regex bug-regex6 bug-regex7 \
 		   bug-regex8 bug-regex9 bug-regex10 bug-regex11 bug-regex12 \
 		   bug-regex13 bug-regex14 bug-regex15 bug-regex16 \
-		   bug-regex17 bug-regex18 bug-regex19 bug-regex20 \
+		   bug-regex17 bug-regex18 bug-regex19 \
 		   bug-regex21 bug-regex22 bug-regex23 bug-regex24 \
 		   bug-regex25 bug-regex26 bug-regex27 bug-regex28 \
 		   bug-regex29 bug-regex30 bug-regex31 bug-regex32 \
-		   bug-regex33 tst-nice tst-nanosleep tst-regex2 \
+		   tst-nice tst-nanosleep tst-regex2 \
 		   transbug tst-rxspencer tst-pcre tst-boost \
 		   bug-ga1 tst-vfork1 tst-vfork2 tst-vfork3 tst-waitid \
 		   tst-getaddrinfo2 bug-glob1 bug-glob2 bug-glob3 tst-sysconf \
 		   tst-execvp1 tst-execvp2 tst-execlp1 tst-execlp2 \
 		   tst-execv1 tst-execv2 tst-execl1 tst-execl2 \
 		   tst-execve1 tst-execve2 tst-execle1 tst-execle2 \
-		   tst-execvp3 tst-execvp4 tst-rfc3484 tst-rfc3484-2 \
+		   tst-execvp3 tst-execvp4 \
 		   tst-execvpe1 tst-execvpe2 tst-execvpe3 tst-execvpe4 \
 		   tst-execvpe5 tst-execvpe6 \
-		   tst-rfc3484-3 \
 		   tst-getaddrinfo3 tst-fnmatch2 tst-cpucount tst-cpuset \
 		   bug-getopt1 bug-getopt2 bug-getopt3 bug-getopt4 \
 		   bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \
@@ -92,6 +91,8 @@ tests		:= tstgetopt testfnm runtests runptests	     \
 		   tst-fnmatch3 bug-regex36 tst-getaddrinfo5 \
 		   tst-posix_spawn-fd \
 		   tst-posix_fadvise tst-posix_fadvise64
+tests-internal	:= bug-regex5 bug-regex20 bug-regex33 \
+		   tst-rfc3484 tst-rfc3484-2 tst-rfc3484-3
 xtests		:= bug-ga2
 ifeq (yes,$(build-shared))
 test-srcs	:= globtest
diff --git a/posix/tst-dir.c b/posix/tst-dir.c
index 1a9c7df..fee79b3 100644
--- a/posix/tst-dir.c
+++ b/posix/tst-dir.c
@@ -26,7 +26,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/stat.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 /* We expect four arguments:
    - source directory name
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
index 15eb233..af174cf 100644
--- a/posix/wordexp-test.c
+++ b/posix/wordexp-test.c
@@ -22,10 +22,14 @@
 #include <unistd.h>
 #include <pwd.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <wordexp.h>
-#include <libc-internal.h>
+
+#define ALIGN_DOWN(base, size)	((base) & -((__typeof__ (base)) (size)))
+#define PTR_ALIGN_DOWN(base, size) \
+  ((__typeof__ (base)) ALIGN_DOWN ((uintptr_t) (base), (size)))
 
 #define IFS " \n\t"
 
diff --git a/rt/tst-mqueue4.c b/rt/tst-mqueue4.c
index 1718f59..8992193 100644
--- a/rt/tst-mqueue4.c
+++ b/rt/tst-mqueue4.c
@@ -23,6 +23,7 @@
 #include <limits.h>
 #include <signal.h>
 #include <stdio.h>
+#include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 #include <sys/time.h>
diff --git a/stdio-common/bug21.c b/stdio-common/bug21.c
index ca27272..7a8c6a3 100644
--- a/stdio-common/bug21.c
+++ b/stdio-common/bug21.c
@@ -1,5 +1,5 @@
 #include <stdio.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 static int
 do_test (void)
diff --git a/stdio-common/scanf14.c b/stdio-common/scanf14.c
index cffccb0..2bcd9c9 100644
--- a/stdio-common/scanf14.c
+++ b/stdio-common/scanf14.c
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <wchar.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 #define FAIL() \
   do {							\
diff --git a/stdio-common/scanf4.c b/stdio-common/scanf4.c
index 9bb14bb..7a2abec 100644
--- a/stdio-common/scanf4.c
+++ b/stdio-common/scanf4.c
@@ -1,6 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 int
 main(int arc, char *argv[])
diff --git a/stdio-common/scanf7.c b/stdio-common/scanf7.c
index 53ddf4c..f568738 100644
--- a/stdio-common/scanf7.c
+++ b/stdio-common/scanf7.c
@@ -1,6 +1,6 @@
 #include <stdio.h>
 #include <stdlib.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 int
 main (int argc, char *argv[])
diff --git a/stdio-common/test-vfprintf.c b/stdio-common/test-vfprintf.c
index f1805d5..f8bb9ce 100644
--- a/stdio-common/test-vfprintf.c
+++ b/stdio-common/test-vfprintf.c
@@ -25,7 +25,7 @@
 #include <string.h>
 #include <unistd.h>
 #include <sys/stat.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 
 const char *locs[] =
diff --git a/stdio-common/tst-printf.c b/stdio-common/tst-printf.c
index 719b3eb..b6d62a5 100644
--- a/stdio-common/tst-printf.c
+++ b/stdio-common/tst-printf.c
@@ -26,7 +26,7 @@
 #endif
 
 #include <float.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 /* This whole file is picayune tests of corner cases of printf format strings.
    The compiler warnings are not useful here.  */
diff --git a/stdio-common/tst-printfsz.c b/stdio-common/tst-printfsz.c
index 8a3385f..47aa853 100644
--- a/stdio-common/tst-printfsz.c
+++ b/stdio-common/tst-printfsz.c
@@ -2,7 +2,7 @@
 #include <printf.h>
 #include <stdio.h>
 #include <string.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 #define V       12345678.12345678
 
diff --git a/stdio-common/tst-sprintf.c b/stdio-common/tst-sprintf.c
index d5284b9..cbd3544 100644
--- a/stdio-common/tst-sprintf.c
+++ b/stdio-common/tst-sprintf.c
@@ -2,7 +2,7 @@
 #include <stdlib.h>
 #include <locale.h>
 #include <string.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 
 static int
diff --git a/stdio-common/tst-unlockedio.c b/stdio-common/tst-unlockedio.c
index 6eec6fd..35652ce 100644
--- a/stdio-common/tst-unlockedio.c
+++ b/stdio-common/tst-unlockedio.c
@@ -20,7 +20,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <string.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 int fd;
 static void do_prepare (void);
diff --git a/stdio-common/tstdiomisc.c b/stdio-common/tstdiomisc.c
index 9c7342d..89009e0 100644
--- a/stdio-common/tstdiomisc.c
+++ b/stdio-common/tstdiomisc.c
@@ -3,7 +3,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <wchar.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 static int
 t1 (void)
diff --git a/stdlib/Makefile b/stdlib/Makefile
index 5751b5d..d4edcf8 100644
--- a/stdlib/Makefile
+++ b/stdlib/Makefile
@@ -68,23 +68,26 @@ test-srcs	:= tst-fmtmsg
 tests		:= tst-strtol tst-strtod testmb testrand testsort testdiv   \
 		   test-canon test-canon2 tst-strtoll tst-environ	    \
 		   tst-xpg-basename tst-random tst-random2 tst-bsearch	    \
-		   tst-limits tst-rand48 bug-strtod tst-setcontext          \
+		   tst-limits tst-rand48 bug-strtod tst-setcontext	    \
 		   tst-setcontext2 test-a64l tst-qsort tst-system testmb2   \
-		   bug-strtod2 tst-atof1 tst-atof2 tst-strtod2 tst-strtod3  \
-		   tst-rand48-2 tst-makecontext tst-strtod4 tst-strtod5     \
+		   bug-strtod2 tst-atof1 tst-atof2 tst-strtod2		    \
+		   tst-rand48-2 tst-makecontext tst-strtod5		    \
 		   tst-qsort2 tst-makecontext2 tst-strtod6 tst-unsetenv1    \
 		   tst-makecontext3 bug-getcontext bug-fmtmsg1		    \
 		   tst-secure-getenv tst-strtod-overflow tst-strtod-round   \
-		   tst-tininess tst-strtod-underflow tst-tls-atexit	    \
-		   tst-setcontext3 tst-tls-atexit-nodelete		    \
+		   tst-tininess tst-strtod-underflow tst-setcontext3	    \
 		   tst-strtol-locale tst-strtod-nan-locale tst-strfmon_l    \
 		   tst-quick_exit tst-thread-quick_exit tst-width	    \
-		   tst-width-stdint tst-strfrom tst-strfrom-locale \
+		   tst-width-stdint tst-strfrom tst-strfrom-locale	    \
 		   tst-getrandom
+tests-internal	:= tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \
+		   tst-tls-atexit tst-tls-atexit-nodelete
+tests-static	:= tst-secure-getenv
+
 ifeq ($(build-hardcoded-path-in-tests),yes)
 tests += tst-empty-env
 endif
-tests-static	:= tst-secure-getenv
+
 ifeq ($(have-cxx-thread_local),yes)
 CFLAGS-tst-quick_exit.o = -std=c++11
 LDLIBS-tst-quick_exit = -lstdc++
diff --git a/stdlib/bug-getcontext.c b/stdlib/bug-getcontext.c
index c407212..163400a 100644
--- a/stdlib/bug-getcontext.c
+++ b/stdlib/bug-getcontext.c
@@ -5,7 +5,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <ucontext.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 static int
 do_test (void)
diff --git a/stdlib/tst-environ.c b/stdlib/tst-environ.c
index 6a29fed..b230164 100644
--- a/stdlib/tst-environ.c
+++ b/stdlib/tst-environ.c
@@ -19,7 +19,7 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-
+#include <libc-diag.h>
 
 #define VAR "FOOBAR"
 
@@ -196,12 +196,17 @@ do_test (void)
       result = 1;
     }
 
+  /* This deliberately tests supplying a null pointer to a function whose
+     argument is marked __attribute__ ((nonnull)). */
+  DIAG_PUSH_NEEDS_COMMENT;
+  DIAG_IGNORE_NEEDS_COMMENT(5, "-Wnonnull");
   errno = 0;
   if (unsetenv (NULL) >= 0 || errno != EINVAL)
     {
       puts ("unsetenv #1 failed");
       result = 1;
     }
+  DIAG_POP_NEEDS_COMMENT;
 
   errno = 0;
   if (unsetenv ("") >= 0 || errno != EINVAL)
diff --git a/stdlib/tst-strtod.c b/stdlib/tst-strtod.c
index ced6d8a..e0f096c 100644
--- a/stdlib/tst-strtod.c
+++ b/stdlib/tst-strtod.c
@@ -79,7 +79,6 @@ static const struct ltest tests[] =
 
 static void expand (char *dst, int c);
 static int long_dbl (void);
-static int locale_test (void);
 
 static int
 do_test (void)
@@ -176,8 +175,6 @@ do_test (void)
 
   status |= long_dbl ();
 
-  status |= locale_test ();
-
   return status ? EXIT_FAILURE : EXIT_SUCCESS;
 }
 
@@ -217,63 +214,6 @@ long_dbl (void)
   return 0;
 }
 
-/* Perform a few tests in a locale with thousands separators.  */
-static int
-locale_test (void)
-{
-  static const struct
-  {
-    const char *loc;
-    const char *str;
-    double exp;
-    ptrdiff_t nread;
-  } tests[] =
-    {
-      { "de_DE.UTF-8", "1,5", 1.5, 3 },
-      { "de_DE.UTF-8", "1.5", 1.0, 1 },
-      { "de_DE.UTF-8", "1.500", 1500.0, 5 },
-      { "de_DE.UTF-8", "36.893.488.147.419.103.232", 0x1.0p65, 26 }
-    };
-#define ntests (sizeof (tests) / sizeof (tests[0]))
-  size_t n;
-  int result = 0;
-
-  puts ("\nLocale tests");
-
-  for (n = 0; n < ntests; ++n)
-    {
-      double d;
-      char *endp;
-
-      if (setlocale (LC_ALL, tests[n].loc) == NULL)
-	{
-	  printf ("cannot set locale %s\n", tests[n].loc);
-	  result = 1;
-	  continue;
-	}
-
-      /* We call __strtod_interal here instead of strtod to tests the
-	 handling of grouping.  */
-      d = __strtod_internal (tests[n].str, &endp, 1);
-      if (d != tests[n].exp)
-	{
-	  printf ("strtod(\"%s\") returns %g and not %g\n",
-		  tests[n].str, d, tests[n].exp);
-	  result = 1;
-	}
-      else if (endp - tests[n].str != tests[n].nread)
-	{
-	  printf ("strtod(\"%s\") read %td bytes and not %td\n",
-		  tests[n].str, endp - tests[n].str, tests[n].nread);
-	  result = 1;
-	}
-    }
-
-  if (result == 0)
-    puts ("all OK");
-
-  return result;
-}
 
 #define TEST_FUNCTION do_test ()
 #include "../test-skeleton.c"
diff --git a/stdlib/tst-strtod1i.c b/stdlib/tst-strtod1i.c
new file mode 100644
index 0000000..5c2ba99
--- /dev/null
+++ b/stdlib/tst-strtod1i.c
@@ -0,0 +1,84 @@
+/* Copyright (C) 1991-2017 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   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/>.  */
+
+#include <ctype.h>
+#include <locale.h>
+#include <stddef.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
+#include <math.h>
+
+/* Perform a few tests in a locale with thousands separators.  */
+static int
+do_test (void)
+{
+  static const struct
+  {
+    const char *loc;
+    const char *str;
+    double exp;
+    ptrdiff_t nread;
+  } tests[] =
+    {
+      { "de_DE.UTF-8", "1,5", 1.5, 3 },
+      { "de_DE.UTF-8", "1.5", 1.0, 1 },
+      { "de_DE.UTF-8", "1.500", 1500.0, 5 },
+      { "de_DE.UTF-8", "36.893.488.147.419.103.232", 0x1.0p65, 26 }
+    };
+#define ntests (sizeof (tests) / sizeof (tests[0]))
+  size_t n;
+  int result = 0;
+
+  puts ("\nLocale tests");
+
+  for (n = 0; n < ntests; ++n)
+    {
+      double d;
+      char *endp;
+
+      if (setlocale (LC_ALL, tests[n].loc) == NULL)
+	{
+	  printf ("cannot set locale %s\n", tests[n].loc);
+	  result = 1;
+	  continue;
+	}
+
+      d = __strtod_internal (tests[n].str, &endp, 1);
+      if (d != tests[n].exp)
+	{
+	  printf ("strtod(\"%s\") returns %g and not %g\n",
+		  tests[n].str, d, tests[n].exp);
+	  result = 1;
+	}
+      else if (endp - tests[n].str != tests[n].nread)
+	{
+	  printf ("strtod(\"%s\") read %td bytes and not %td\n",
+		  tests[n].str, endp - tests[n].str, tests[n].nread);
+	  result = 1;
+	}
+    }
+
+  if (result == 0)
+    puts ("all OK");
+
+  return result ? EXIT_FAILURE : EXIT_SUCCESS;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
diff --git a/stdlib/tst-strtod5.c b/stdlib/tst-strtod5.c
index 337c746..691759e 100644
--- a/stdlib/tst-strtod5.c
+++ b/stdlib/tst-strtod5.c
@@ -9,38 +9,27 @@
 static const struct
 {
   const char *in;
-  int group;
   double expected;
 } tests[] =
   {
-    { "0", 0, 0.0 },
-    { "000", 0, 0.0 },
-    { "-0", 0, -0.0 },
-    { "-000", 0, -0.0 },
-    { "0,", 0, 0.0 },
-    { "-0,", 0, -0.0 },
-    { "0,0", 0, 0.0 },
-    { "-0,0", 0, -0.0 },
-    { "0e-10", 0, 0.0 },
-    { "-0e-10", 0, -0.0 },
-    { "0,e-10", 0, 0.0 },
-    { "-0,e-10", 0, -0.0 },
-    { "0,0e-10", 0, 0.0 },
-    { "-0,0e-10", 0, -0.0 },
-    { "0e-1000000", 0, 0.0 },
-    { "-0e-1000000", 0, -0.0 },
-    { "0,0e-1000000", 0, 0.0 },
-    { "-0,0e-1000000", 0, -0.0 },
-    { "0", 1, 0.0 },
-    { "000", 1, 0.0 },
-    { "-0", 1, -0.0 },
-    { "-000", 1, -0.0 },
-    { "0e-10", 1, 0.0 },
-    { "-0e-10", 1, -0.0 },
-    { "0e-1000000", 1, 0.0 },
-    { "-0e-1000000", 1, -0.0 },
-    { "000"NBSP"000"NBSP"000", 1, 0.0 },
-    { "-000"NBSP"000"NBSP"000", 1, -0.0 }
+    { "0", 0.0 },
+    { "000", 0.0 },
+    { "-0", -0.0 },
+    { "-000", -0.0 },
+    { "0,", 0.0 },
+    { "-0,", -0.0 },
+    { "0,0", 0.0 },
+    { "-0,0", -0.0 },
+    { "0e-10", 0.0 },
+    { "-0e-10", -0.0 },
+    { "0,e-10", 0.0 },
+    { "-0,e-10", -0.0 },
+    { "0,0e-10", 0.0 },
+    { "-0,0e-10", -0.0 },
+    { "0e-1000000", 0.0 },
+    { "-0e-1000000", -0.0 },
+    { "0,0e-1000000", 0.0 },
+    { "-0,0e-1000000", -0.0 },
   };
 #define NTESTS (sizeof (tests) / sizeof (tests[0]))
 
@@ -59,12 +48,7 @@ do_test (void)
   for (int i = 0; i < NTESTS; ++i)
     {
       char *ep;
-      double r;
-
-      if (tests[i].group)
-	r = __strtod_internal (tests[i].in, &ep, 1);
-      else
-	r = strtod (tests[i].in, &ep);
+      double r = strtod (tests[i].in, &ep);
 
       if (*ep != '\0')
 	{
diff --git a/stdlib/tst-strtod5.c b/stdlib/tst-strtod5i.c
similarity index 92%
copy from stdlib/tst-strtod5.c
copy to stdlib/tst-strtod5i.c
index 337c746..92ed983 100644
--- a/stdlib/tst-strtod5.c
+++ b/stdlib/tst-strtod5i.c
@@ -59,12 +59,7 @@ do_test (void)
   for (int i = 0; i < NTESTS; ++i)
     {
       char *ep;
-      double r;
-
-      if (tests[i].group)
-	r = __strtod_internal (tests[i].in, &ep, 1);
-      else
-	r = strtod (tests[i].in, &ep);
+      double r = __strtod_internal (tests[i].in, &ep, tests[i].group);
 
       if (*ep != '\0')
 	{
diff --git a/string/strcasestr.c b/string/strcasestr.c
index a9ff18c..2acf003 100644
--- a/string/strcasestr.c
+++ b/string/strcasestr.c
@@ -25,10 +25,6 @@
  *
  * Stephen R. van den Berg, berg@pool.informatik.rwth-aachen.de	*/
 
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
 /* Specification.  */
 #include <string.h>
 
diff --git a/string/test-string.h b/string/test-string.h
index 2c36b44..9f45898 100644
--- a/string/test-string.h
+++ b/string/test-string.h
@@ -40,6 +40,18 @@ extern impl_t __start_impls[], __stop_impls[];
 
 #undef __USE_STRING_INLINES
 
+/* We are compiled under _ISOMAC, so libc-symbols.h does not do this
+   for us.  */
+#include "config.h"
+#ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
+# define inhibit_loop_to_libcall \
+    __attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
+#else
+# define inhibit_loop_to_libcall
+#endif
+
+
+#include <stdint.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/string/test-strstr.c b/string/test-strstr.c
index c29d374..404c374 100644
--- a/string/test-strstr.c
+++ b/string/test-strstr.c
@@ -23,6 +23,7 @@
 
 
 #define STRSTR simple_strstr
+#define libc_hidden_builtin_def(arg) /* nothing */
 #include "strstr.c"
 
 
diff --git a/string/tester.c b/string/tester.c
index ec35024..4b928b4 100644
--- a/string/tester.c
+++ b/string/tester.c
@@ -32,7 +32,7 @@
 #include <string.h>
 #include <strings.h>
 #include <fcntl.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 
 #define	STREQ(a, b)	(strcmp((a), (b)) == 0)
diff --git a/string/tst-endian.c b/string/tst-endian.c
index 7d39131..d3c7c2c 100644
--- a/string/tst-endian.c
+++ b/string/tst-endian.c
@@ -3,7 +3,7 @@
 #include <inttypes.h>
 #include <stdio.h>
 #include <stdint.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 #if __GNUC_PREREQ (6, 0)
 /* GCC 6.0 warns on big endian systems about:
diff --git a/sysdeps/generic/math_ldbl.h b/sysdeps/generic/math_ldbl.h
index f0b97ef..6b41476 100644
--- a/sysdeps/generic/math_ldbl.h
+++ b/sysdeps/generic/math_ldbl.h
@@ -1,5 +1,6 @@
-#ifndef _MATH_PRIVATE_H_
-#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
-#endif
+#ifndef _MATH_LDBL_H_
+#define _MATH_LDBL_H_ 1
+
+#error "math_ldbl.h must be overridden by all machines with a long double type."
 
-/* This is empty.  Any machine using long double type will override this header.  */
+#endif
diff --git a/sysdeps/ia64/fpu/math_ldbl.h b/sysdeps/ia64/fpu/math_ldbl.h
index 475ca79..7c6a624 100644
--- a/sysdeps/ia64/fpu/math_ldbl.h
+++ b/sysdeps/ia64/fpu/math_ldbl.h
@@ -1,6 +1,7 @@
-#ifndef _MATH_PRIVATE_H_
-#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
-#endif
+#ifndef _MATH_LDBL_H_
+#define _MATH_LDBL_H_ 1
+
+#include <stdint.h>
 
 /* A union which permits us to convert between a long double and
    three 32 bit ints.  */
@@ -15,8 +16,8 @@ typedef union
     unsigned int empty0:32;
     int sign_exponent:16;
     unsigned int empty1:16;
-    u_int32_t msw;
-    u_int32_t lsw;
+    uint32_t msw;
+    uint32_t lsw;
   } parts;
 } ieee_long_double_shape_type;
 
@@ -29,8 +30,8 @@ typedef union
   long double value;
   struct
   {
-    u_int32_t lsw;
-    u_int32_t msw;
+    uint32_t lsw;
+    uint32_t msw;
     int sign_exponent:16;
     unsigned int empty1:16;
     unsigned int empty0:32;
@@ -98,3 +99,5 @@ do {								\
   se_u.parts.sign_exponent = (exp);				\
   (d) = se_u.value;						\
 } while (0)
+
+#endif /* math_ldbl.h */
diff --git a/sysdeps/ieee754/ldbl-128/math_ldbl.h b/sysdeps/ieee754/ldbl-128/math_ldbl.h
index c1980c9..7804c2d 100644
--- a/sysdeps/ieee754/ldbl-128/math_ldbl.h
+++ b/sysdeps/ieee754/ldbl-128/math_ldbl.h
@@ -1,6 +1,7 @@
-#ifndef _MATH_PRIVATE_H_
-#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
-#endif
+#ifndef _MATH_LDBL_H_
+#define _MATH_LDBL_H_ 1
+
+#include <stdint.h>
 
 /* A union which permits us to convert between a long double and
    four 32 bit ints or two 64 bit ints.  */
@@ -12,12 +13,12 @@ typedef union
   long double value;
   struct
   {
-    u_int64_t msw;
-    u_int64_t lsw;
+    uint64_t msw;
+    uint64_t lsw;
   } parts64;
   struct
   {
-    u_int32_t w0, w1, w2, w3;
+    uint32_t w0, w1, w2, w3;
   } parts32;
 } ieee854_long_double_shape_type;
 
@@ -30,12 +31,12 @@ typedef union
   long double value;
   struct
   {
-    u_int64_t lsw;
-    u_int64_t msw;
+    uint64_t lsw;
+    uint64_t msw;
   } parts64;
   struct
   {
-    u_int32_t w3, w2, w1, w0;
+    uint32_t w3, w2, w1, w0;
   } parts32;
 } ieee854_long_double_shape_type;
 
@@ -96,3 +97,5 @@ do {								\
 */
 #define _Float128 long double
 #define L(x) x##L
+
+#endif /* math_ldbl.h */
diff --git a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
index 625ce00..ee39a68 100644
--- a/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
+++ b/sysdeps/ieee754/ldbl-128ibm/math_ldbl.h
@@ -1,6 +1,5 @@
-#ifndef _MATH_PRIVATE_H_
-#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
-#endif
+#ifndef _MATH_LDBL_H_
+#define _MATH_LDBL_H_ 1
 
 #include <ieee754.h>
 #include <stdint.h>
@@ -263,3 +262,5 @@ ldbl_canonicalize_int (double *a, double *aa)
 	}
     }
 }
+
+#endif /* math_ldbl.h */
diff --git a/sysdeps/ieee754/ldbl-96/math_ldbl.h b/sysdeps/ieee754/ldbl-96/math_ldbl.h
index cca3065..e4ed871 100644
--- a/sysdeps/ieee754/ldbl-96/math_ldbl.h
+++ b/sysdeps/ieee754/ldbl-96/math_ldbl.h
@@ -1,6 +1,7 @@
-#ifndef _MATH_PRIVATE_H_
-#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
-#endif
+#ifndef _MATH_LDBL_H_
+#define _MATH_LDBL_H_ 1
+
+#include <stdint.h>
 
 /* A union which permits us to convert between a long double and
    three 32 bit ints.  */
@@ -14,8 +15,8 @@ typedef union
   {
     int sign_exponent:16;
     unsigned int empty:16;
-    u_int32_t msw;
-    u_int32_t lsw;
+    uint32_t msw;
+    uint32_t lsw;
   } parts;
 } ieee_long_double_shape_type;
 
@@ -28,8 +29,8 @@ typedef union
   long double value;
   struct
   {
-    u_int32_t lsw;
-    u_int32_t msw;
+    uint32_t lsw;
+    uint32_t msw;
     int sign_exponent:16;
     unsigned int empty:16;
   } parts;
@@ -96,3 +97,5 @@ do {								\
   se_u.parts.sign_exponent = (exp);				\
   (d) = se_u.value;						\
 } while (0)
+
+#endif /* math_ldbl.h */
diff --git a/sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c b/sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c
index db9db04..3254097 100644
--- a/sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c
+++ b/sysdeps/ieee754/ldbl-96/test-canonical-ldbl-96.c
@@ -18,7 +18,7 @@
 
 #include <float.h>
 #include <math.h>
-#include <math_private.h>
+#include <math_ldbl.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
diff --git a/sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c b/sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c
index eb21956..4e01f15 100644
--- a/sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c
+++ b/sysdeps/ieee754/ldbl-96/test-totalorderl-ldbl-96.c
@@ -18,7 +18,7 @@
 
 #include <float.h>
 #include <math.h>
-#include <math_private.h>
+#include <math_ldbl.h>
 #include <stdbool.h>
 #include <stdint.h>
 #include <stdio.h>
diff --git a/sysdeps/powerpc/fpu/math_ldbl.h b/sysdeps/powerpc/fpu/math_ldbl.h
index 36378c0..597d216 100644
--- a/sysdeps/powerpc/fpu/math_ldbl.h
+++ b/sysdeps/powerpc/fpu/math_ldbl.h
@@ -1,6 +1,5 @@
-#ifndef _MATH_PRIVATE_H_
-#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
-#endif
+#ifndef _MATH_LDBL_H_PPC_
+#define _MATH_LDBL_H_PPC_ 1
 
 /* GCC does not optimize the default ldbl_pack code to not spill register
    in the stack. The following optimization tells gcc that pack/unpack
@@ -34,3 +33,5 @@ ldbl_unpack_ppc (long double l, double *a, double *aa)
 #define ldbl_unpack ldbl_unpack_ppc
 
 #include <sysdeps/ieee754/ldbl-128ibm/math_ldbl.h>
+
+#endif /* math_ldbl.h */
diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile
index b3d6866..fc29c54 100644
--- a/sysdeps/unix/sysv/linux/Makefile
+++ b/sysdeps/unix/sysv/linux/Makefile
@@ -20,7 +20,7 @@ sysdep_routines += clone umount umount2 readahead \
 		   personality
 
 CFLAGS-gethostid.c = -fexceptions
-CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=0x80000000-__getpagesize()"
+CFLAGS-tst-writev.c += "-DARTIFICIAL_LIMIT=(0x80000000-sysconf(_SC_PAGESIZE))"
 
 # Note that bits/mman-linux.h is listed here though the file lives in the
 # top-level bits/ subdirectory instead of here in sysdeps/.../linux/bits/.
diff --git a/sysdeps/unix/sysv/linux/tst-setgetname.c b/sysdeps/unix/sysv/linux/tst-setgetname.c
index 5acd614..b1010f0 100644
--- a/sysdeps/unix/sysv/linux/tst-setgetname.c
+++ b/sysdeps/unix/sysv/linux/tst-setgetname.c
@@ -23,7 +23,6 @@
 #include <unistd.h>
 #include <fcntl.h>
 #include <errno.h>
-#include <kernel-features.h>
 
 /* New name of process.  */
 #define NEW_NAME "setname"
@@ -101,7 +100,6 @@ do_test (int argc, char **argv)
     {
       res = get_self_comm (gettid (), name_check, TASK_COMM_LEN);
 
-#ifndef __ASSUME_PROC_PID_TASK_COMM
       /* On this first test we look for ENOENT to be returned from
          get_self_comm to indicate that the kernel is older than
          2.6.33 and doesn't contain comm within the proc structure.
@@ -111,7 +109,6 @@ do_test (int argc, char **argv)
 	  printf ("SKIP: The kernel does not have /proc/self/task/%%lu/comm.\n");
 	  return 0;
 	}
-#endif
 
       if (res == 0)
        {
diff --git a/sysdeps/x86_64/fpu/math_ldbl.h b/sysdeps/x86_64/fpu/math_ldbl.h
index b9ff8da..cbc47c2 100644
--- a/sysdeps/x86_64/fpu/math_ldbl.h
+++ b/sysdeps/x86_64/fpu/math_ldbl.h
@@ -1,6 +1,7 @@
-#ifndef _MATH_PRIVATE_H_
-#error "Never use <math_ldbl.h> directly; include <math_private.h> instead."
-#endif
+#ifndef _MATH_LDBL_H_
+#define _MATH_LDBL_H_ 1
+
+#include <stdint.h>
 
 /* A union which permits us to convert between a long double and
    three 32 bit ints.  */
@@ -10,8 +11,8 @@ typedef union
   long double value;
   struct
   {
-    u_int32_t lsw;
-    u_int32_t msw;
+    uint32_t lsw;
+    uint32_t msw;
     int sign_exponent:16;
     unsigned int empty1:16;
     unsigned int empty0:32;
@@ -77,3 +78,5 @@ do {								\
   se_u.parts.sign_exponent = (exp);				\
   (d) = se_u.value;						\
 } while (0)
+
+#endif /* math_ldbl.h */
diff --git a/time/tst-strptime2.c b/time/tst-strptime2.c
index 9273568..8019e7f 100644
--- a/time/tst-strptime2.c
+++ b/time/tst-strptime2.c
@@ -4,7 +4,7 @@
 #include <stdbool.h>
 #include <stdio.h>
 #include <time.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 /* Dummy string is used to match strptime's %s specifier.  */
 
diff --git a/wcsmbs/tst-wcstof.c b/wcsmbs/tst-wcstof.c
index 861f659..d3d75f8 100644
--- a/wcsmbs/tst-wcstof.c
+++ b/wcsmbs/tst-wcstof.c
@@ -3,7 +3,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <wctype.h>
-#include <libc-internal.h>
+#include <libc-diag.h>
 
 static int
 do_test (void)

http://sourceware.org/git/gitweb.cgi?p=glibc.git;a=commitdiff;h=dbca7b9dd343945fdabc6c1004b8f06ef3f2d9ae

commit dbca7b9dd343945fdabc6c1004b8f06ef3f2d9ae
Author: Zack Weinberg <zackw@panix.com>
Date:   Mon Nov 21 08:16:27 2016 -0500

    Clean up conditionals for declaration of gets().
    
    gets() has the dubious honor of being the only C89 library feature
    that has been completely removed from the current C and C++ standards.
    glibc follows suit by not declaring it in _GNU_SOURCE mode either, but
    it remains present in older compatibility modes.  Internally, two test
    cases need to see stdio.h make the declaration, but all our internal
    code is of course compiled under _GNU_SOURCE.  This is currently
    kludged by duplicating the gets declaration, fortify wrapper and all,
    in include/stdio.h.  Also, the conditional in the public headers for
    deciding when to declare gets is complicated and repeated in two places.
    
    This patch adds a new macro to features.h that encapsulates the
    complicated rule for when to declare gets.  stdio.h and bits/stdio2.h
    can simply test __GLIBC_USE (DEPRECATED_GETS).  Then, instead of
    having a duplicate gets declaration in include/stdio.h,
    debug/tst-chk1.c and stdio-common/tst-gets.c force that flag on.
    
            * include/features.h (__GLIBC_USE_DEPRECATED_GETS): New macro.
            * libio/stdio.h, libio/bits/stdio2.h: Condition gets on
            __GLIBC_USE (DEPRECATED_GETS).  Update comments to indicate
            gets was removed from C++ in C++14.
            * include/stdio.h: Remove redundant declaration of gets.
            * debug/tst-chk1.c, stdio-common/tst-gets.c: Force gets to
            be declared, since we are testing it.
            * stdio-common/Makefile (tst-gets.c): Compile with
            -Wno-deprecated-declarations.
    	* debug/Makefile (tst-chk1.c, tst-chk2.c, tst-chk3.c, tst-chk4.cc)
    	(tst-chk5.cc, tst-chk6.cc, tst-lfschk1.c, tst-lfschk2.c)
    	(tst-lfschk3.c, tst-lfschk4.cc, tst-lfschk5.cc, tst-lfschk6.cc):
    	Compile with -Wno-deprecated-declarations.

diff --git a/debug/Makefile b/debug/Makefile
index 3d268f0..cd4975c 100644
--- a/debug/Makefile
+++ b/debug/Makefile
@@ -103,21 +103,22 @@ CFLAGS-tst-longjmp_chk3.c = -fexceptions -fasynchronous-unwind-tables
 CPPFLAGS-tst-longjmp_chk3.c = -D_FORTIFY_SOURCE=1
 
 # We know these tests have problems with format strings, this is what
-# we are testing.  Disable that warning.  They also generate warnings
-# from warning attributes, which cannot be disabled via pragmas, so
-# require -Wno-error to be used.
-CFLAGS-tst-chk1.c = -Wno-format -Wno-error
-CFLAGS-tst-chk2.c = -Wno-format -Wno-error
-CFLAGS-tst-chk3.c = -Wno-format -Wno-error
-CFLAGS-tst-chk4.cc = -Wno-format -Wno-error
-CFLAGS-tst-chk5.cc = -Wno-format -Wno-error
-CFLAGS-tst-chk6.cc = -Wno-format -Wno-error
-CFLAGS-tst-lfschk1.c = -Wno-format -Wno-error
-CFLAGS-tst-lfschk2.c = -Wno-format -Wno-error
-CFLAGS-tst-lfschk3.c = -Wno-format -Wno-error
-CFLAGS-tst-lfschk4.cc = -Wno-format -Wno-error
-CFLAGS-tst-lfschk5.cc = -Wno-format -Wno-error
-CFLAGS-tst-lfschk6.cc = -Wno-format -Wno-error
+# we are testing.  Disable that warning.  They are also testing
+# deprecated functions (notably gets) so disable that warning as well.
+# And they also generate warnings from warning attributes, which
+# cannot be disabled via pragmas, so require -Wno-error to be used.
+CFLAGS-tst-chk1.c = -Wno-format -Wno-deprecated-declarations -Wno-error
+CFLAGS-tst-chk2.c = -Wno-format -Wno-deprecated-declarations -Wno-error
+CFLAGS-tst-chk3.c = -Wno-format -Wno-deprecated-declarations -Wno-error
+CFLAGS-tst-chk4.cc = -Wno-format -Wno-deprecated-declarations -Wno-error
+CFLAGS-tst-chk5.cc = -Wno-format -Wno-deprecated-declarations -Wno-error
+CFLAGS-tst-chk6.cc = -Wno-format -Wno-deprecated-declarations -Wno-error
+CFLAGS-tst-lfschk1.c = -Wno-format -Wno-deprecated-declarations -Wno-error
+CFLAGS-tst-lfschk2.c = -Wno-format -Wno-deprecated-declarations -Wno-error
+CFLAGS-tst-lfschk3.c = -Wno-format -Wno-deprecated-declarations -Wno-error
+CFLAGS-tst-lfschk4.cc = -Wno-format -Wno-deprecated-declarations -Wno-error
+CFLAGS-tst-lfschk5.cc = -Wno-format -Wno-deprecated-declarations -Wno-error
+CFLAGS-tst-lfschk6.cc = -Wno-format -Wno-deprecated-declarations -Wno-error
 LDLIBS-tst-chk4 = -lstdc++
 LDLIBS-tst-chk5 = -lstdc++
 LDLIBS-tst-chk6 = -lstdc++
diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c
index 164d0ae..60c8e1e 100644
--- a/debug/tst-chk1.c
+++ b/debug/tst-chk1.c
@@ -16,6 +16,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+/* This file tests gets.  Force it to be declared.  */
+#include <features.h>
+#undef __GLIBC_USE_DEPRECATED_GETS
+#define __GLIBC_USE_DEPRECATED_GETS 1
+
 #include <assert.h>
 #include <fcntl.h>
 #include <locale.h>
diff --git a/include/features.h b/include/features.h
index dc8ae79..7de4089 100644
--- a/include/features.h
+++ b/include/features.h
@@ -136,6 +136,7 @@
 #undef	__USE_GNU
 #undef	__USE_FORTIFY_LEVEL
 #undef	__KERNEL_STRICT_NAMES
+#undef	__GLIBC_USE_DEPRECATED_GETS
 
 /* Suppress kernel-name space pollution unless user expressedly asks
    for it.  */
@@ -383,6 +384,16 @@
 # define __USE_FORTIFY_LEVEL 0
 #endif
 
+/* The function 'gets' existed in C89, but is impossible to use
+   safely.  It has been removed from ISO C11 and ISO C++14.  Note: for
+   compatibility with various implementations of <cstdio>, this test
+   must consider only the value of __cplusplus when compiling C++.  */
+#if defined __cplusplus ? __cplusplus >= 201402L : defined __USE_ISOC11
+# define __GLIBC_USE_DEPRECATED_GETS 0
+#else
+# define __GLIBC_USE_DEPRECATED_GETS 1
+#endif
+
 /* Get definitions of __STDC_* predefined macros, if the compiler has
    not preincluded this header automatically.  */
 #include <stdc-predef.h>
diff --git a/include/stdio.h b/include/stdio.h
index 30e737e..17b5a05 100644
--- a/include/stdio.h
+++ b/include/stdio.h
@@ -181,24 +181,6 @@ libc_hidden_proto (__vasprintf_chk)
 libc_hidden_proto (__vdprintf_chk)
 libc_hidden_proto (__obstack_vprintf_chk)
 
-/* The <stdio.h> header does not include the declaration for gets
-   anymore when compiling with _GNU_SOURCE.  Provide a copy here.  */
-extern char *gets (char *__s);
-#  if __USE_FORTIFY_LEVEL > 0
-extern char *__gets_chk (char *__str, size_t) __wur;
-extern char *__REDIRECT (__gets_warn, (char *__str), gets)
-     __wur __warnattr ("please use fgets or getline instead, gets can't "
-		       "specify buffer size");
-
-__fortify_function __wur char *
-gets (char *__str)
-{
-  if (__bos (__str) != (size_t) -1)
-    return __gets_chk (__str, __bos (__str));
-  return __gets_warn (__str);
-}
-#  endif
-
 extern FILE * __fmemopen (void *buf, size_t len, const char *mode);
 libc_hidden_proto (__fmemopen)
 
diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h
index e31386d..e9f9d69 100644
--- a/libio/bits/stdio2.h
+++ b/libio/bits/stdio2.h
@@ -222,8 +222,7 @@ __NTH (obstack_vprintf (struct obstack *__restrict __obstack,
 
 #endif
 
-#if !defined __USE_ISOC11 \
-    || (defined __cplusplus && __cplusplus <= 201103L && !defined __USE_GNU)
+#if __GLIBC_USE (DEPRECATED_GETS)
 extern char *__gets_chk (char *__str, size_t) __wur;
 extern char *__REDIRECT (__gets_warn, (char *__str), gets)
      __wur __warnattr ("please use fgets or getline instead, gets can't "
diff --git a/libio/stdio.h b/libio/stdio.h
index a589e36..c4f734c 100644
--- a/libio/stdio.h
+++ b/libio/stdio.h
@@ -625,16 +625,13 @@ __BEGIN_NAMESPACE_STD
 extern char *fgets (char *__restrict __s, int __n, FILE *__restrict __stream)
      __wur;
 
-#if !defined __USE_ISOC11 \
-    || (defined __cplusplus && __cplusplus <= 201103L)
+#if __GLIBC_USE (DEPRECATED_GETS)
 /* Get a newline-terminated string from stdin, removing the newline.
-   DO NOT USE THIS FUNCTION!!  There is no limit on how much it will read.
 
-   The function has been officially removed in ISO C11.  This opportunity
-   is used to also remove it from the GNU feature list.  It is now only
-   available when explicitly using an old ISO C, Unix, or POSIX standard.
-   GCC defines _GNU_SOURCE when building C++ code and the function is still
-   in C++11, so it is also available for C++.
+   This function is impossible to use safely.  It has been officially
+   removed from ISO C11 and ISO C++14, and we have also removed it
+   from the _GNU_SOURCE feature list.  It remains available when
+   explicitly using an old ISO C, Unix, or POSIX standard.
 
    This function is a possible cancellation point and therefore not
    marked with __THROW.  */
diff --git a/stdio-common/Makefile b/stdio-common/Makefile
index f693fa0..01a6dd0 100644
--- a/stdio-common/Makefile
+++ b/stdio-common/Makefile
@@ -141,6 +141,9 @@ CFLAGS-scanf15.c = -I../libio -I../stdlib -I../wcsmbs -I../time -I../string \
 CFLAGS-scanf17.c = -I../libio -I../stdlib -I../wcsmbs -I../time -I../string \
 		   -I../wctype
 
+# tst-gets.c tests a deprecated function.
+CFLAGS-tst-gets.c += -Wno-deprecated-declarations
+
 CPPFLAGS += $(libio-mtsafe)
 
 $(objpfx)tst-setvbuf1.out: /dev/null $(objpfx)tst-setvbuf1
diff --git a/stdio-common/tst-gets.c b/stdio-common/tst-gets.c
index 102f235..9340c76 100644
--- a/stdio-common/tst-gets.c
+++ b/stdio-common/tst-gets.c
@@ -17,6 +17,11 @@
    License along with the GNU C Library; if not, see
    <http://www.gnu.org/licenses/>.  */
 
+/* This file tests gets.  Force it to be declared.  */
+#include <features.h>
+#undef __GLIBC_USE_DEPRECATED_GETS
+#define __GLIBC_USE_DEPRECATED_GETS 1
+
 #include <stdio.h>
 #include <string.h>
 

-----------------------------------------------------------------------


hooks/post-receive
-- 
GNU C Library master sources


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]