This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Hi,

"" is also missing in gcc.dg/utf32-4.c. Here is a patch. OK for trunk?


H.J.
---
2008-05-06  H.J. Lu  <hongjiu.lu@intel.com>

        PR testsuite/36155
        * gcc.dg/utf32-4.c: Fix a typo.

        * lib/target-supports.exp (check_effective_target_4byte_wchar_t):
        Use __WCHAR_TYPE__ instead of wchar_t.

On Tue, May 6, 2008 at 7:47 AM, Kris Van Hees <kris.van.hees@oracle.com> wrote:
> I would suggest using sizeof(__WCHAR_TYPE__) >= 4 instead of sizeof(wchar_t),
>  given that indeed wchar_t won't be defined in C unless you include wchar.h,
>  which is not guaranteed for all tests that might need this.  As far as I can
>  see that macro will always exist and contain the underlying type, which ought
>  to be sufficient for this functionality.
>
>         Kris
>
>
>  On Tue, May 06, 2008 at 07:36:01AM -0700, H.J. Lu wrote:
>
>
> > Hi Danny,
>  >
>  > 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?
>  >
>  >
>  > H.J.
>  > On Mon, May 5, 2008 at 3:36 PM, Danny Smith <dansmister@gmail.com> wrote:
>  > > >  >
>  > >  >  > 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.
>  > >  >
>  > >  Thanks for the advice.  How is this (attached)?
>  > >
>  > >  2008-05-06  Danny Smith  <dannysmith@users.sourceforge.net>
>  > >
>  > >         * lib/target_supports.exp (check_effective_target_4byte_wchar_t):
>  > >         New proc.
>  > >         * gcc.dg/utf16-4.c: Use it.
>  > >         * gcc.dg/utf32-4.c: Use it.
>  > >         * g++.dg/ext/utf16-4.C: Use it.
>  > >         * gcc.dg/ext/utf32-4.C: Use it.
>  > >
>  > >  Danny
>  > >  >  Janis
>  > >  >
>  > >  >
>  > >
>

Attachment: u.txt
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]