[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[patches] Commit POSIX_WIDE_CHAR_DEVICE_IO option group



I've committed the below.

The C++ standard library uses some of the wide character I/O
functions, so tests which use C++ can't run if the
POSIX_WIDE_CHAR_DEVICE_IO group is disabled.  I've put those tests in
their own group, reflecting their dependence on C++.

As it stands, this option group is only a 1% savings.  Libio
implements swprintf and swscanf by applying (roughly speaking) wprintf
and wscanf to memory-based streams, which meant that I couldn't
actually include the cores of wprintf and wscanf in this option group.
When I had included them, disabling the group bought a 5% savings in
libc size.  Those will be included in POSIX_C_LANG_WIDE_CHAR, which
will contain essentially all wide character support.

ChangeLog.eglibc:
2007-10-07  Jim Blandy  <jimb@xxxxxxxxxxxxxxxx>

	Implement the OPTION_EGLIBC_CXX_TESTS option group.
	* option-groups.def (OPTION_EGLIBC_CXX_TESTS): New entry.
	* option-groups.defaults (OPTION_EGLIBC_CXX_TESTS):
	Initialize.
	* debug/Makefile (tests): Put tst-chk4, tst-chk5, tst-chk6,
	tst-lfschk4, tst-lfschk5, and tst-lfschk6 in the group.
	* dlfcn/Makefile: Include option-groups.mak.
	(tests): Put bug-atexit3 in the group.
	* nptl/Makefile (tests): Put tst-cancel24 in the group.

	Implement the OPTION_POSIX_WIDE_CHAR_DEVICE_IO option group.
	* option-groups.def (OPTION_POSIX_WIDE_CHAR_DEVICE_IO): New entry.
	* option-groups.defaults (OPTION_POSIX_WIDE_CHAR_DEVICE_IO):
	Initialize.
	* argp/Makefile (CFLAGS-argp-help.c, CFLAGS-argp-fmtstream.c):
	Define OPTION_POSIX_WIDE_CHAR_DEVICE_IO as appropriate.
	* argp/argp-help.c (__argp_failure): Support the wide character
	case only if OPTION_POSIX_WIDE_CHAR_DEVICE_IO is #defined.
	* argp/argp-fmtstream.c (__argp_fmtstream_update): Same.
	* debug/Makefile (routines): Put wprintf_chk, fwprintf_chk,
	vwprintf_chk, vfwprintf_chk, fgetws_chk, and fgetws_u_chk in the
	group.
	* libio/Makefile: Include ../option-groups.mak.
	(routines): Put in the group: fputwc, fputwc_u, getwc, getwc_u,
	getwchar, getwchar_u, iofgetws, iofgetws_u, iofputws, iofputws_u,
	iogetwline, ioungetwc, putwc, putwc_u, putwchar, putwchar_u,
	fwprintf, swprintf, vwprintf, wprintf, wscanf, fwscanf, vwscanf,
	and fwide.
	(tests): Put in the group: bug-ftell, bug-rewind, bug-rewind2,
	bug-ungetwc1, bug-ungetwc2, bug-wfflush, bug-wmemstream1,
	tst-fgetws, tst-fopenloc, tst-fopenloc2, tst-setvbuf1,
	tst-ungetwc1, tst-ungetwc2, tst-widetext, tst_getwc, tst_putwc,
	tst_wprintf, tst_wprintf2, tst_wscanf, and test-freopen.
	* localedata/Makefile (tests): Put tst-wctype in the group.
	* misc/Makefile (CFLAGS-error.c, CFLAGS-err.c): Define
	OPTION_POSIX_WIDE_CHAR_DEVICE_IO as appropriate.
	(tests): Put tst-error1 in the group.
	* misc/err.c (convert_and_print): Define only if
	OPTION_POSIX_WIDE_CHAR_DEVICE_IO is #defined.
	(vwarnx, vwarn): Support the wide character case only if
	OPTION_POSIX_WIDE_CHAR_DEVICE_IO is #defined.
	* misc/error.c (error_tail): Same.
	* posix/Makefile (CFLAGS-bug-regex1.c): Define
	OPTION_POSIX_WIDE_CHAR_DEVICE_IO as appropriate.
	* posix/bug-regex1.c (main): Call fwide only if the group is enabled.
	* stdio-common/Makefile: (routines): Put vfwprintf and vfwscanf in
	the group.
	(tests): Put tst-perror and bug19a in the group.
	(CFLAGS-fxprintf.c, CFLAGS-tst-popen.c): Define
	OPTION_POSIX_WIDE_CHAR_DEVICE_IO as appropriate.
	* stdio-common/fxprintf.c (__fxprintf): Support the wide character
	case only if OPTION_POSIX_WIDE_CHAR_DEVICE_IO is #defined.
	* stdio-common/tst-perror.c (main): Test wide character case only
	if group is enabled.
	* stdio-common/tst-popen.c (main): Check the stream's orientation
	only if the group is enabled.
	* time/Makefile (tests): Put tst_wcsftime in the group.
	* wcsmbs/Makefile (routines): Put isoc99_wscanf, isoc99_vwscanf,
	isoc99_fwscanf, isoc99_vfwscanf, isoc99_swscanf, and
	isoc99_vswscanf in the group.

Index: debug/Makefile
===================================================================
--- debug/Makefile	(revision 3819)
+++ debug/Makefile	(working copy)
@@ -38,8 +38,7 @@
 	    wctomb_chk wcscpy_chk wmemcpy_chk wmemmove_chk wmempcpy_chk \
 	    wcpcpy_chk wcsncpy_chk wcscat_chk wcsncat_chk wmemset_chk \
 	    wcpncpy_chk \
-	    swprintf_chk vswprintf_chk wprintf_chk fwprintf_chk \
-	    vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk \
+	    swprintf_chk vswprintf_chk \
 	    confstr_chk getgroups_chk ttyname_r_chk \
 	    gethostname_chk getdomainname_chk wcrtomb_chk mbsnrtowcs_chk \
 	    wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
@@ -48,6 +47,10 @@
 	    $(static-only-routines)
 routines-$(OPTION_EGLIBC_GETLOGIN) += getlogin_r_chk
 routines-$(OPTION_EGLIBC_BACKTRACE) += backtrace backtracesyms backtracesymsfd 
+routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO)			\
+	 += wprintf_chk fwprintf_chk	\
+	    vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk
+
 static-only-routines := warning-nop stack_chk_fail_local
 
 CFLAGS-backtrace.c = -fno-omit-frame-pointer
