[NFC] Maintainers.rst: align email address formatting
[llvm-project.git] / clang / test / OpenMP / target_parallel_messages.cpp
blob1ccdf647db9c2495d702b288442790012ecf9daf
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'
7 void xxx(int argc) {
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}}
13 void foo() {
16 static int pvt;
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}}
23 foo();
24 #pragma omp target parallel ( // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
25 foo();
26 #pragma omp target parallel [ // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
27 foo();
28 #pragma omp target parallel ] // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
29 foo();
30 #pragma omp target parallel ) // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
31 foo();
32 #pragma omp target parallel } // expected-warning {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
33 foo();
34 #pragma omp target parallel
35 foo();
36 // expected-warning@+1 {{extra tokens at the end of '#pragma omp target parallel' are ignored}}
37 #pragma omp target parallel unknown()
38 foo();
39 L1:
40 foo();
41 #pragma omp target parallel
43 #pragma omp target parallel
45 goto L1; // expected-error {{use of undeclared label 'L1'}}
46 argc++;
49 for (int i = 0; i < 10; ++i) {
50 switch(argc) {
51 case (0):
52 #pragma omp target parallel
54 foo();
55 break; // expected-error {{'break' statement not in loop or switch statement}}
56 continue; // expected-error {{'continue' statement not in loop statement}}
58 default:
59 break;
63 goto L2; // expected-error {{use of undeclared label 'L2'}}
64 #pragma omp target parallel
65 L2:
66 foo();
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'}}
77 foo();
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
93 return 0;