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

Janis Johnson janis187@us.ibm.com
Mon May 5 20:22:00 GMT 2008


On Fri, 2008-05-02 at 15:13 +1200, Danny Smith wrote:
> On Wed, Apr 16, 2008 at 8:00 AM, Kris Van Hees <kris.van.hees@oracle.com> wrote:
> > Oracle has a full copyright assignment in place with the FSF.
> >
> >  Please refer to the following message in the archives for the original
> >  posting of this patch:
> >
> >         http://gcc.gnu.org/ml/gcc-patches/2008-03/msg00827.html
> >
> 
> 
> The utf16-4.c and utf32-4.c tests and their C++ counterparts
> added here
> 
> 2008-04-18  Kris Van Hees <kris.van.hees@oracle.com>
> 
> 	Tests for char16_t and char32_t support.
> ...
> 	* g++.dg/ext/utf16-4.C: New
> ...
> 	* g++.dg/ext/utf32-4.C: New
> ...
> 	* gcc.dg/utf16-4.c: New
> ...
> 	* gcc.dg/utf32-4.c: New
> 
> Fail on mingw32.
> 
> wchar_t on mingw32 is unsigned short. Thus, line 18 in each of the four
> testcases:
> 
> char16_t 	c9 = L'\U00064321';
> 
> emits
> "warning: character constant too long for its type"
> rather than the "implicit truncation" warning for char16_t and no
> warning for char32_t.
> 
> This can be avoided by only testing the line on targets with at least
> 4-byte wchar_t, eg
> 
> #if (__SIZEOF_WCHAR_T >= 4)
> char16_t 	c9 = L'\U00064321';	/* { dg-warning "implicitly truncated" } */
> #endif

> Is that the right thing to do?

That won't work, the testsuite framework won't recognize that
the line with the warning is not processed and will still look
for the warning.  The test would also need to skip the dg-warning
directive by adding "{ target xxx }", where xxx is a new
effective-target keyword for a target whose wchar_t is at least
four bytes.

Janis 



More information about the Gcc-patches mailing list