@@ -112,9 +115,10 @@
 LDFLAGS-tst-lfschk6 = -lstdc++
 
 tests = tst-chk1 tst-chk2 tst-chk3 \
-	tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk \
-	tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6
+	tst-lfschk1 tst-lfschk2 tst-lfschk3 test-strcpy_chk test-stpcpy_chk
 tests-$(OPTION_EGLIBC_BACKTRACE) += backtrace-tst 
+tests-$(OPTION_EGLIBC_CXX_TESTS) \
+     += tst-chk4 tst-chk5 tst-chk6 tst-lfschk4 tst-lfschk5 tst-lfschk6
 
 extra-libs = libSegFault libpcprofile
 extra-libs-others = $(extra-libs)
Index: wcsmbs/Makefile
===================================================================
--- wcsmbs/Makefile	(revision 3819)
+++ wcsmbs/Makefile	(working copy)
@@ -41,8 +41,9 @@
 	    wcscoll_l wcsxfrm_l \
 	    wcscasecmp wcsncase wcscasecmp_l wcsncase_l \
 	    wcsmbsload mbsrtowcs_l \
-	    isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf \
 	    isoc99_swscanf isoc99_vswscanf
+routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO)				\
+	 += isoc99_wscanf isoc99_vwscanf isoc99_fwscanf isoc99_vfwscanf
 
 tests := tst-wcstof wcsmbs-tst1 tst-wcsnlen \
 	 tst-wcpncpy tst-mbsrtowcs tst-wchar-h wcsatcliff
