Subject: Re: c++ wstring support disappears when upgrading to gcc4
To: None <current-users@netbsd.org>
From: Christos Zoulas <christos@astron.com>
List: current-users
Date: 08/06/2006 20:34:14
In article <63c0799b0608061213i44df2ff0o3fb9a8b3b932f7bf@mail.gmail.com>,
Mathieu Boespflug <mboes@tweag.net> wrote:
>Hi,
>
>It would seem that I no longer get wstring support when compiling a
>c++ program, such as the following (after upgrading userland to latest
>-current):
>
>$ cat > /tmp/test.cpp
>#include <string>
>
>int main () {
>        std::wstring s;
>};
>
>$ g++ test.cpp
>test.cpp: In function 'int main()':
>test.cpp:4: error: 'wstring' is not a member of 'std'
>test.cpp:4: error: expected `;' before 's'
>
>This program compiled fine with gcc 3.4 and an earlier version of
>-current userland.
>Boost for instance doesn't compile for me anymore, with a similar
>error as above.
>It would seem the fixes introduced by
>http://netbsd.org/cgi-bin/query-pr-single.pl?number=29832 should be
>ported over to gcc4? Or is this problem due to some other change in
>the userland?

Here's a patch.

christos

Index: Makefile
===================================================================
RCS file: /cvsroot/src/gnu/lib/libstdc++-v3_4/Makefile,v
retrieving revision 1.2
diff -u -u -r1.2 Makefile
--- Makefile	16 Jul 2006 19:54:21 -0000	1.2
+++ Makefile	6 Aug 2006 20:18:05 -0000
@@ -37,6 +37,13 @@
 COPTS.concept-inst.cc=	-D_GLIBCPP_CONCEPT_CHECKS -fimplicit-templates
 CPPFLAGS.strstream.cc=	-I$(GLIBCPP_INCLUDE_DIR)/backward -Wno-deprecated
 
+.if ${OBJECT_FMT} == "ELF"
+LIBDPLIBS= intl ${.CURDIR}/../../../lib/libintl
+.else
+# XXX: This is broken right now and we need to link manually with -lintl
+.endif
+
+
 # XXX
 MKDEPFLAGS+=	-I$(GLIBCPP_INCLUDE_DIR)/backward
 
Index: arch/i386/c++config.h
===================================================================
RCS file: /cvsroot/src/gnu/lib/libstdc++-v3_4/arch/i386/c++config.h,v
retrieving revision 1.4
diff -u -u -r1.4 c++config.h
--- arch/i386/c++config.h	2 Jul 2006 01:26:32 -0000	1.4
+++ arch/i386/c++config.h	6 Aug 2006 20:18:06 -0000
@@ -236,13 +236,13 @@
 /* #undef _GLIBCXX_HAVE_HYPOTL */
 
 /* Define to 1 if you have the `iconv' function. */
-/* #undef _GLIBCXX_HAVE_ICONV */
+#define _GLIBCXX_HAVE_ICONV 1
 
 /* Define to 1 if you have the `iconv_close' function. */
-/* #undef _GLIBCXX_HAVE_ICONV_CLOSE */
+#define _GLIBCXX_HAVE_ICONV_CLOSE 1
 
 /* Define to 1 if you have the `iconv_open' function. */
-/* #undef _GLIBCXX_HAVE_ICONV_OPEN */
+#define _GLIBCXX_HAVE_ICONV_OPEN 1
 
 /* Define to 1 if you have the <ieeefp.h> header file. */
 #define _GLIBCXX_HAVE_IEEEFP_H 1
@@ -272,7 +272,7 @@
 /* #undef _GLIBCXX_HAVE_ISNANL */
 
 /* Defined if iswblank exists. */
-/* #undef _GLIBCXX_HAVE_ISWBLANK */
+#define _GLIBCXX_HAVE_ISWBLANK 1
 
 /* Define if LC_MESSAGES is available in <locale.h>. */
 #define _GLIBCXX_HAVE_LC_MESSAGES 1
@@ -335,7 +335,7 @@
 #define _GLIBCXX_HAVE_MMAP 1
 
 /* Define to 1 if you have the `modf' function. */
