From owner-freebsd-current Thu Feb 20 5:50:19 2003 Delivered-To: freebsd-current@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 30B8337B401; Thu, 20 Feb 2003 05:50:17 -0800 (PST) Received: from h00609772adf0.ne.client2.attbi.com (h00609772adf0.ne.client2.attbi.com [24.61.43.152]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5968443FD7; Thu, 20 Feb 2003 05:50:13 -0800 (PST) (envelope-from rodrigc@attbi.com) Received: from h00609772adf0.ne.client2.attbi.com (localhost [127.0.0.1]) by h00609772adf0.ne.client2.attbi.com (8.12.6/8.12.6) with ESMTP id h1KDp7hE032444; Thu, 20 Feb 2003 08:51:07 -0500 (EST) (envelope-from rodrigc@h00609772adf0.ne.client2.attbi.com) Received: (from rodrigc@localhost) by h00609772adf0.ne.client2.attbi.com (8.12.6/8.12.6/Submit) id h1KDp6g2032443; Thu, 20 Feb 2003 08:51:06 -0500 (EST) Date: Thu, 20 Feb 2003 08:51:06 -0500 From: Craig Rodrigues 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> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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 by creating a new 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 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