[PATCH] Revision 3: utf-16 and utf-32 support in C and C++

Jakub Jelinek jakub@redhat.com
Tue May 6 14:48:00 GMT 2008


On Tue, May 06, 2008 at 07:36:01AM -0700, H.J. Lu wrote:
> Does check_effective_target_4byte_wchar_t really work?
> g++.dg/ext/utf32-4.C now fails on Linux/Intel64. I got
> 
> bash-3.2$ cat w.c
> #if 0
> #include <wchar.h>
> #endif
> 
> int
> main ()
> {
>   int dummy[sizeof (wchar_t) >= 4 ? 1 : -1];
>   return 0;
> }
> bash-3.2$  gcc -c w.c
> w.c: In function 'main':
> w.c:8: error: 'wchar_t' undeclared (first use in this function)
> w.c:8: error: (Each undeclared identifier is reported only once
> w.c:8: error: for each function it appears in.)
> bash-3.2$
> 
> Is  <wchar.h> included for your test?

I'd say

-       int dummy[sizeof (wchar_t) >= 4 ? 1 : -1];
+       int dummy[sizeof (__WCHAR_TYPE__) >= 4 ? 1 : -1];

in target_supports.exp should fix this.  For wchar_t type you need wchar.h,
but __WCHAR_TYPE__ should be defined always (back to at least gcc 3.2).

	Jakub



More information about the Gcc-patches mailing list