| 1 |
|
| 2 |
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=60 -DOMP60 %s -Wuninitialized |
| 3 |
|
| 4 |
// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=60 -DOMP60 %s -Wuninitialized |
| 5 |
|
| 6 |
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 -DOMP52 %s -Wuninitialized |
| 7 |
|
| 8 |
void foo(); |
| 9 |
|
| 10 |
namespace { |
| 11 |
static int y = 0; |
| 12 |
} |
| 13 |
static int x = 0; |
| 14 |
|
| 15 |
int main(int argc, char **argv) { |
| 16 |
#ifdef OMP60 |
| 17 |
#pragma omp target default // expected-error {{expected '(' after 'default'}} |
| 18 |
for (int i=0; i<200; i++) foo(); |
| 19 |
#pragma omp target default( // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 20 |
for (int i=0; i<200; i++) foo(); |
| 21 |
#pragma omp target default() // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} |
| 22 |
for (int i=0; i<200; i++) foo(); |
| 23 |
#pragma omp target default (none // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 24 |
for (int i=0; i<200; i++) foo(); |
| 25 |
#pragma omp target default(x) // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} |
| 26 |
for (int i=0; i<200; i++) foo(); |
| 27 |
#pragma omp target default(none) // expected-note {{explicit data sharing attribute, data mapping attribute, or is_device_ptr clause requested here}} |
| 28 |
x++; // expected-error {{variable 'x' must have explicitly specified data sharing attributes, data mapping attributes, or in an is_device_ptr clause}} |
| 29 |
#endif |
| 30 |
|
| 31 |
#ifdef OMP52 |
| 32 |
#pragma omp target default(firstprivate) // expected-error {{unexpected OpenMP clause 'default' in directive '#pragma omp target'}} |
| 33 |
for (int i = 0; i < 200; i++) { |
| 34 |
++x; |
| 35 |
++y; |
| 36 |
} |
| 37 |
#pragma omp target default(private) // expected-error {{unexpected OpenMP clause 'default' in directive '#pragma omp target'}} |
| 38 |
for (int i = 0; i < 200; i++) { |
| 39 |
++x; |
| 40 |
++y; |
| 41 |
} |
| 42 |
|
| 43 |
int j = 0, i = 0, nn = 10; |
| 44 |
#pragma omp target teams distribute simd default(shared) // expected-error {{unexpected OpenMP clause 'default' in directive '#pragma omp target teams distribute simd'}} |
| 45 |
for (j = 0; j < nn; j++ ) { |
| 46 |
for (i = 0; i < nn; i++ ) { |
| 47 |
; |
| 48 |
} |
| 49 |
} |
| 50 |
#endif |
| 51 |
|
| 52 |
return 0; |
| 53 |
} |