Sync usage with man page.
[netbsd-mini2440.git] / gnu / dist / gcc4 / gcc / testsuite / gcc.dg / cpp / charconst-3.c
blob7c1966391315b9b7d64f3adf59df4f2c47d6d599
1 /* Copyright (C) 2001 Free Software Foundation, Inc. */
3 /* { dg-do run } */
4 /* { dg-options -Wno-multichar } */
6 /* This tests values and signedness of multichar charconsts.
8 Neil Booth, 5 May 2002. */
10 #include <limits.h>
12 extern void abort (void);
14 int main ()
16 /* These tests require at least 2-byte ints. 8-) */
17 #if INT_MAX > 127
18 int scale = (int) (unsigned char) -1 + 1;
20 if ('ab' != (int) ((unsigned char) 'a' * scale + (unsigned char) 'b'))
21 abort ();
23 if ('\234b' != (int) ((unsigned char) '\234' * scale + (unsigned char) 'b'))
24 abort ();
26 if ('b\234' != (int) ((unsigned char) 'b' * scale + (unsigned char) '\234'))
27 abort ();
28 /* Multichar charconsts have type int and should be signed. */
29 #if INT_MAX == 32767
30 # if '\234a' > 0
31 # error Preprocessor charconsts 1
32 # endif
33 if ('\234a' > 0)
34 abort ();
35 #elif INT_MAX == 2147483647
36 # if '\234aaa' > 0
37 # error Preprocessor charconsts 2
38 # endif
39 if ('\234aaa' > 0)
40 abort ();
41 #elif INT_MAX == 9223372036854775807
42 # if '\234aaaaaaa' > 0
43 # error Preprocessor charconsts 3
44 # endif
45 if ('\234aaaaaaa' > 0)
46 abort ();
47 #endif
48 #endif
49 return 0;