Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 20 Feb 2003 08:51:06 -0500
From:      Craig Rodrigues <rodrigc@attbi.com>
To:        freebsd-current@freebsd.org
Cc:        kan@freebsd.org
Subject:   Adding std::wstring and wchar_t support to GCC on -CURRENT
Message-ID:  <20030220135106.GA32375@attbi.com>

next in thread | raw e-mail | index | archive | help
Hi,

I posted to the GCC mailing list recently, mentioning that
GCC under FreeBSD does not have std::wstring/wchar_t support.

Alexander Kabaev posted a list of problems under FreeBSD,
and some possible workarounds:

http://gcc.gnu.org/ml/gcc/2003-02/msg01291.html

Hopefully some of the FreeBSD header file problems will be
resolved soon.  For example, Mike Barcroft has mentioned an
approach for adding WCHAR_MIN and WCHAR_MAX macros to
<wchar.h> by creating a new <machine/_limits.h> private header file.

I followed Alex's instructions for creating a workaround, to
enable wchar_t support in libstdc++, so I am posting my patches
for those who may be interested.  I think the wchar.h patch
will be unnecessary once the <machine/_limits.h> fix is integrated
in FreeBSD. 

I just rebuilt the world, and don't seem to have any problems yet!


--- src/include/wchar.h.orig	Wed Feb 19 17:21:14 2003
+++ include/wchar.h	Thu Feb 20 03:20:32 2003
@@ -100,6 +100,14 @@
 #define	WEOF 	((wint_t)-1)
 #endif
 
+#ifndef WCHAR_MIN
+#define WCHAR_MIN (-2147483647l - 1l)
+#endif
+
+#ifndef WCHAR_MAX
+#define WCHAR_MAX (2147483647l)
+#endif
+
 struct __sFILE;
 struct tm;
 
--- src/gnu/lib/libstdc++/c++config.h.orig	Wed Feb 19 13:35:27 2003
+++ src/gnu/lib/libstdc++/c++config.h	Wed Feb 19 13:36:25 2003
@@ -108,6 +108,7 @@
 
 // Define if code specialized for wchar_t should be used.
 /* #undef _GLIBCPP_USE_WCHAR_T */
+#define _GLIBCPP_USE_WCHAR_T 1
 
 // Define if using setrlimit to limit memory usage during 'make check'.
 /* #undef _GLIBCPP_MEM_LIMITS */
--- src/contrib/libstdc++/include/c_std/std_cwchar.h.orig	Wed Feb 19 13:37:36 2003
+++ src/contrib/libstdc++/include/c_std/std_cwchar.h	Wed Feb 19 13:38:05 2003
@@ -173,7 +173,7 @@
   using ::wcsrtombs;
   using ::wcsspn;
   using ::wcstod;
-  using ::wcstof;
+  //using ::wcstof;
   using ::wcstok;
   using ::wcstol;
   using ::wcstoul;



-- 
Craig Rodrigues        
http://home.attbi.com/~rodrigc
rodrigc@attbi.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030220135106.GA32375>