• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
2 
foo()3 void foo() {
4 }
5 
foobool(int argc)6 bool foobool(int argc) {
7   return argc;
8 }
9 
10 struct S1; // expected-note {{declared here}}
11 
12 template <class T, class S> // expected-note {{declared here}}
tmain(T argc,S ** argv)13 int tmain(T argc, S **argv) {
14   #pragma omp parallel sections if // expected-error {{expected '(' after 'if'}}
15   {
16     foo();
17   }
18   #pragma omp parallel sections if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
19   {
20     foo();
21   }
22   #pragma omp parallel sections if () // expected-error {{expected expression}}
23   {
24     foo();
25   }
26   #pragma omp parallel sections if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
27   {
28     foo();
29   }
30   #pragma omp parallel sections if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}}
31   {
32     foo();
33   }
34   #pragma omp parallel sections if (argc > 0 ? argv[1] : argv[2])
35   {
36     foo();
37   }
38   #pragma omp parallel sections if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel sections' cannot contain more than one 'if' clause}}
39   {
40     foo();
41   }
42   #pragma omp parallel sections if (S) // expected-error {{'S' does not refer to a value}}
43   {
44     foo();
45   }
46   #pragma omp parallel sections if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
47   {
48     foo();
49   }
50   #pragma omp parallel sections if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
51   {
52     foo();
53   }
54   #pragma omp parallel sections if(argc)
55   {
56     foo();
57   }
58   #pragma omp parallel sections if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
59   {
60     foo();
61   }
62   #pragma omp parallel sections if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
63   {
64     foo();
65   }
66   #pragma omp parallel sections if(parallel : argc)
67   {
68     foo();
69   }
70   #pragma omp parallel sections if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp parallel sections'}}
71   {
72     foo();
73   }
74   #pragma omp parallel sections if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp parallel sections' cannot contain more than one 'if' clause with 'parallel' name modifier}}
75   {
76     foo();
77   }
78   #pragma omp parallel sections if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
79   {
80     foo();
81   }
82 
83   return 0;
84 }
85 
main(int argc,char ** argv)86 int main(int argc, char **argv) {
87   #pragma omp parallel sections if // expected-error {{expected '(' after 'if'}}
88   {
89     foo();
90   }
91   #pragma omp parallel sections if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
92   {
93     foo();
94   }
95   #pragma omp parallel sections if () // expected-error {{expected expression}}
96   {
97     foo();
98   }
99   #pragma omp parallel sections if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
100   {
101     foo();
102   }
103   #pragma omp parallel sections if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel sections' are ignored}}
104   {
105     foo();
106   }
107   #pragma omp parallel sections if (argc > 0 ? argv[1] : argv[2])
108   {
109     foo();
110   }
111   #pragma omp parallel sections if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel sections' cannot contain more than one 'if' clause}}
112   {
113     foo();
114   }
115   #pragma omp parallel sections if (S1) // expected-error {{'S1' does not refer to a value}}
116   {
117     foo();
118   }
119   #pragma omp parallel sections if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
120   {
121     foo();
122   }
123   #pragma omp parallel sections if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
124   {
125     foo();
126   }
127   #pragma omp parallel sections if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
128   {
129     foo();
130   }
131   #pragma omp parallel sections if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
132   {
133     foo();
134   }
135   #pragma omp parallel sections if(parallel : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
136   {
137     foo();
138   }
139   #pragma omp parallel sections if(parallel : argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
140   {
141     foo();
142   }
143   #pragma omp parallel sections if(parallel : argc)
144   {
145     foo();
146   }
147   #pragma omp parallel sections if(parallel : argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp parallel sections'}}
148   {
149     foo();
150   }
151   #pragma omp parallel sections if(parallel : argc) if (parallel:argc) // expected-error {{directive '#pragma omp parallel sections' cannot contain more than one 'if' clause with 'parallel' name modifier}}
152   {
153     foo();
154   }
155   #pragma omp parallel sections if(parallel : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}}
156   {
157     foo();
158   }
159 
160   return tmain(argc, argv);
161 }
162