-/* #undef _GLIBCXX_HAVE_MODF */
+#define _GLIBCXX_HAVE_MODF 1
 
 /* Define to 1 if you have the `modff' function. */
 #define _GLIBCXX_HAVE_MODFF 1
@@ -347,10 +347,10 @@
 /* #undef _GLIBCXX_HAVE_NAN_H */
 
 /* Define to 1 if you have the `nl_langinfo' function. */
-/* #undef _GLIBCXX_HAVE_NL_LANGINFO */
+#define _GLIBCXX_HAVE_NL_LANGINFO 1
 
 /* Define if poll is available in <poll.h>. */
-/* #undef _GLIBCXX_HAVE_POLL */
+#define _GLIBCXX_HAVE_POLL 1
 
 /* Define to 1 if you have the `powf' function. */
 #define _GLIBCXX_HAVE_POWF 1
@@ -407,19 +407,19 @@
 #define _GLIBCXX_HAVE_STRING_H 1
 
 /* Define to 1 if you have the `strtof' function. */
-/* #undef _GLIBCXX_HAVE_STRTOF */
+#define _GLIBCXX_HAVE_STRTOF 1
 
 /* Define to 1 if you have the `strtold' function. */
-/* #undef _GLIBCXX_HAVE_STRTOLD */
+#define _GLIBCXX_HAVE_STRTOLD 1
 
 /* Define to 1 if you have the <sys/filio.h> header file. */
 /* #undef _GLIBCXX_HAVE_SYS_FILIO_H */
 
 /* Define to 1 if you have the <sys/ioctl.h> header file. */
-/* #undef _GLIBCXX_HAVE_SYS_IOCTL_H */
+#define _GLIBCXX_HAVE_SYS_IOCTL_H 1
 
 /* Define to 1 if you have the <sys/ipc.h> header file. */
-/* #undef _GLIBCXX_HAVE_SYS_IPC_H */
+#define _GLIBCXX_HAVE_SYS_IPC_H 1
 
 /* Define to 1 if you have the <sys/isa_defs.h> header file. */
 /* #undef _GLIBCXX_HAVE_SYS_ISA_DEFS_H */
@@ -428,13 +428,13 @@
 /* #undef _GLIBCXX_HAVE_SYS_MACHINE_H */
 
 /* Define to 1 if you have the <sys/param.h> header file. */
-/* #undef _GLIBCXX_HAVE_SYS_PARAM_H */
+#define _GLIBCXX_HAVE_SYS_PARAM_H 1
 
 /* Define to 1 if you have the <sys/resource.h> header file. */
 #define _GLIBCXX_HAVE_SYS_RESOURCE_H 1
 
 /* Define to 1 if you have the <sys/sem.h> header file. */
-/* #undef _GLIBCXX_HAVE_SYS_SEM_H */
+#define _GLIBCXX_HAVE_SYS_SEM_H 1
 
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #define _GLIBCXX_HAVE_SYS_STAT_H 1
@@ -446,13 +446,13 @@
 #define _GLIBCXX_HAVE_SYS_TYPES_H 1
 
 /* Define to 1 if you have the <sys/uio.h> header file. */
-/* #undef _GLIBCXX_HAVE_SYS_UIO_H */
+#define _GLIBCXX_HAVE_SYS_UIO_H 1
 
 /* Define if S_IFREG is available in <sys/stat.h>. */
-/* #undef _GLIBCXX_HAVE_S_IFREG */
+#define _GLIBCXX_HAVE_S_IFREG 1
 
 /* Define if S_IFREG is available in <sys/stat.h>. */
-/* #undef _GLIBCXX_HAVE_S_ISREG */
+#define _GLIBCXX_HAVE_S_ISREG 1
 
 /* Define to 1 if you have the `tanf' function. */
 #define _GLIBCXX_HAVE_TANF 1
@@ -473,25 +473,25 @@
 #define _GLIBCXX_HAVE_UNISTD_H 1
 
 /* Defined if vfwscanf exists. */
-/* #undef _GLIBCXX_HAVE_VFWSCANF */
+#define _GLIBCXX_HAVE_VFWSCANF 1
 
 /* Defined if vswscanf exists. */