Index: time/Makefile
===================================================================
--- time/Makefile	(revision 3819)
+++ time/Makefile	(working copy)
@@ -35,12 +35,14 @@
 aux-$(OPTION_EGLIBC_LOCALE_CODE) += alt_digit era lc-time-cleanup
 distribute := datemsk
 
-tests	:= test_time clocktest tst-posixtz tst_wcsftime \
+tests	:= test_time clocktest tst-posixtz \
 	   tst-getdate tst-mktime tst-mktime2 tst-ftime_l tst-strftime \
 	   tst-mktime3 tst-strptime2 bug-asctime bug-asctime_r bug-mktime1 \
 	   tst-strptime3
 tests-$(OPTION_EGLIBC_LOCALE_CODE) \
 	+= tst-strptime
+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
+	+= tst_wcsftime
 
 include ../Rules
 
Index: libio/Makefile
===================================================================
--- libio/Makefile	(revision 3819)
+++ libio/Makefile	(working copy)
@@ -19,6 +19,8 @@
 #
 #	Specific makefile for libio.
 #
+include ../option-groups.mak
+
 subdir	:= libio
 
 headers	:= stdio.h libio.h _G_config.h bits/stdio.h bits/stdio-lock.h \
@@ -31,11 +33,10 @@
 	ioseekoff ioseekpos iosetbuffer iosetvbuf ioungetc		      \
 	iovsprintf iovsscanf						      \
 	iofgetpos64 iofopen64 iofsetpos64				      \
-	fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
-	iofputws iofputws_u iogetwline iowpadn ioungetwc putwc putwc_u	      \
-	putwchar putwchar_u putchar putchar_u fwprintf swprintf vwprintf      \
-	wprintf wscanf fwscanf vwscanf vswprintf iovswscanf swscanf wgenops   \
-	wstrops wfileops iofwide fwide wmemstream			      \
+	iowpadn								      \
+	putchar putchar_u swprintf 					      \
+	vswprintf iovswscanf swscanf wgenops				      \
+	wstrops wfileops iofwide wmemstream				      \
 									      \
 	clearerr feof ferror fileno fputc freopen fseek getc getchar	      \
 	memstream pclose putc putchar rewind setbuf setlinebuf vasprintf      \
@@ -46,21 +47,31 @@
 	__fpurge __fpending __fsetlocking				      \
 									      \
 	libc_fatal fmemopen
+routines-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) +=				      \
+	fputwc fputwc_u getwc getwc_u getwchar getwchar_u iofgetws iofgetws_u \
+	iofputws iofputws_u iogetwline ioungetwc putwc putwc_u		      \
+	putwchar putwchar_u fwprintf vwprintf				      \
+	wprintf wscanf fwscanf vwscanf					      \
+	fwide
 
-tests = tst_swprintf tst_wprintf tst_swscanf tst_wscanf tst_getwc tst_putwc   \
-	tst_wprintf2 tst-widetext test-fmemopen tst-ext tst-ext2 tst-fopenloc \
-	tst-fgetws tst-ungetwc1 tst-ungetwc2 tst-sscanf	      \
-	tst-mmap-setvbuf bug-ungetwc1 bug-ungetwc2 tst-atime tst-eof          \
-	tst-freopen bug-rewind bug-rewind2 bug-ungetc bug-fseek \
-	tst-mmap-eofsync tst-mmap-fflushsync bug-mmap-fflush \
-	tst-mmap2-eofsync tst-mmap-offend bug-fopena+ bug-wfflush \
-	bug-ungetc2 bug-ftell bug-ungetc3 bug-ungetc4 tst-fopenloc2 \
-	tst-memstream1 tst-memstream2 \
-	tst-wmemstream1 tst-wmemstream2 \
-	bug-memstream1 bug-wmemstream1 \
-	tst-setvbuf1
+tests = tst_swprintf tst_swscanf				\
+	test-fmemopen tst-ext tst-ext2				\
+	tst-sscanf						\
+	tst-mmap-setvbuf tst-atime tst-eof			\
+	tst-freopen bug-ungetc bug-fseek			\
+	tst-mmap-eofsync tst-mmap-fflushsync bug-mmap-fflush	\
+	tst-mmap2-eofsync tst-mmap-offend bug-fopena+		\
+	bug-ungetc2 bug-ungetc3 bug-ungetc4			\
+	tst-memstream1 tst-memstream2				\
+	tst-wmemstream1 tst-wmemstream2				\
+	bug-memstream1
 tests-$(OPTION_EGLIBC_LOCALE_CODE) \
      += tst-swscanf
