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: Fix gcc.dg/cpp/ucs.c


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


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