[C++ PATCH] Deprecate -ffriend-injection
[official-gcc.git] / gcc / testsuite / gcc.dg / Wlogical-op-1.c
blob462b90beaf3588a2c75649be6235aa180670ee6a
1 /*
2 { dg-do compile }
3 { dg-options "-Wlogical-op" }
4 */
6 enum { a, ba, b };
8 enum testenum { t1, t2};
10 extern int c;
11 extern char bool_a, bool_b;
13 extern int testa();
15 void foo()
17 if ( testa() && b ) /* { dg-warning "logical" } */
18 (void)testa();
20 if ( c && b ) /* { dg-warning "logical" } */
21 (void)testa();
23 if ( c && 0x42 ) /* { dg-warning "logical" } */
24 (void)testa();
26 if ( c && 0x80 >>6) /* { dg-warning "logical" } */
27 (void)testa();
30 if ( b && c == a ) /* { dg-bogus "logical" } */
31 (void)testa();
33 if ( 1 && c ) /* { dg-bogus "logical" } */
34 (void)testa();
36 if ( t2 && b ) /* { dg-bogus "logical" } */
37 (void)testa();
39 if ( 0 && c == a ) /* { dg-bogus "logical" } */
40 (void)testa();
42 if ( b && 1 ) /* { dg-bogus "logical" } */
43 (void)testa();
47 void bar()
49 if ( testa() || b ) /* { dg-warning "logical" } */
50 (void)testa();
52 if ( c || b ) /* { dg-warning "logical" } */
53 (void)testa();
55 if ( c || 0x42 ) /* { dg-warning "logical" } */
56 (void) testa();
58 if ( c || 0x80 >>6) /* { dg-warning "logical" } */
59 (void)testa();
62 if ( b || c == a ) /* { dg-bogus "logical" } */
63 (void)testa();
65 if ( 1 || c ) /* { dg-bogus "logical" } */
66 (void)testa();
68 if ( t2 || b ) /* { dg-bogus "logical" } */
69 (void)testa();
71 if ( 0 || c == a ) /* { dg-bogus "logical" } */
72 (void)testa();
74 if ( b || 1 ) /* { dg-bogus "logical" } */
75 (void)testa();