+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO)				  \
+     += bug-ftell bug-rewind bug-rewind2 bug-ungetwc1 bug-ungetwc2	  \
+	bug-wfflush bug-wmemstream1 tst-fgetws tst-fopenloc tst-fopenloc2 \
+	tst-setvbuf1 tst-ungetwc1 tst-ungetwc2 tst-widetext tst_getwc	  \
+	tst_putwc tst_wprintf tst_wprintf2 tst_wscanf
 test-srcs = test-freopen
 
 all: # Make this the default target; it will be defined in Rules.
@@ -174,6 +185,7 @@
 
 include ../Rules
 
+ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
 # eglibc: ifeq (no,$(cross-compiling))
 tests: $(objpfx)test-freopen.out $(objpfx)tst-fopenloc.check
 # eglibc: endif
@@ -186,3 +198,4 @@
 	cmp ../iconvdata/testdata/ISO-8859-1..UTF8 $(objpfx)tst-fopenloc.out \
 	  > $@
 	$(common-objpfx)malloc/mtrace $(objpfx)tst-fopenloc.mtrace >> $@
+endif
Index: localedata/Makefile
===================================================================
--- localedata/Makefile	(revision 3819)
+++ localedata/Makefile	(working copy)
@@ -173,9 +173,12 @@
 ifeq (y,$(OPTION_EGLIBC_LOCALE_CODE))
 tests: $(objpfx)sort-test.out $(objpfx)tst-fmon.out $(objpfx)tst-locale.out \
        $(objpfx)tst-rpmatch.out $(objpfx)tst-trans.out \
-       $(objpfx)tst-mbswcs.out $(objpfx)tst-ctype.out $(objpfx)tst-wctype.out \
+       $(objpfx)tst-mbswcs.out $(objpfx)tst-ctype.out \
        $(objpfx)tst-langinfo.out $(objpfx)tst-numeric.out
+ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
+tests: $(objpfx)tst-wctype.out
 endif
+endif
 
 $(objpfx)sort-test.out: sort-test.sh $(objpfx)collate-test $(objpfx)xfrm-test \
 		       $(test-input-data) $(addprefix $(objpfx),$(CTYPE_FILES))
Index: misc/err.c
===================================================================
--- misc/err.c	(revision 3819)
+++ misc/err.c	(working copy)
@@ -41,6 +41,7 @@
 }
 
 #ifdef USE_IN_LIBIO
+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 static void
 convert_and_print (const char *format, __gnuc_va_list ap)
 {
@@ -86,6 +87,7 @@
   __vfwprintf (stderr, wformat, ap);
 }
 #endif
+#endif
 
 void
 vwarnx (const char *format, __gnuc_va_list ap)
@@ -94,9 +96,13 @@
 #ifdef USE_IN_LIBIO
   if (_IO_fwide (stderr, 0) > 0)
     {
+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
       __fwprintf (stderr, L"%s: ", __progname);
       convert_and_print (format, ap);
       putwc_unlocked (L'\n', stderr);
+#else
+      abort ();
+#endif
     }
   else
 #endif
@@ -119,6 +125,7 @@
 #ifdef USE_IN_LIBIO
   if (_IO_fwide (stderr, 0) > 0)
     {
+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
       __fwprintf (stderr, L"%s: ", __progname);
       if (format)
 	{
@@ -127,6 +134,9 @@
 	}
       __set_errno (error);
       __fwprintf (stderr, L"%m\n");
+#else
+      abort ();
+#endif
     }
   else
 #endif
