builtin-has-attribute-4.c: Skip on 32-bit hppa*-*-hpux*.
[official-gcc.git] / gcc / testsuite / gcc.dg / pragma-diag-4.c
blobfc8d4b1feb556acde4fc7fd8e97e59842bd03b4a
1 /* { dg-do compile } */
2 /* { dg-options "-Wsign-compare -Werror=sign-compare -Werror=switch-enum" } */
3 /* { dg-message "warnings being treated as errors" "" {target "*-*-*"} 0 } */
5 int bar()
7 unsigned x = 0;
8 int y = 1;
10 /* generates an error - ok */
11 x += x < y ? 1 : 0; /* { dg-error "comparison" } */
13 #pragma GCC diagnostic push
14 #pragma GCC diagnostic ignored "-Wsign-compare"
15 /* generates no diagnostic - ok */
16 x += x < y ? 1 : 0;
17 #pragma GCC diagnostic pop
19 x += x < y ? 1 : 0; /* { dg-error "comparison" } */
21 return x;
24 enum EE { ONE, TWO };
26 int f (enum EE e)
28 int r = 0;
30 #pragma GCC diagnostic push
31 #pragma GCC diagnostic ignored "-Wswitch-enum"
33 switch (e)
35 case ONE:
36 r = 1;
37 break;
39 #pragma GCC diagnostic pop
41 switch (e) /* { dg-error "switch" } */
43 case ONE:
44 r = 1;
45 break;
47 return r;