OpenCores
URL https://opencores.org/ocsvn/openrisc_2011-10-31/openrisc_2011-10-31/trunk

Subversion Repositories openrisc_2011-10-31

[/] [openrisc/] [trunk/] [gnu-src/] [gcc-4.2.2/] [gcc/] [testsuite/] [gcc.dg/] [Wparentheses-7.c] - Blame information for rev 149

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 149 jeremybenn
/* Test operation of -Wparentheses.  Precedence warnings.  & or + or -
2
   or comparison inside ^.  */
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 "parentheses" "correct warning" } */
14
  foo ((a & b) ^ c);
15
  foo (a & (b ^ c));
16
  foo (1 & 2 ^ c); /* { dg-warning "parentheses" "correct warning" } */
17
  foo ((1 & 2) ^ c);
18
  foo (1 & (2 ^ c));
19
  foo (1 & 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
20
  foo ((1 & 2) ^ 3);
21
  foo (1 & (2 ^ 3));
22
  foo (a ^ b & c); /* { dg-warning "parentheses" "correct warning" } */
23
  foo ((a ^ b) & c);
24
  foo (a ^ (b & c));
25
  foo (1 ^ 2 & c); /* { dg-warning "parentheses" "correct warning" } */
26
  foo ((1 ^ 2) & c);
27
  foo (1 ^ (2 & c));
28
  foo (1 ^ 2 & 3); /* { dg-warning "parentheses" "correct warning" } */
29
  foo ((1 ^ 2) & 3);
30
  foo (1 ^ (2 & 3));
31
  foo (a + b ^ c); /* { dg-warning "parentheses" "correct warning" } */
32
  foo ((a + b) ^ c);
33
  foo (a + (b ^ c));
34
  foo (1 + 2 ^ c); /* { dg-warning "parentheses" "correct warning" } */
35
  foo ((1 + 2) ^ c);
36
  foo (1 + (2 ^ c));
37
  foo (1 + 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
38
  foo ((1 + 2) ^ 3);
39
  foo (1 + (2 ^ 3));
40
  foo (a ^ b + c); /* { dg-warning "parentheses" "correct warning" } */
41
  foo ((a ^ b) + c);
42
  foo (a ^ (b + c));
43
  foo (1 ^ 2 + c); /* { dg-warning "parentheses" "correct warning" } */
44
  foo ((1 ^ 2) + c);
45
  foo (1 ^ (2 + c));
46
  foo (1 ^ 2 + 3); /* { dg-warning "parentheses" "correct warning" } */
47
  foo ((1 ^ 2) + 3);
48
  foo (1 ^ (2 + 3));
49
  foo (a - b ^ c); /* { dg-warning "parentheses" "correct warning" } */
50
  foo ((a - b) ^ c);
51
  foo (a - (b ^ c));
52
  foo (1 - 2 ^ c); /* { dg-warning "parentheses" "correct warning" } */
53
  foo ((1 - 2) ^ c);
54
  foo (1 - (2 ^ c));
55
  foo (1 - 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
56
  foo ((1 - 2) ^ 3);
57
  foo (1 - (2 ^ 3));
58
  foo (a ^ b - c); /* { dg-warning "parentheses" "correct warning" } */
59
  foo ((a ^ b) - c);
60
  foo (a ^ (b - c));
61
  foo (1 ^ 2 - c); /* { dg-warning "parentheses" "correct warning" } */
62
  foo ((1 ^ 2) - c);
63
  foo (1 ^ (2 - c));
64
  foo (1 ^ 2 - 3); /* { dg-warning "parentheses" "correct warning" } */
65
  foo ((1 ^ 2) - 3);
66
  foo (1 ^ (2 - 3));
67
  foo (a >= b ^ c); /* { dg-warning "parentheses" "correct warning" } */
68
  foo ((a >= b) ^ c);
69
  foo (a >= (b ^ c));
70
  foo (1 >= 2 ^ c); /* { dg-warning "parentheses" "correct warning" } */
71
  foo ((1 >= 2) ^ c);
72
  foo (1 >= (2 ^ c));
73
  foo (1 >= 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
74
  foo ((1 >= 2) ^ 3);
75
  foo (1 >= (2 ^ 3));
76
  foo (a ^ b >= c); /* { dg-warning "parentheses" "correct warning" } */
77
  foo ((a ^ b) >= c);
78
  foo (a ^ (b >= c));
79
  foo (1 ^ 2 >= c); /* { dg-warning "parentheses" "correct warning" } */
80
  foo ((1 ^ 2) >= c);
81
  foo (1 ^ (2 >= c));
82
  foo (1 ^ 2 >= 3); /* { dg-warning "parentheses" "correct warning" } */
83
  foo ((1 ^ 2) >= 3);
84
  foo (1 ^ (2 >= 3));
85
  foo (a == b ^ c); /* { dg-warning "parentheses" "correct warning" } */
86
  foo ((a == b) ^ c);
87
  foo (a == (b ^ c));
88
  foo (1 == 2 ^ c); /* { dg-warning "parentheses" "correct warning" } */
89
  foo ((1 == 2) ^ c);
90
  foo (1 == (2 ^ c));
91
  foo (1 == 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
92
  foo ((1 == 2) ^ 3);
93
  foo (1 == (2 ^ 3));
94
  foo (a ^ b == c); /* { dg-warning "parentheses" "correct warning" } */
95
  foo ((a ^ b) == c);
96
  foo (a ^ (b == c));
97
  foo (1 ^ 2 == c); /* { dg-warning "parentheses" "correct warning" } */
98
  foo ((1 ^ 2) == c);
99
  foo (1 ^ (2 == c));
100
  foo (1 ^ 2 == 3); /* { dg-warning "parentheses" "correct warning" } */
101
  foo ((1 ^ 2) == 3);
102
  foo (1 ^ (2 == 3));
103
  foo (a < b ^ c); /* { dg-warning "parentheses" "correct warning" } */
104
  foo ((a < b) ^ c);
105
  foo (a < (b ^ c));
106
  foo (1 < 2 ^ c); /* { dg-warning "parentheses" "correct warning" } */
107
  foo ((1 < 2) ^ c);
108
  foo (1 < (2 ^ c));
109
  foo (1 < 2 ^ 3); /* { dg-warning "parentheses" "correct warning" } */
110
  foo ((1 < 2) ^ 3);
111
  foo (1 < (2 ^ 3));
112
  foo (a ^ b < c); /* { dg-warning "parentheses" "correct warning" } */
113
  foo ((a ^ b) < c);
114
  foo (a ^ (b < c));
115
  foo (1 ^ 2 < c); /* { dg-warning "parentheses" "correct warning" } */
116
  foo ((1 ^ 2) < c);
117
  foo (1 ^ (2 < c));
118
  foo (1 ^ 2 < 3); /* { dg-warning "parentheses" "correct warning" } */
119
  foo ((1 ^ 2) < 3);
120
  foo (1 ^ (2 < 3));
121
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.