NetBSD Problem Report #29832

From jtc@acorntoolworks.com  Wed Mar 30 04:48:33 2005
Return-Path: <jtc@acorntoolworks.com>
Received: from orac.acorntoolworks.com (adsl-66-123-74-10.dsl.pltn13.pacbell.net [66.123.74.10])
	by narn.netbsd.org (Postfix) with ESMTP id E66F863B11A
	for <gnats-bugs@gnats.NetBSD.org>; Wed, 30 Mar 2005 04:48:31 +0000 (UTC)
Message-Id: <200503300448.j2U4mT2l008719@orac.acorntoolworks.com>
Date: Tue, 29 Mar 2005 20:48:29 -0800 (PST)
From: "J.T. Conklin" <jtc@acorntoolworks.com>
Reply-To: jtc@acorntoolworks.com
To: gnats-bugs@netbsd.org
Subject: libstdc++ missing std::wstring support
X-Send-Pr-Version: 3.95

>Number:         29832
>Category:       lib
>Synopsis:       libstdc++ missing std::wstring support
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    lib-bug-people
>State:          closed
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Wed Mar 30 04:49:00 +0000 2005
>Closed-Date:    Wed Mar 30 19:21:09 +0000 2005
>Last-Modified:  Wed Aug 27 14:40:02 +0000 2008
>Originator:     J.T. Conklin
>Release:        NetBSD 2.0.1
>Organization:
J.T. Conklin
>Environment:


System: NetBSD orac 2.0.1 NetBSD 2.0.1 (ORAC) #2: Sun Mar 13 22:46:10 PST 2005 jtc@orac:/home/jtc/netbsd/NetBSD-2.0/src/sys/arch/i386/compile/ORAC i386
Architecture: i386
Machine: i386
>Description:
libstdc++'s configure script does not enable wide string support
because NetBSD is missing the wide character versions of strftime(),
*printf(), and *scanf().  

I have submitted PR/29826 which contains a wcsftime() implementation.
It turns out that the requirement for *printf() and *scanf() is legacy
cruft left over from when libstdc++ used those functions for formatted
I/O.  It now has it's own code for that.

The enclosed patch changes acinclude.m4 to check only those functions
that libstdc++ currently uses.  Naturally, the configure script would
have to be regenerated in order to take advantage of the change.  I
have included the changed config.h/c++config.h files for the i386 and
that would result from running the updated configure script.  I've
tested the same on a amd64 box, but it's not convenient to generate
diffs for that.  I suspect that similar changes could safely be made
for all platforms, but I only have i386 and amd64 machines handy for
testing.

The patch also adds the appropriate #ifdefs for the missing *printf()
and *scanf() functions that are no longer required to std_cwchar.h.

I inquired about submitting a similar change to the master libstdc++
sources on libstdc++@gcc.gnu.org a few weeks ago, but Benjamin Kosnik
let me know that he'll be refactoring wide character configuration/
requirements there shortly.


>How-To-Repeat:

>Fix:


Index: gnu/dist/gcc/libstdc++-v3/acinclude.m4
===================================================================
RCS file: /cvsroot/src/gnu/dist/gcc/libstdc++-v3/acinclude.m4,v
retrieving revision 1.1.1.2
diff -c -r1.1.1.2 acinclude.m4
*** gnu/dist/gcc/libstdc++-v3/acinclude.m4	18 Oct 2003 11:13:55 -0000	1.1.1.2
--- gnu/dist/gcc/libstdc++-v3/acinclude.m4	29 Mar 2005 19:14:13 -0000
***************
*** 987,999 ****
      ac_wfuncs=no)

      dnl Checks for names injected into std:: by the c_std headers.
!     AC_CHECK_FUNCS(btowc wctob fgetwc fgetws fputwc fputws fwide \
!     fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf vswprintf vswscanf \
!     vwprintf vwscanf wprintf wscanf getwc getwchar mbsinit mbrlen mbrtowc \
!     mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstof wcstol \
      wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
!     wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,, \
!     ac_wfuncs=no)

      AC_MSG_CHECKING([for ISO C99 wchar_t support])
      if test x"$has_weof" = xyes &&