Index: misc/error.c
===================================================================
--- misc/error.c	(revision 3819)
+++ misc/error.c	(working copy)
@@ -131,6 +131,7 @@
 #if _LIBC
   if (_IO_fwide (stderr, 0) > 0)
     {
+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
 # define ALLOCA_LIMIT 2000
       size_t len = strlen (message) + 1;
       wchar_t *wmessage = NULL;
@@ -192,6 +193,9 @@
 
       if (use_malloc)
 	free (wmessage);
+#else
+      abort ();
+#endif
     }
   else
 #endif
Index: misc/Makefile
===================================================================
--- misc/Makefile	(revision 3819)
+++ misc/Makefile	(working copy)
@@ -86,11 +86,17 @@
 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
+	 tst-pselect tst-insremque tst-mntent2
+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) += tst-error1
 # eglibc: ifeq (no,$(cross-compiling))
+ifeq (y,$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO))
 tests: $(objpfx)tst-error1-mem
+endif
 # eglibc: endif
 
+OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
+	= -DOPTION_POSIX_WIDE_CHAR_DEVICE_IO
+
 CFLAGS-tsearch.c = $(uses-callbacks)
 CFLAGS-lsearch.c = $(uses-callbacks)
 CFLAGS-pselect.c = -fexceptions
@@ -98,13 +104,13 @@
 CFLAGS-writev.c = -fexceptions -fasynchronous-unwind-tables
 CFLAGS-usleep.c = -fexceptions
 CFLAGS-syslog.c = -fexceptions
-CFLAGS-error.c = -fexceptions
+CFLAGS-error.c = -fexceptions $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
 CFLAGS-getpass.c = -fexceptions
 CFLAGS-mkstemp.c = -fexceptions
 CFLAGS-mkstemp64.c = -fexceptions
 CFLAGS-getsysstats.c = -fexceptions
 CFLAGS-getusershell.c = -fexceptions
-CFLAGS-err.c = -fexceptions
+CFLAGS-err.c = -fexceptions $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
 CFLAGS-tst-tsearch.c = $(stack-align-test-flags)
 CFLAGS-mntent_r.c = -D_IO_MTSAFE_IO
 
Index: dlfcn/Makefile
===================================================================
--- dlfcn/Makefile	(revision 3819)
+++ dlfcn/Makefile	(working copy)
@@ -16,6 +16,8 @@
 # Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 # 02111-1307 USA.
 
+include ../option-groups.mak
+
 subdir		:= dlfcn
 headers		:= bits/dlfcn.h dlfcn.h
 extra-libs	:= libdl
@@ -42,7 +44,9 @@
 ifeq (yes,$(build-shared))
 tests = glrefmain failtest tst-dladdr default errmsg1 tstcxaatexit \
 	bug-dlopen1 bug-dlsym1 tst-dlinfo bug-atexit1 bug-atexit2 \
-	bug-atexit3 tstatexit
+	tstatexit
+
+tests-$(OPTION_EGLIBC_CXX_TESTS) += bug-atexit3 
 endif
 modules-names = glreflib1 glreflib2 glreflib3 failtestmod defaultmod1 \
 		defaultmod2 errmsg1mod modatexit modcxaatexit \
Index: argp/argp-help.c
===================================================================
--- argp/argp-help.c	(revision 3819)
+++ argp/argp-help.c	(working copy)
@@ -1876,7 +1876,13 @@
 
 #ifdef USE_IN_LIBIO
 	  if (_IO_fwide (stream, 0) > 0)
-	    putwc_unlocked (L'\n', stream);
+            {
+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+              putwc_unlocked (L'\n', stream);
+#else
+              abort ();
+#endif
+            }
 	  else
 #endif
 	    putc_unlocked ('\n', stream);
