OSDN Git Service

* cppmacro.c (check_trad_stringification): New function.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / wtr-int-type-1.c
1 /* Test for -Wtraditional warnings on integer constant types.
2    Note, gcc should omit these warnings in system header files.
3    By Kaveh R. Ghazi <ghazi@caip.rutgers.edu> 8/22/2000.  */
4 /* { dg-do compile } */
5 /* { dg-options "-Wtraditional" } */
6
7 void
8 testfunc (void)
9 {
10   long long i;
11   
12   /* Octal and hex values shouldn't issue -Wtraditional warnings. */
13   i = 0x80000000;
14   i = 0xFFFFFFFF;
15   i = 037777777777;
16
17   i = 0x8000000000000000;
18   i = 0xFFFFFFFFFFFFFFFF;
19   i = 01777777777777777777777;
20
21   /* We expect to get either a "width of integer constant changes with
22      -traditional" warning or an "integer constant is unsigned in ISO
23      C, signed with -traditional" warning depending on whether we are
24      testing on a 32 or 64 bit platform.  Either warning means the
25      test passes and both matched by checking for "integer constant".  */
26   i = 18446744073709551615; /* { dg-warning "integer constant" "integer constant" } */
27   
28 #line 29 "sys-header.h" 3
29 /* We are in system headers now, no -Wtraditional warnings should issue.  */
30
31   i = 0x80000000;
32   i = 0xFFFFFFFF;
33   i = 037777777777;
34   
35   i = 0x8000000000000000;
36   i = 0xFFFFFFFFFFFFFFFF;
37   i = 01777777777777777777777;
38   
39   i = 9223372036854775807;
40   i = 18446744073709551615;
41 }
42
43 /* Ignore "decimal constant is so large that it is unsigned" warnings.  */
44 /* { dg-warning "decimal constant" "decimal constant" { target *-*-* } 26 } */
45 /* { dg-warning "decimal constant" "decimal constant" { target *-*-* } 40 } */