]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/c-c++-common/cilk-plus/CK/Wparentheses-1.c
f07b49a2775f7b8b8d6b98e682e5128266a230f9
[thirdparty/gcc.git] / gcc / testsuite / c-c++-common / cilk-plus / CK / Wparentheses-1.c
1 /* PR c/70436 */
2 /* { dg-do compile } */
3 /* { dg-options "-fcilkplus -Wparentheses" } */
4 /* { dg-additional-options "-std=gnu99" { target c } } */
5
6 int a, b, c;
7 void bar (void);
8 void baz (void);
9
10 void
11 f1 (void)
12 {
13 if (a) /* { dg-warning "ambiguous" } */
14 _Cilk_for (int i = 0; i < 10; i++)
15 if (b)
16 bar ();
17 else
18 baz ();
19
20 if (a)
21 _Cilk_for (int i = 0; i < 10; i++)
22 {
23 if (b)
24 bar ();
25 else
26 baz ();
27 }
28
29 if (a)
30 _Cilk_for (int i = 0; i < 10; i++)
31 {
32 if (b)
33 bar ();
34 }
35 else
36 baz ();
37 }
38
39 void
40 f2 (void)
41 {
42 if (a) /* { dg-warning "ambiguous" } */
43 #pragma cilk grainsize = 2
44 _Cilk_for (int i = 0; i < 10; i++)
45 if (b)
46 bar ();
47 else
48 baz ();
49
50 if (a)
51 #pragma cilk grainsize = 2
52 _Cilk_for (int i = 0; i < 10; i++)
53 {
54 if (b)
55 bar ();
56 else
57 baz ();
58 }
59
60 if (a)
61 #pragma cilk grainsize = 2
62 _Cilk_for (int i = 0; i < 10; i++)
63 {
64 if (b)
65 bar ();
66 }
67 else
68 baz ();
69 }