Index: argp/argp-fmtstream.c
===================================================================
--- argp/argp-fmtstream.c	(revision 3819)
+++ argp/argp-fmtstream.c	(working copy)
@@ -152,7 +152,13 @@
 		{
 #ifdef USE_IN_LIBIO
 		  if (_IO_fwide (fs->stream, 0) > 0)
-		    putwc_unlocked (L' ', fs->stream);
+                    {
+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+                      putwc_unlocked (L' ', fs->stream);
+#else
+                      abort ();
+#endif
+                    }
 		  else
 #endif
 		    putc_unlocked (' ', fs->stream);
@@ -317,7 +323,13 @@
 	    for (i = 0; i < fs->wmargin; ++i)
 #ifdef USE_IN_LIBIO
 	      if (_IO_fwide (fs->stream, 0) > 0)
-		putwc_unlocked (L' ', fs->stream);
+                {
+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+                  putwc_unlocked (L' ', fs->stream);
+#else
+                  abort ();
+#endif
+                }
 	      else
 #endif
 		putc_unlocked (' ', fs->stream);
Index: argp/Makefile
===================================================================
--- argp/Makefile	(revision 3819)
+++ argp/Makefile	(working copy)
@@ -19,6 +19,8 @@
 #
 #	Makefile for argp.
 #
+include ../option-groups.mak
+
 subdir	:= argp
 
 headers		= argp.h
@@ -28,9 +30,13 @@
 
 tests		= argp-test tst-argp1 bug-argp1 tst-argp2
 
-CFLAGS-argp-help.c = $(uses-callbacks) -fexceptions
+OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
+	= -DOPTION_POSIX_WIDE_CHAR_DEVICE_IO
+
+CFLAGS-argp-help.c = $(uses-callbacks) -fexceptions \
+	             $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
 CFLAGS-argp-parse.c = $(uses-callbacks)
-CFLAGS-argp-fmtstream.c = -fexceptions
+CFLAGS-argp-fmtstream.c = -fexceptions $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
 
 bug-argp1-ARGS = -- --help
 
Index: option-groups.defaults
===================================================================
--- option-groups.defaults	(revision 3819)
+++ option-groups.defaults	(working copy)
@@ -11,6 +11,7 @@
 OPTION_EGLIBC_ADVANCED_INET6 = y
 OPTION_EGLIBC_BACKTRACE = y
 OPTION_EGLIBC_BSD = y
+OPTION_EGLIBC_CXX_TESTS = y
 OPTION_EGLIBC_CATGETS = y
 OPTION_EGLIBC_CHARSETS = y
 OPTION_EGLIBC_DB_ALIASES = y
@@ -30,4 +31,6 @@
 OPTION_EGLIBC_UTMP = y
 OPTION_EGLIBC_UTMPX = y
 OPTION_EGLIBC_WORDEXP = y
+OPTION_POSIX_C_LANG_WIDE_CHAR = y
 OPTION_POSIX_REGEXP = y
+OPTION_POSIX_WIDE_CHAR_DEVICE_IO = y
Index: nptl/Makefile
===================================================================
--- nptl/Makefile	(revision 3819)
+++ nptl/Makefile	(working copy)
@@ -242,7 +242,7 @@
 	tst-cancel6 tst-cancel7 tst-cancel8 tst-cancel9 tst-cancel10 \
 	tst-cancel11 tst-cancel12 tst-cancel13 tst-cancel14 tst-cancel15 \
 	tst-cancel16 tst-cancel17 tst-cancel18 tst-cancel19 tst-cancel20 \
-	tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel24 tst-cancel25 \
+	tst-cancel21 tst-cancel22 tst-cancel23 tst-cancel25 \
 	tst-cleanup0 tst-cleanup1 tst-cleanup2 tst-cleanup3 tst-cleanup4 \
 	tst-flock1 tst-flock2 \
 	tst-signal1 tst-signal2 tst-signal3 tst-signal4 tst-signal5 \
@@ -272,6 +272,9 @@
 # This test uses the 'backtrace' functions.
 tests-$(OPTION_EGLIBC_BACKTRACE) += tst-backtrace1
 
+# This test is written in C++.
+tests-$(OPTION_EGLIBC_CXX_TESTS) += tst-cancel24
+
 # Files which must not be linked with libpthread.
 tests-nolibpthread = tst-unload
 
Index: option-groups.def
===================================================================
--- option-groups.def	(revision 3819)
+++ option-groups.def	(working copy)
@@ -101,6 +101,21 @@
          revoke
          setlogin
 
+config OPTION_EGLIBC_CXX_TESTS
+   bool "Tests that link against the standard C++ library."
+   depends OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+   depends OPTION_EGLIBC_LIBM
+   help
+       This option group does not include any C library functions;
+       instead, it controls which EGLIBC tests an ordinary 'make
+       tests' runs.  With this group disabled, tests that would
+       normally link against the standard C++ library are not
+       run.
+
+       The standard C++ library depends on the math library 'libm' and
+       the wide character I/O functions included in EGLIBC.  If those
+       option groups are disabled, this test must also be disabled.
+
 config OPTION_EGLIBC_CATGETS
    bool "Functions for accessing message catalogs"
    depends OPTION_EGLIBC_LOCALE_CODE
@@ -652,6 +667,32 @@
         <regexp.h> header file, 'compile', 'step', and 'advance', is
         omitted.
 
+config OPTION_POSIX_WIDE_CHAR_DEVICE_IO
+    bool "Input and output functions for wide characters"
+    help
+        This option group includes functions for reading and writing
+        wide characters to and from <stdio.h> streams.
+
+        This option group includes the following functions:
+
+          fgetwc        fwprintf      putwchar      vwscanf
+          fgetws        fwscanf       ungetwc       wprintf
+          fputwc        getwc         vfwprintf     wscanf
+          fputws        getwchar      vfwscanf
+          fwide         putwc         vwprintf
+
+        This option group further includes the following unlocked
+        variants of the above functions:
+
+          fgetwc_unlocked           getwc_unlocked
+          fgetws_unlocked           getwchar_unlocked
+          fputwc_unlocked           putwc_unlocked
+          fputws_unlocked           putwchar_unlocked
+                    
+        Note that the GNU standard C++ library, 'libstdc++.so', uses
+        some of these functions; you will not be able to link or run
+        C++ programs if you disable this option group.
+
 
 # This helps Emacs users browse this file using the page motion commands
 # and commands like 'pages-directory'.
Index: posix/bug-regex1.c
===================================================================
--- posix/bug-regex1.c	(revision 3819)
+++ posix/bug-regex1.c	(working copy)
@@ -17,7 +17,9 @@
   memset (&regex, '\0', sizeof (regex));
 
   setlocale (LC_ALL, "de_DE.ISO-8859-1");
+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
   fwide (stdout, -1);
+#endif
 
   re_set_syntax (RE_SYNTAX_POSIX_EGREP | RE_DEBUG);
 
Index: posix/Makefile
===================================================================
--- posix/Makefile	(revision 3819)
+++ posix/Makefile	(working copy)
@@ -156,6 +156,8 @@
 OPTION_EGLIBC_INET-CFLAGS-$(OPTION_EGLIBC_INET) = -DUSE_NSCD=1
 OPTION_EGLIBC_GETLOGIN-CFLAGS-$(OPTION_EGLIBC_GETLOGIN) \
 	= -DOPTION_EGLIBC_GETLOGIN
+OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
+	= -DOPTION_POSIX_WIDE_CHAR_DEVICE_IO
 
 CFLAGS-regex.c = -Wno-strict-prototypes
 CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions $(OPTION_EGLIBC_INET-CFLAGS-y)
@@ -191,6 +193,7 @@
 CFLAGS-execl.os = -fomit-frame-pointer
 CFLAGS-execvp.os = -fomit-frame-pointer
 CFLAGS-execlp.os = -fomit-frame-pointer
+CFLAGS-bug-regex1.c = $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
 
 tstgetopt-ARGS = -a -b -cfoobar --required foobar --optional=bazbug \
 		--none random --col --color --colour
Index: stdio-common/tst-popen.c
===================================================================
--- stdio-common/tst-popen.c	(revision 3819)
+++ stdio-common/tst-popen.c	(working copy)
@@ -35,12 +35,14 @@
       return 1;
     }
 
