1 // RUN: %clang_cc1 -verify -fopenmp -std=c++11 -o - %s -Wuninitialized
2 // RUN: not %clang_cc1 -fopenmp -std=c++11 -fopenmp-targets=aaa-bbb-ccc-ddd -o - %s 2>&1 | FileCheck %s
4 // RUN: %clang_cc1 -verify -fopenmp-simd -std=c++11 -o - %s -Wuninitialized
5 // CHECK: error: OpenMP target is invalid: 'aaa-bbb-ccc-ddd'
8 int x
; // expected-note {{initialize the variable 'x' to silence this warning}}
9 #pragma omp target parallel
10 argc
= x
; // expected-warning {{variable 'x' is uninitialized when used here}}
17 #pragma omp threadprivate(pvt)
19 #pragma omp target parallel // expected-error {{unexpected OpenMP directive '#pragma omp target parallel'}}
21 int main(int argc
, char **argv
) {
22 #pragma omp target parallel { // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
24 #pragma omp target parallel ( // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
26 #pragma omp target parallel [ // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
28 #pragma omp target parallel ] // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
30 #pragma omp target parallel ) // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
32 #pragma omp target parallel } // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
34 #pragma omp target parallel
36 // expected-warning@+1 {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
37 #pragma omp target parallel unknown()
41 #pragma omp target parallel
43 #pragma omp target parallel
45 goto L1
; // expected-error {{use of undeclared label 'L1'}}
49 for (int i
= 0; i
< 10; ++i
) {
52 #pragma omp target parallel
55 break; // expected-error {{'break' statement not in loop or switch statement}}
56 continue; // expected-error {{'continue' statement not in loop statement}}
63 goto L2
; // expected-error {{use of undeclared label 'L2'}}
64 #pragma omp target parallel
67 #pragma omp target parallel
69 return 1; // expected-error {{cannot return from OpenMP region}}
72 [[]] // expected-error {{an attribute list cannot appear here}}
73 #pragma omp target parallel
74 for (int n
= 0; n
< 100; ++n
) {}
76 #pragma omp target parallel copyin(pvt) // expected-error {{unexpected OpenMP clause 'copyin' in directive '#pragma omp target parallel'}}
79 #pragma omp target parallel
81 #pragma omp cancel // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}}
82 #pragma omp cancellation point // expected-error {{one of 'for', 'parallel', 'sections' or 'taskgroup' is expected}}
83 #pragma omp cancel for // expected-error {{region cannot be closely nested inside 'target parallel' region}}
84 #pragma omp cancellation point for // expected-error {{region cannot be closely nested inside 'target parallel' region}}
85 #pragma omp cancel sections // expected-error {{region cannot be closely nested inside 'target parallel' region}}
86 #pragma omp cancellation point sections // expected-error {{region cannot be closely nested inside 'target parallel' region}}
87 #pragma omp cancel taskgroup // expected-error {{region cannot be closely nested inside 'target parallel' region}}
88 #pragma omp cancellation point taskgroup // expected-error {{region cannot be closely nested inside 'target parallel' region}}
89 #pragma omp cancel parallel
90 #pragma omp cancellation point parallel