-/* #undef _GLIBCXX_HAVE_VSWSCANF */
+#define _GLIBCXX_HAVE_VSWSCANF 1
 
 /* Defined if vwscanf exists. */
-/* #undef _GLIBCXX_HAVE_VWSCANF */
+#define _GLIBCXX_HAVE_VWSCANF 1
 
 /* Define to 1 if you have the <wchar.h> header file. */
 #define _GLIBCXX_HAVE_WCHAR_H 1
 
 /* Defined if wcstof exists. */
-/* #undef _GLIBCXX_HAVE_WCSTOF */
+#define _GLIBCXX_HAVE_WCSTOF 1
 
 /* Define to 1 if you have the <wctype.h> header file. */
 #define _GLIBCXX_HAVE_WCTYPE_H 1
 
 /* Define if writev is available in <sys/uio.h>. */
-/* #undef _GLIBCXX_HAVE_WRITEV */
+#define _GLIBCXX_HAVE_WRITEV 1
 
 /* Define to 1 if you have the `_acosf' function. */
 /* #undef _GLIBCXX_HAVE__ACOSF */
@@ -798,7 +798,7 @@
 /* #undef _GLIBCXX_USE_C99_MATH */
 
 /* Define if iconv and related functions exist and are usable. */
-/* #undef _GLIBCXX_USE_ICONV */
+#define _GLIBCXX_USE_ICONV 1
 
 /* Define if LFS support is available. */
 /* #undef _GLIBCXX_USE_LFS */
@@ -807,10 +807,10 @@
 #define _GLIBCXX_USE_LONG_LONG 1
 
 /* Define if NLS translations are to be used. */
-/* #undef _GLIBCXX_USE_NLS */
+#define _GLIBCXX_USE_NLS 1
 
 /* Define if code specialized for wchar_t should be used. */
-/* #undef _GLIBCXX_USE_WCHAR_T */
+#define _GLIBCXX_USE_WCHAR_T 1
 
 #if defined (_GLIBCXX_HAVE__ACOSF) && ! defined (_GLIBCXX_HAVE_ACOSF)
 # define _GLIBCXX_HAVE_ACOSF 1
Index: arch/i386/config.h
===================================================================
RCS file: /cvsroot/src/gnu/lib/libstdc++-v3_4/arch/i386/config.h,v
retrieving revision 1.4
diff -u -u -r1.4 config.h
--- arch/i386/config.h	2 Jul 2006 01:26:32 -0000	1.4
+++ arch/i386/config.h	6 Aug 2006 20:18:07 -0000
@@ -130,13 +130,13 @@
 /* #undef HAVE_HYPOTL */
 
 /* Define to 1 if you have the `iconv' function. */
-/* #undef HAVE_ICONV */
+#define HAVE_ICONV 1
 
 /* Define to 1 if you have the `iconv_close' function. */
-/* #undef HAVE_ICONV_CLOSE */
+#define HAVE_ICONV_CLOSE 1
 
 /* Define to 1 if you have the `iconv_open' function. */
-/* #undef HAVE_ICONV_OPEN */
+#define HAVE_ICONV_OPEN 1
 
 /* Define to 1 if you have the <ieeefp.h> header file. */
 #define HAVE_IEEEFP_H 1
@@ -166,7 +166,7 @@
 /* #undef HAVE_ISNANL */
 
 /* Defined if iswblank exists. */
-/* #undef HAVE_ISWBLANK */
+#define HAVE_ISWBLANK 1
 
 /* Define if LC_MESSAGES is available in <locale.h>. */
 #define HAVE_LC_MESSAGES 1
@@ -178,7 +178,7 @@
 /* #undef HAVE_LDEXPL */
 
 /* Define to 1 if you have the <libintl.h> header file. */
-/* #undef HAVE_LIBINTL_H */
+#define HAVE_LIBINTL_H 1
 
 /* Define to 1 if you have the `m' library (-lm). */
 #define HAVE_LIBM 1
@@ -229,7 +229,7 @@
 #define HAVE_MMAP 1
 
 /* Define to 1 if you have the `modf' function. */
-/* #undef HAVE_MODF */
+#define HAVE_MODF 1
 
 /* Define to 1 if you have the `modff' function. */
 #define HAVE_MODFF 1
