tech-userlevel archive

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

Re: typedef int wchar_t;



Joerg Sonnenberger wrote:
> I don't think we care much about ancient versions of G++ and if someone
> does, it should take GCC version check, nothing else.

Sorry for the late reply, I totally forgot about this topic until
I started rebuiling all packages with a newer version of icc.

All gcc versions up to 2.95 support native wchar_t in C++ mode.
It looks like we don't need a version check at all.

$ cat /tmp/w.cpp                                           
int main() { wchar_t x = 0; return x; }
$ /usr/pkg/gcc-2.95.3/bin/g++ -c -o /tmp/w.o /tmp/w.cpp  
$ echo $?
0

Index: include/inttypes.h
===================================================================
RCS file: /cvsroot/src/include/inttypes.h,v
retrieving revision 1.6
diff -u -r1.6 inttypes.h
--- include/inttypes.h  4 Aug 2008 21:19:45 -0000       1.6
+++ include/inttypes.h  15 Nov 2009 21:17:38 -0000
@@ -36,7 +36,7 @@
 #include <sys/inttypes.h>
 #include <machine/ansi.h>
 
-#ifdef _BSD_WCHAR_T_
+#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
 typedef        _BSD_WCHAR_T_   wchar_t;
 #undef _BSD_WCHAR_T_
 #endif
Index: include/stddef.h
===================================================================
RCS file: /cvsroot/src/include/stddef.h,v
retrieving revision 1.15
diff -u -r1.15 stddef.h
--- include/stddef.h    21 Aug 2006 16:58:29 -0000      1.15
+++ include/stddef.h    15 Nov 2009 21:17:38 -0000
@@ -45,7 +45,7 @@
 #undef _BSD_SIZE_T_
 #endif
 
-#ifdef _BSD_WCHAR_T_
+#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
 typedef        _BSD_WCHAR_T_   wchar_t;
 #undef _BSD_WCHAR_T_
 #endif
Index: include/stdlib.h
===================================================================
RCS file: /cvsroot/src/include/stdlib.h,v
retrieving revision 1.89
diff -u -r1.89 stdlib.h
--- include/stdlib.h    20 Jul 2009 17:03:37 -0000      1.89
+++ include/stdlib.h    15 Nov 2009 21:17:38 -0000
@@ -48,7 +48,7 @@
 #undef _BSD_SIZE_T_
 #endif
 
-#ifdef _BSD_WCHAR_T_
+#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
 typedef        _BSD_WCHAR_T_   wchar_t;
 #undef _BSD_WCHAR_T_
 #endif
Index: include/wchar.h
===================================================================
RCS file: /cvsroot/src/include/wchar.h,v
retrieving revision 1.27
diff -u -r1.27 wchar.h
--- include/wchar.h     28 Apr 2008 20:22:54 -0000      1.27
+++ include/wchar.h     15 Nov 2009 21:17:39 -0000
@@ -66,7 +66,7 @@
 
 #include <stdio.h> /* for FILE* */
 
-#ifdef _BSD_WCHAR_T_
+#if defined(_BSD_WCHAR_T_) && !defined(__cplusplus)
 typedef        _BSD_WCHAR_T_   wchar_t;
 #undef _BSD_WCHAR_T_
 #endif


Home | Main Index | Thread Index | Old Index