OSDN Git Service

* gcc.dg/compare1.c: Skip on arm*-*-eabi* arm*-*-symbianelf*.
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / compare1.c
1 /* Test for a bogus warning on comparison between signed and unsigned.
2    This was inspired by code in gcc. */
3
4 /* { dg-do compile } */
5 /* { dg-options "-Wsign-compare" } */
6 /* This test would fail on targets with short enums being default.  See
7    compare9.c.  */
8 /* { dg-skip-if "" { arm*-*-eabi* arm*-*-symbianelf* }  { "*" } { "" } } */
9
10 int tf = 1;
11
12 /* This enumeration has an explicit negative value and is therefore signed.  */
13 enum mm1 
14 {
15   VOID, SI, DI, MAX = -1
16 };
17
18 /* This enumeration fits entirely in a signed int, but is unsigned anyway.  */
19 enum mm2
20 {
21   VOID2, SI2, DI2, MAX2
22 };
23
24 int f(enum mm1 x)
25 {
26   return x == (tf?DI:SI); /* { dg-bogus "signed and unsigned" "case 1" } */
27 }
28
29 int g(enum mm1 x)
30 {
31   return x == (tf?DI:-1); /* { dg-bogus "signed and unsigned" "case 2" } */
32 }
33
34 int h(enum mm2 x)
35 {
36   return x == (tf?DI2:SI2); /* { dg-bogus "signed and unsigned" "case 3" } */
37 }
38
39 int i(enum mm2 x)
40 {
41   return x == (tf?DI2:-1); /* { dg-warning "signed and unsigned" "case 4" } */
42 }