This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Fix gcc.dg/cpp/ucs.c
- From: Richard Henderson <rth at redhat dot com>
- To: Neil Booth <neil at daikokuya dot demon dot co dot uk>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 27 Mar 2002 00:16:02 -0800
- Subject: Re: Fix gcc.dg/cpp/ucs.c
- References: <20020327070940.GA5438@daikokuya.demon.co.uk>
On Wed, Mar 27, 2002 at 07:09:40AM +0000, Neil Booth wrote:
> This test wasn't valid, causing it to fail for some targets;
> here's a fix. I'll apply this to 3.1 and 3.2.
Failure here brought to my attention the incorrect definition of
wchar_t on Solaris. Would be nice to be able to determine when
it's safe to use the large number...
How about something like this?
r~
#include <limits.h>
#define unsigned +0
#define int +0
#define char +1
#define short +2
#define long +3
#if __WCHAR_TYPE__ == 0
# define WCHAR_MAX INT_MAX
#elif __WCHAR_TYPE__ == 1
# define WCHAR_MAX CHAR_MAX
#elif __WCHAR_TYPE__ == 2
# define WCHAR_MAX SHRT_MAX
#elif __WCHAR_TYPE__ == 3
# define WCHAR_MAX LONG_MAX
#else
# error wacky wchar_t
#endif
#undef unsigned
#undef int
#undef char
#undef short
#undef long
#if WCHAR_MAX >= 0x7ffffff
# if L'\U1234abcd' != 0x1234abcd
# error bad long ucs
# endif
#endif