@@ -241,10 +241,10 @@
 /* #undef HAVE_NAN_H */
 
 /* Define to 1 if you have the `nl_langinfo' function. */
-/* #undef HAVE_NL_LANGINFO */
+#define HAVE_NL_LANGINFO 1
 
 /* Define if poll is available in <poll.h>. */
-/* #undef HAVE_POLL */
+#define HAVE_POLL 1
 
 /* Define to 1 if you have the `powf' function. */
 #define HAVE_POWF 1
@@ -301,19 +301,19 @@
 #define HAVE_STRING_H 1
 
 /* Define to 1 if you have the `strtof' function. */
-/* #undef HAVE_STRTOF */
+#define HAVE_STRTOF 1
 
 /* Define to 1 if you have the `strtold' function. */
-/* #undef HAVE_STRTOLD */
+#define HAVE_STRTOLD 1
 
 /* Define to 1 if you have the <sys/filio.h> header file. */
 /* #undef HAVE_SYS_FILIO_H */
 
 /* Define to 1 if you have the <sys/ioctl.h> header file. */
-/* #undef HAVE_SYS_IOCTL_H */
+#define HAVE_SYS_IOCTL_H 1
 
 /* Define to 1 if you have the <sys/ipc.h> header file. */
-/* #undef HAVE_SYS_IPC_H */
+#define HAVE_SYS_IPC_H 1
 
 /* Define to 1 if you have the <sys/isa_defs.h> header file. */
 /* #undef HAVE_SYS_ISA_DEFS_H */
@@ -322,13 +322,13 @@
 /* #undef HAVE_SYS_MACHINE_H */
 
 /* Define to 1 if you have the <sys/param.h> header file. */
-/* #undef HAVE_SYS_PARAM_H */
+#define HAVE_SYS_PARAM_H 1
 
 /* Define to 1 if you have the <sys/resource.h> header file. */
 #define HAVE_SYS_RESOURCE_H 1
 
 /* Define to 1 if you have the <sys/sem.h> header file. */
-/* #undef HAVE_SYS_SEM_H */
+#define HAVE_SYS_SEM_H 1
 
 /* Define to 1 if you have the <sys/stat.h> header file. */
 #define HAVE_SYS_STAT_H 1
@@ -340,13 +340,13 @@
 #define HAVE_SYS_TYPES_H 1
 
 /* Define to 1 if you have the <sys/uio.h> header file. */
-/* #undef HAVE_SYS_UIO_H */
+#define HAVE_SYS_UIO_H 1
 
 /* Define if S_IFREG is available in <sys/stat.h>. */
-/* #undef HAVE_S_IFREG */
+#define HAVE_S_IFREG 1
 
 /* Define if S_IFREG is available in <sys/stat.h>. */
-/* #undef HAVE_S_ISREG */
+#define HAVE_S_ISREG 1
 
 /* Define to 1 if you have the `tanf' function. */
 #define HAVE_TANF 1
@@ -367,67 +367,67 @@
 #define HAVE_UNISTD_H 1
 
 /* Defined if vfwscanf exists. */
-/* #undef HAVE_VFWSCANF */
+#define HAVE_VFWSCANF 1
 
 /* Defined if vswscanf exists. */
-/* #undef HAVE_VSWSCANF */
+#define HAVE_VSWSCANF 1
 
 /* Defined if vwscanf exists. */
-/* #undef HAVE_VWSCANF */
+#define HAVE_VWSCANF 1
 
 /* Define to 1 if you have the <wchar.h> header file. */
 #define HAVE_WCHAR_H 1
 
 /* Defined if wcstof exists. */
-/* #undef HAVE_WCSTOF */
+#define HAVE_WCSTOF 1
 
 /* Define to 1 if you have the <wctype.h> header file. */
 #define HAVE_WCTYPE_H 1
 
 /* Define if writev is available in <sys/uio.h>. */
-/* #undef HAVE_WRITEV */
+#define HAVE_WRITEV 1
 
 /* Define to 1 if you have the `_acosf' function. */
-/* #undef HAVE__ACOSF */
+#define HAVE__ACOSF 1
 
 /* Define to 1 if you have the `_acosl' function. */
