URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Details |
Compare with Previous |
View Log
Line No. |
Rev |
Author |
Line |
1 |
149 |
jeremybenn |
/* Test operation of -Wparentheses. Warnings for X<=Y<=Z should be
|
2 |
|
|
there rather than hidden in -Wextra. */
|
3 |
|
|
/* Origin: Joseph Myers <jsm@polyomino.org.uk> */
|
4 |
|
|
|
5 |
|
|
/* { dg-do compile } */
|
6 |
|
|
/* { dg-options "-Wparentheses" } */
|
7 |
|
|
|
8 |
|
|
int foo (int);
|
9 |
|
|
|
10 |
|
|
int
|
11 |
|
|
bar (int a, int b, int c)
|
12 |
|
|
{
|
13 |
|
|
foo (a <= b <= c); /* { dg-warning "comparison" "correct warning" } */
|
14 |
|
|
foo ((a <= b) <= c);
|
15 |
|
|
foo (a <= (b <= c));
|
16 |
|
|
foo (1 <= 2 <= c); /* { dg-warning "comparison" "correct warning" } */
|
17 |
|
|
foo ((1 <= 2) <= c);
|
18 |
|
|
foo (1 <= (2 <= c));
|
19 |
|
|
foo (1 <= 2 <= 3); /* { dg-warning "comparison" "correct warning" } */
|
20 |
|
|
foo ((1 <= 2) <= 3);
|
21 |
|
|
foo (1 <= (2 <= 3));
|
22 |
|
|
foo (a > b > c); /* { dg-warning "comparison" "correct warning" } */
|
23 |
|
|
foo ((a > b) > c);
|
24 |
|
|
foo (a > (b > c));
|
25 |
|
|
foo (1 > 2 > c); /* { dg-warning "comparison" "correct warning" } */
|
26 |
|
|
foo ((1 > 2) > c);
|
27 |
|
|
foo (1 > (2 > c));
|
28 |
|
|
foo (1 > 2 > 3); /* { dg-warning "comparison" "correct warning" } */
|
29 |
|
|
foo ((1 > 2) > 3);
|
30 |
|
|
foo (1 > (2 > 3));
|
31 |
|
|
foo (a < b <= c); /* { dg-warning "comparison" "correct warning" } */
|
32 |
|
|
foo ((a < b) <= c);
|
33 |
|
|
foo (a < (b <= c));
|
34 |
|
|
foo (1 < 2 <= c); /* { dg-warning "comparison" "correct warning" } */
|
35 |
|
|
foo ((1 < 2) <= c);
|
36 |
|
|
foo (1 < (2 <= c));
|
37 |
|
|
foo (1 < 2 <= 3); /* { dg-warning "comparison" "correct warning" } */
|
38 |
|
|
foo ((1 < 2) <= 3);
|
39 |
|
|
foo (1 < (2 <= 3));
|
40 |
|
|
foo (a <= b > c); /* { dg-warning "comparison" "correct warning" } */
|
41 |
|
|
foo ((a <= b) > c);
|
42 |
|
|
foo (a <= (b > c));
|
43 |
|
|
foo (1 <= 2 > c); /* { dg-warning "comparison" "correct warning" } */
|
44 |
|
|
foo ((1 <= 2) > c);
|
45 |
|
|
foo (1 <= (2 > c));
|
46 |
|
|
foo (1 <= 2 > 3); /* { dg-warning "comparison" "correct warning" } */
|
47 |
|
|
foo ((1 <= 2) > 3);
|
48 |
|
|
foo (1 <= (2 > 3));
|
49 |
|
|
foo (a <= b == c); /* { dg-warning "comparison" "correct warning" } */
|
50 |
|
|
foo ((a <= b) == c);
|
51 |
|
|
foo (a <= (b == c));
|
52 |
|
|
foo (1 <= 2 == c); /* { dg-warning "comparison" "correct warning" } */
|
53 |
|
|
foo ((1 <= 2) == c);
|
54 |
|
|
foo (1 <= (2 == c));
|
55 |
|
|
foo (1 <= 2 == 3); /* { dg-warning "comparison" "correct warning" } */
|
56 |
|
|
foo ((1 <= 2) == 3);
|
57 |
|
|
foo (1 <= (2 == 3));
|
58 |
|
|
foo (a != b != c); /* { dg-warning "comparison" "correct warning" } */
|
59 |
|
|
foo ((a != b) != c);
|
60 |
|
|
foo (a != (b != c));
|
61 |
|
|
foo (1 != 2 != c); /* { dg-warning "comparison" "correct warning" } */
|
62 |
|
|
foo ((1 != 2) != c);
|
63 |
|
|
foo (1 != (2 != c));
|
64 |
|
|
foo (1 != 2 != 3); /* { dg-warning "comparison" "correct warning" } */
|
65 |
|
|
foo ((1 != 2) != 3);
|
66 |
|
|
foo (1 != (2 != 3));
|
67 |
|
|
}
|
© copyright 1999-2025
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.