+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
   /* POSIX says that pipe streams are byte-oriented.  */
   if (fwide (f, 0) >= 0)
     {
       puts ("popen did not return byte-oriented stream");
       result = 1;
     }
+#endif
 
   if (getline (&line, &len, f) != 5)
     {
Index: stdio-common/Makefile
===================================================================
--- stdio-common/Makefile	(revision 3819)
+++ stdio-common/Makefile	(working copy)
@@ -56,12 +56,14 @@
 	 scanf1 scanf2 scanf3 scanf4 scanf5 scanf7 scanf8 scanf9 scanf10 \
 	 scanf11 scanf12 tst-tmpnam tst-cookie tst-obprintf \
 	 tst-fseek tst-fmemopen tst-gets \
-	 tst-perror tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 \
+	 tst-sprintf tst-rndseek tst-fdopen tst-fphex bug14 \
 	 tst-popen tst-unlockedio tst-fmemopen2 tst-put-error tst-fgets \
 	 tst-fwrite bug16 bug17 tst-swscanf tst-sprintf2 bug18 bug18a \
-	 bug19 bug19a tst-popen2 scanf13 scanf14 scanf15
+	 bug19 tst-popen2 scanf13 scanf14 scanf15
 tests-$(OPTION_EGLIBC_LOCALE_CODE) \
       += tst-sscanf tst-swprintf bug15 test-vfprintf
+tests-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
+      += tst-perror bug19a
 
 test-srcs = tst-unbputc tst-printf
 
@@ -85,6 +87,8 @@
 
 OPTION_EGLIBC_LOCALE_CODE-CFLAGS-$(OPTION_EGLIBC_LOCALE_CODE) \
 	= -DOPTION_EGLIBC_LOCALE_CODE
+OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-$(OPTION_POSIX_WIDE_CHAR_DEVICE_IO) \
+	= -DOPTION_POSIX_WIDE_CHAR_DEVICE_IO
 
 CFLAGS-vfprintf.c = -Wno-uninitialized
 CFLAGS-vfwprintf.c = -Wno-uninitialized
@@ -95,6 +99,7 @@
 CFLAGS-tst-printfsz.c = -Wno-format
 CFLAGS-printf_fp.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
 CFLAGS-printf_fphex.c = $(OPTION_EGLIBC_LOCALE_CODE-CFLAGS-y)
+CFLAGS-fxprintf.c = $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
 
 CFLAGS-tmpfile.c = -fexceptions
 CFLAGS-tmpfile64.c = -fexceptions
@@ -117,6 +122,7 @@
 CFLAGS-isoc99_scanf.c += $(exceptions)
 CFLAGS-errlist.c = $(fno-unit-at-a-time)
 CFLAGS-siglist.c = $(fno-unit-at-a-time)
+CFLAGS-tst-popen.c = $(OPTION_POSIX_WIDE_CHAR_DEVICE_IO-CFLAGS-y)
 
 # The following is a hack since we must compile scanf15.c without any
 # GNU extension.  The latter are needed, though, when internal headers
Index: stdio-common/fxprintf.c
===================================================================
--- stdio-common/fxprintf.c	(revision 3819)
+++ stdio-common/fxprintf.c	(working copy)
@@ -38,6 +38,7 @@
   int res;
   if (_IO_fwide (fp, 0) > 0)
     {
+#ifdef OPTION_POSIX_WIDE_CHAR_DEVICE_IO
       size_t len = strlen (fmt) + 1;
       wchar_t wfmt[len];
       for (size_t i = 0; i < len; ++i)
@@ -46,6 +47,9 @@
 	  wfmt[i] = fmt[i];
 	}
       res = __vfwprintf (fp, wfmt, ap);
+#else
+      abort();
+#endif
     }
   else
     res = INTUSE(_IO_vfprintf) (fp, fmt, ap);