-/* #undef HAVE__ACOSL */
+#define HAVE__ACOSL 1
 
 /* Define to 1 if you have the `_asinf' function. */
-/* #undef HAVE__ASINF */
+#define HAVE__ASINF 1
 
 /* Define to 1 if you have the `_asinl' function. */
 /* #undef HAVE__ASINL */
 
 /* Define to 1 if you have the `_atan2f' function. */
-/* #undef HAVE__ATAN2F */
+#define HAVE__ATAN2F */
 
 /* Define to 1 if you have the `_atan2l' function. */
 /* #undef HAVE__ATAN2L */
 
 /* Define to 1 if you have the `_atanf' function. */
-/* #undef HAVE__ATANF */
+#define HAVE__ATANF 1
 
 /* Define to 1 if you have the `_atanl' function. */
 /* #undef HAVE__ATANL */
 
 /* Define to 1 if you have the `_ceilf' function. */
-/* #undef HAVE__CEILF */
+#define HAVE__CEILF 1
 
 /* Define to 1 if you have the `_ceill' function. */
 /* #undef HAVE__CEILL */
 
 /* Define to 1 if you have the `_copysign' function. */
-/* #undef HAVE__COPYSIGN */
+#define HAVE__COPYSIGN 1
 
 /* Define to 1 if you have the `_copysignl' function. */
 /* #undef HAVE__COPYSIGNL */
 
 /* Define to 1 if you have the `_cosf' function. */
-/* #undef HAVE__COSF */
+#define HAVE__COSF 1
 
 /* Define to 1 if you have the `_coshf' function. */
-/* #undef HAVE__COSHF */
+#define HAVE__COSHF 1
 
 /* Define to 1 if you have the `_coshl' function. */
 /* #undef HAVE__COSHL */
@@ -436,34 +436,34 @@
 /* #undef HAVE__COSL */
 
 /* Define to 1 if you have the `_expf' function. */
-/* #undef HAVE__EXPF */
+#define HAVE__EXPF 1
 
 /* Define to 1 if you have the `_expl' function. */
 /* #undef HAVE__EXPL */
 
 /* Define to 1 if you have the `_fabsf' function. */
-/* #undef HAVE__FABSF */
+#define HAVE__FABSF 1
 
 /* Define to 1 if you have the `_fabsl' function. */
 /* #undef HAVE__FABSL */
 
 /* Define to 1 if you have the `_finite' function. */
-/* #undef HAVE__FINITE */
+#define HAVE__FINITE 1
 
 /* Define to 1 if you have the `_finitef' function. */
-/* #undef HAVE__FINITEF */
+#define HAVE__FINITEF 1
 
 /* Define to 1 if you have the `_finitel' function. */
 /* #undef HAVE__FINITEL */
 
 /* Define to 1 if you have the `_floorf' function. */
-/* #undef HAVE__FLOORF */
+#define HAVE__FLOORF 1
 
 /* Define to 1 if you have the `_floorl' function. */
 /* #undef HAVE__FLOORL */
 
 /* Define to 1 if you have the `_fmodf' function. */
-/* #undef HAVE__FMODF */
+#define HAVE__FMODF 1
 
 /* Define to 1 if you have the `_fmodl' function. */
 /* #undef HAVE__FMODL */
@@ -692,7 +692,7 @@
 /* #undef _GLIBCXX_USE_C99_MATH */
 
 /* Define if iconv and related functions exist and are usable. */
-/* #undef _GLIBCXX_USE_ICONV */
+#define _GLIBCXX_USE_ICONV 1
 
 /* Define if LFS support is available. */
 /* #undef _GLIBCXX_USE_LFS */
@@ -701,10 +701,10 @@
 #define _GLIBCXX_USE_LONG_LONG 1
 
 /* Define if NLS translations are to be used. */
-/* #undef _GLIBCXX_USE_NLS */
+#define _GLIBCXX_USE_NLS 1
 
 /* Define if code specialized for wchar_t should be used. */
-/* #undef _GLIBCXX_USE_WCHAR_T */
+#define _GLIBCXX_USE_WCHAR_T 1
 
 #if defined (HAVE__ACOSF) && ! defined (HAVE_ACOSF)
 # define HAVE_ACOSF 1