--- 987,1005 ----
      ac_wfuncs=no)

      dnl Checks for names injected into std:: by the c_std headers.
!     AC_CHECK_FUNCS([btowc wctob fgetwc fgetws fputwc fputws fwide \
!     getwc getwchar mbsinit mbrlen mbrtowc \
!     mbsrtowcs wcsrtombs putwc putwchar ungetwc wcrtomb wcstod wcstol \
      wcstoul wcscpy wcsncpy wcscat wcsncat wcscmp wcscoll wcsncmp wcsxfrm \
!     wcscspn wcsspn wcstok wcsftime wcschr wcspbrk wcsrchr wcsstr,
!     [],[ac_wfuncs=no])
! 
!     dnl Checks for wide character functions that are not required
!     dnl for basic wchar_t support.  Don't disable support if they are missing.
!     dnl Injection of these is wrapped with guard macros.
!     AC_CHECK_FUNCS([fwprintf fwscanf swprintf swscanf vfwprintf vfwscanf \
!     vswprintf vswscanf vwprintf vwscanf wcstof wprintf wscanf \
!     iswblank],[],[])

      AC_MSG_CHECKING([for ISO C99 wchar_t support])
      if test x"$has_weof" = xyes &&
Index: gnu/dist/gcc/libstdc++-v3/include/c_std/std_cwchar.h
===================================================================
RCS file: /cvsroot/src/gnu/dist/gcc/libstdc++-v3/include/c_std/std_cwchar.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 std_cwchar.h
*** gnu/dist/gcc/libstdc++-v3/include/c_std/std_cwchar.h	23 Jul 2003 02:42:52 -0000	1.1.1.1
--- gnu/dist/gcc/libstdc++-v3/include/c_std/std_cwchar.h	29 Mar 2005 19:14:13 -0000
***************
*** 78,85 ****
  #undef fputwc
  #undef fputws
  #undef fwide
! #undef fwprintf
! #undef fwscanf
  #undef getwc
  #undef getwchar
  #undef mbrlen
--- 78,89 ----
  #undef fputwc
  #undef fputws
  #undef fwide
! #if _GLIBCXX_HAVE_FWPRINTF
! # undef fwprintf
! #endif
! #if _GLIBCXX_HAVE_FWSCANF
! # undef fwscanf
! #endif
  #undef getwc
  #undef getwchar
  #undef mbrlen
***************
*** 88,102 ****
  #undef mbsrtowcs
  #undef putwc
  #undef putwchar
! #undef swprintf
! #undef swscanf
  #undef ungetwc
! #undef vfwprintf
! #undef vfwscanf
! #undef vswprintf
! #undef vswscanf
! #undef vwprintf
! #undef vwscanf
  #undef wcrtomb
  #undef wcscat
  #undef wcschr
--- 92,122 ----
  #undef mbsrtowcs
  #undef putwc
  #undef putwchar
! #if _GLIBCXX_HAVE_SWPRINTF
! # undef swprintf
! #endif
! #if _GLIBCXX_HAVE_SWSCANF
! # undef swscanf
! #endif
  #undef ungetwc
! #if _GLIBCXX_HAVE_VFWPRINTF
! # undef vfwprintf
! #endif
! #if _GLIBCXX_HAVE_VFWSCANF
! # undef vfwscanf
! #endif
! #if _GLIBCXX_HAVE_VSWPRINTF
! # undef vswprintf
! #endif
! #if _GLIBCXX_HAVE_VSWSCANF
! # undef vswscanf
! #endif
! #if _GLIBCXX_HAVE_VWPRINTF
! # undef vwprintf
! #endif
! #if _GLIBCXX_HAVE_VWSCANF
! # undef vwscanf
! #endif
  #undef wcrtomb
  #undef wcscat
  #undef wcschr
***************
*** 115,121 ****
  #undef wcsspn
  #undef wcsstr
  #undef wcstod
! #undef wcstof
  #undef wcstok
  #undef wcstol
  #undef wcstoul
--- 135,143 ----
  #undef wcsspn
  #undef wcsstr
  #undef wcstod
! #if _GLIBCXX_HAVE_WCSTOF
! # undef wcstof
! #endif
  #undef wcstok
  #undef wcstol
  #undef wcstoul
***************
*** 126,133 ****
  #undef wmemcpy
  #undef wmemmove
  #undef wmemset
! #undef wprintf
! #undef wscanf

  #if _GLIBCPP_USE_WCHAR_T
  namespace std
--- 148,159 ----
  #undef wmemcpy
  #undef wmemmove
  #undef wmemset
! #if _GLIBCXX_HAVE_WPRINTF
! # undef wprintf
! #endif
! #if _GLIBCXX_HAVE_WSCANF
! # undef wscanf
! #endif

  #if _GLIBCPP_USE_WCHAR_T
  namespace std
***************
*** 140,147 ****
--- 166,177 ----
    using ::fputwc;
    using ::fputws;
    using ::fwide;
+ #if _GLIBCXX_HAVE_FWPRINTF
    using ::fwprintf;
+ #endif
+ #if _GLIBCXX_HAVE_FWSCANF
    using ::fwscanf;
+ #endif
    using ::getwc;
    using ::getwchar;
    using ::mbrlen;
***************
*** 150,164 ****
--- 180,210 ----
    using ::mbsrtowcs;
    using ::putwc;
    using ::putwchar;
+ #if _GLIBCXX_HAVE_SWPRINTF
    using ::swprintf;
+ #endif
+ #if _GLIBCXX_HAVE_SWSCANF
    using ::swscanf;
+ #endif
    using ::ungetwc;
+ #if _GLIBCXX_HAVE_VFWPRINTF
    using ::vfwprintf;
+ #endif
+ #if _GLIBCXX_HAVE_VWSCANF
    using ::vfwscanf;
+ #endif
+ #if _GLIBCXX_HAVE_VSWPRINTF
    using ::vswprintf;
+ #endif
+ #if _GLIBCXX_HAVE_VSWSCANF
    using ::vswscanf;
+ #endif
+ #if _GLIBCXX_HAVE_VWPRINTF
    using ::vwprintf;
+ #endif
+ #if _GLIBCXX_HAVE_VWSCANF
    using ::vwscanf;
+ #endif
    using ::wcrtomb;
    using ::wcscat;
    using ::wcscmp;
***************
*** 173,179 ****
--- 219,227 ----
    using ::wcsrtombs;
    using ::wcsspn;
    using ::wcstod;
+ #if _GLIBCXX_HAVE_WCSTOF
    using ::wcstof;
+ #endif
    using ::wcstok;
    using ::wcstol;
    using ::wcstoul;
***************
*** 183,190 ****
--- 231,242 ----
    using ::wmemcpy;
    using ::wmemmove;
    using ::wmemset;
+ #if _GLIBCXX_HAVE_WPRINTF
    using ::wprintf;
+ #endif
+ #if _GLIBCXX_HAVE_WSCANF
    using ::wscanf;
+ #endif

    using ::wcschr;

Index: gnu/lib/libstdc++-v3/arch/i386/c++config.h
===================================================================
RCS file: /cvsroot/src/gnu/lib/libstdc++-v3/arch/i386/c++config.h,v
retrieving revision 1.6
diff -c -r1.6 c++config.h
*** gnu/lib/libstdc++-v3/arch/i386/c++config.h	25 May 2004 13:39:35 -0000	1.6
--- gnu/lib/libstdc++-v3/arch/i386/c++config.h	29 Mar 2005 19:14:20 -0000
***************
*** 117,123 ****
  /* #undef _GLIBCPP_USE_C99 */

  // Define if code specialized for wchar_t should be used.
! /* #undef _GLIBCPP_USE_WCHAR_T */

  // Define if using setrlimit to limit memory usage during 'make check'.
  /* #undef _GLIBCPP_MEM_LIMITS */
--- 117,123 ----
  /* #undef _GLIBCPP_USE_C99 */

  // Define if code specialized for wchar_t should be used.
! #define _GLIBCPP_USE_WCHAR_T 1

  // Define if using setrlimit to limit memory usage during 'make check'.
  /* #undef _GLIBCPP_MEM_LIMITS */
***************
*** 749,755 ****
  #define _GLIBCPP_HAVE_WCSCSPN 1

  /* Define if you have the wcsftime function.  */
! /* #undef _GLIBCPP_HAVE_WCSFTIME */

  /* Define if you have the wcslen function.  */
  #define _GLIBCPP_HAVE_WCSLEN 1
--- 749,755 ----
  #define _GLIBCPP_HAVE_WCSCSPN 1

  /* Define if you have the wcsftime function.  */
! #define _GLIBCPP_HAVE_WCSFTIME 1

  /* Define if you have the wcslen function.  */
  #define _GLIBCPP_HAVE_WCSLEN 1
Index: gnu/lib/libstdc++-v3/arch/i386/config.h
===================================================================
RCS file: /cvsroot/src/gnu/lib/libstdc++-v3/arch/i386/config.h,v
retrieving revision 1.4
diff -c -r1.4 config.h
*** gnu/lib/libstdc++-v3/arch/i386/config.h	19 Feb 2004 08:11:31 -0000	1.4
--- gnu/lib/libstdc++-v3/arch/i386/config.h	29 Mar 2005 19:14:23 -0000
***************
*** 17,23 ****
  /* #undef _GLIBCPP_USE_C99 */

  // Define if code specialized for wchar_t should be used.
! /* #undef _GLIBCPP_USE_WCHAR_T */

  // Define if using setrlimit to limit memory usage during 'make check'.
  /* #undef _GLIBCPP_MEM_LIMITS */
--- 17,23 ----
  /* #undef _GLIBCPP_USE_C99 */

  // Define if code specialized for wchar_t should be used.
! #define _GLIBCPP_USE_WCHAR_T 1

  // Define if using setrlimit to limit memory usage during 'make check'.
  /* #undef _GLIBCPP_MEM_LIMITS */
***************
*** 649,655 ****
  #define HAVE_WCSCSPN 1

  /* Define if you have the wcsftime function.  */
! /* #undef HAVE_WCSFTIME */

  /* Define if you have the wcslen function.  */
  #define HAVE_WCSLEN 1
--- 649,655 ----
  #define HAVE_WCSCSPN 1

  /* Define if you have the wcsftime function.  */
! #define HAVE_WCSFTIME 1

  /* Define if you have the wcslen function.  */
  #define HAVE_WCSLEN 1

>Release-Note:

>Audit-Trail:
From: Christos Zoulas <christos@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/29832 CVS commit: src/gnu
Date: Wed, 30 Mar 2005 19:17:45 +0000 (UTC)

 Module Name:	src
 Committed By:	christos
 Date:		Wed Mar 30 19:17:45 UTC 2005

 Modified Files:
 	src/gnu/dist/gcc/libstdc++-v3: acinclude.m4
 	src/gnu/dist/gcc/libstdc++-v3/include/c_std: std_cwchar.h
 	src/gnu/lib/libstdc++-v3/arch/i386: c++config.h config.h

 Log Message:
 PR/29832: J.T. Conklin: libstdc++ missing std::wstring support
 This wonderful patch together with yesterdays wcsftime addition, makes
 us able to use wide strings in c++


 To generate a diff of this commit:
 cvs rdiff -r1.1.1.2 -r1.2 src/gnu/dist/gcc/libstdc++-v3/acinclude.m4
 cvs rdiff -r1.1.1.1 -r1.2 \
     src/gnu/dist/gcc/libstdc++-v3/include/c_std/std_cwchar.h
 cvs rdiff -r1.6 -r1.7 src/gnu/lib/libstdc++-v3/arch/i386/c++config.h
 cvs rdiff -r1.4 -r1.5 src/gnu/lib/libstdc++-v3/arch/i386/config.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: christos@netbsd.org
State-Changed-When: Wed, 30 Mar 2005 14:21:09 -0500
State-Changed-Why:
fixed, thanks!


From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/29832 CVS commit: [netbsd-3] src/gnu/dist/gcc/libstdc++-v3
Date: Mon,  4 Apr 2005 18:15:17 +0000 (UTC)

 Module Name:	src
 Committed By:	tron
 Date:		Mon Apr  4 18:15:17 UTC 2005

 Modified Files:
 	src/gnu/dist/gcc/libstdc++-v3 [netbsd-3]: acinclude.m4
 	src/gnu/dist/gcc/libstdc++-v3/include/c_std [netbsd-3]: std_cwchar.h

 Log Message:
 Pull up revision 1.2 (requested by christos in ticket #102):
 PR/29832: J.T. Conklin: libstdc++ missing std::wstring support
 This wonderful patch together with yesterdays wcsftime addition, makes
 us able to use wide strings in c++


 To generate a diff of this commit:
 cvs rdiff -r1.1.1.2 -r1.1.1.2.6.1 src/gnu/dist/gcc/libstdc++-v3/acinclude.m4
 cvs rdiff -r1.1.1.1 -r1.1.1.1.6.1 \
     src/gnu/dist/gcc/libstdc++-v3/include/c_std/std_cwchar.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/29832 CVS commit: [netbsd-3] src/gnu/lib/libstdc++-v3/arch/i386
Date: Mon,  4 Apr 2005 18:15:23 +0000 (UTC)

 Module Name:	src
 Committed By:	tron
 Date:		Mon Apr  4 18:15:23 UTC 2005

 Modified Files:
 	src/gnu/lib/libstdc++-v3/arch/i386 [netbsd-3]: config.h

 Log Message:
 Pull up revision 1.5 (requested by christos in ticket #102):
 PR/29832: J.T. Conklin: libstdc++ missing std::wstring support
 This wonderful patch together with yesterdays wcsftime addition, makes
 us able to use wide strings in c++


 To generate a diff of this commit:
 cvs rdiff -r1.4 -r1.4.6.1 src/gnu/lib/libstdc++-v3/arch/i386/config.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Matthias Scheler <tron@netbsd.org>
To: gnats-bugs@netbsd.org
Cc: 
Subject: PR/29832 CVS commit: [netbsd-3] src/gnu/lib/libstdc++-v3/arch/i386
Date: Mon,  4 Apr 2005 18:15:28 +0000 (UTC)

 Module Name:	src
 Committed By:	tron
 Date:		Mon Apr  4 18:15:28 UTC 2005

 Modified Files:
 	src/gnu/lib/libstdc++-v3/arch/i386 [netbsd-3]: c++config.h

 Log Message:
 Pull up revision 1.7 (requested by christos in ticket #102):
 PR/29832: J.T. Conklin: libstdc++ missing std::wstring support
 This wonderful patch together with yesterdays wcsftime addition, makes
 us able to use wide strings in c++


 To generate a diff of this commit:
 cvs rdiff -r1.6 -r1.6.2.1 src/gnu/lib/libstdc++-v3/arch/i386/c++config.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

From: Matthias Drochner <drochner@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/29832 CVS commit: src/gnu/dist/gcc4/libstdc++-v3/include/c_std
Date: Wed, 27 Aug 2008 14:38:58 +0000 (UTC)

 Module Name:	src
 Committed By:	drochner
 Date:		Wed Aug 27 14:38:58 UTC 2008

 Modified Files:
 	src/gnu/dist/gcc4/libstdc++-v3/include/c_std: std_cwchar.h

 Log Message:
 Back out an old local modification (originating from PR lib/29832)
 which effectively disables *wprintf and *wscanf functions in
 the std namespace. We have wchar support now.
 (It might be necessary to do a "make clean" in
 src/gnu/lib/libstdc++-v3_4/include for this to have effect.)


 To generate a diff of this commit:
 cvs rdiff -r1.2 -r1.3 \
     src/gnu/dist/gcc4/libstdc++-v3/include/c_std/std_cwchar.h

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.