blob: d991ccfc3806705b725c226c5082cb323349855e [file] [log] [blame]
Richard Smith12a41bd2013-09-16 21:17:44 +00001// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -std=c++11 -o - %s
Alexey Bataev758e55e2013-09-06 18:03:48 +00002
3void foo() {
4}
5
6#pragma omp parallel // expected-error {{unexpected OpenMP directive '#pragma omp parallel'}}
7
8int main(int argc, char **argv) {
9 #pragma omp parallel
10 #pragma omp parallel unknown() // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}}
11 foo();
12 L1:
13 foo();
14 #pragma omp parallel
15 ;
16 #pragma omp parallel
17 {
18 goto L1; // expected-error {{use of undeclared label 'L1'}}
19 argc++;
20 }
21
22 for (int i = 0; i < 10; ++i) {
23 switch(argc) {
24 case (0):
25 #pragma omp parallel
26 {
27 foo();
28 break; // expected-error {{'break' statement not in loop or switch statement}}
29 continue; // expected-error {{'continue' statement not in loop statement}}
30 }
31 default:
32 break;
33 }
34 }
35 #pragma omp parallel default(none)
36 ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}
37
38 goto L2; // expected-error {{use of undeclared label 'L2'}}
39 #pragma omp parallel
40 L2:
41 foo();
42 #pragma omp parallel
43 {
44 return 1; // expected-error {{cannot return from OpenMP region}}
45 }
46
Richard Smith12a41bd2013-09-16 21:17:44 +000047 [[]] // expected-error {{an attribute list cannot appear here}}
48 #pragma omp parallel
49 for (int n = 0; n < 100; ++n) {}
50
Alexey Bataev758e55e2013-09-06 18:03:48 +000051 return 0;
52}
53