| 1 |
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp-version=45 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized |
| 2 |
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp-version=50 -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized |
| 3 |
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp-version=50 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized |
| 4 |
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp-version=40 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized |
| 5 |
// RUN: %clang_cc1 -verify -fopenmp-version=31 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized |
| 6 |
// RUN: %clang_cc1 -verify -fopenmp-version=30 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized |
| 7 |
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp -DOMP51 -ferror-limit 100 -o - %s -Wuninitialized |
| 8 |
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp-simd -DOMP51 -ferror-limit 100 -o - %s -Wuninitialized |
| 9 |
// RUN: %clang_cc1 -verify=expected,ge40 -fopenmp-version=60 -fopenmp -DOMP60 -ferror-limit 100 -o - %s -Wuninitialized |
| 10 |
|
| 11 |
void foo(); |
| 12 |
|
| 13 |
namespace { |
| 14 |
static int y = 0; |
| 15 |
} |
| 16 |
static int x = 0; |
| 17 |
|
| 18 |
int main(int argc, char **argv) { |
| 19 |
const int c = 0; |
| 20 |
|
| 21 |
#pragma omp parallel default // expected-error {{expected '(' after 'default'}} |
| 22 |
#pragma omp parallel default( // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 23 |
#pragma omp parallel default() // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} |
| 24 |
#pragma omp parallel default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 25 |
#pragma omp parallel default(shared), default(shared) // expected-error {{directive '#pragma omp parallel' cannot contain more than one 'default' clause}} |
| 26 |
foo(); |
| 27 |
|
| 28 |
#pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}} |
| 29 |
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} |
| 30 |
|
| 31 |
#pragma omp parallel default(none) // expected-note {{explicit data sharing attribute requested here}} |
| 32 |
#pragma omp parallel default(shared) |
| 33 |
++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} |
| 34 |
|
| 35 |
#pragma omp parallel default(none) // ge40-note {{explicit data sharing attribute requested here}} |
| 36 |
(void)c; // ge40-error {{variable 'c' must have explicitly specified data sharing attributes}} |
| 37 |
|
| 38 |
#ifdef OMP51 |
| 39 |
#pragma omp parallel default(firstprivate) // expected-note 2 {{explicit data sharing attribute requested here}} |
| 40 |
{ |
| 41 |
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}} |
| 42 |
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}} |
| 43 |
} |
| 44 |
#pragma omp parallel default(private) // expected-note 2 {{explicit data sharing attribute requested here}} |
| 45 |
{ |
| 46 |
++x; // expected-error {{variable 'x' must have explicitly specified data sharing attributes}} |
| 47 |
++y; // expected-error {{variable 'y' must have explicitly specified data sharing attributes}} |
| 48 |
} |
| 49 |
#endif |
| 50 |
|
| 51 |
#ifdef OMP60 |
| 52 |
#pragma omp parallel default(shared:) private(x,y) // expected-error {{wrong variable category specified with modifier shared in the default clause}} |
| 53 |
{ |
| 54 |
++x; |
| 55 |
++y; |
| 56 |
} |
| 57 |
#pragma omp parallel default(shared: junk) private(x,y) // expected-error {{wrong variable category specified with modifier shared in the default clause}} |
| 58 |
{ |
| 59 |
++x; |
| 60 |
++y; |
| 61 |
} |
| 62 |
#pragma omp parallel default(firstprivate: junk) private(x,y) // expected-error {{wrong variable category specified with modifier firstprivate in the default clause}} |
| 63 |
{ |
| 64 |
++x; |
| 65 |
++y; |
| 66 |
} |
| 67 |
#pragma omp parallel default(private: allocatable) private(x,y) // expected-error {{wrong variable category specified with modifier private in the default clause}} |
| 68 |
{ |
| 69 |
++x; |
| 70 |
++y; |
| 71 |
} |
| 72 |
#endif |
| 73 |
return 0; |
| 74 |
} |
| 75 |
|
| 76 |
class A{ |
| 77 |
void a() { |
| 78 |
#pragma omp parallel |
| 79 |
a(b); // expected-error {{use of undeclared identifier 'b'}} |
| 80 |
} |
| 81 |
}; |