brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.9 KiB · d7796bb Raw
61 lines · cpp
1// RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized2 3// RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized4 5// RUN: %clang_cc1 -verify -fopenmp-version=50 -DOMP50 -fopenmp -ferror-limit 100 -o - %s -Wuninitialized6 7// RUN: %clang_cc1 -verify -fopenmp-version=50 -DOMP50 -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized8 9void foo();10 11namespace {12static int y = 0;13}14static int x = 0;15 16int main(int argc, char **argv) {17  int i;18#pragma omp target parallel for simd default // expected-error {{expected '(' after 'default'}}19  for (i = 0; i < argc; ++i)20    foo();21#pragma omp target parallel for simd default( // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}}22  for (i = 0; i < argc; ++i)23    foo();24#pragma omp target parallel for simd default() // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}25  for (i = 0; i < argc; ++i)26    foo();27#pragma omp target parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}}28  for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}29    foo();30#pragma omp target parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp target parallel for simd' cannot contain more than one 'default' clause}}31  for (i = 0; i < argc; ++i)32    foo();33#pragma omp target parallel for simd default(x) // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}34  for (i = 0; i < argc; ++i)35    foo();36 37#pragma omp target parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}}38  for (i = 0; i < argc; ++i)  // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}39    foo();40 41#pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}}42#pragma omp target parallel for simd default(shared)43  for (i = 0; i < argc; ++i) // expected-error {{variable 'i' must have explicitly specified data sharing attributes}} expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}44    foo();45 46#ifdef OMP5047#pragma omp target parallel for simd default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}48  for (int i = 0; i < argc; i++) {49    ++x;50    ++y;51  }52#pragma omp target parallel for simd default(private) // expected-error {{data-sharing attribute 'private' in 'default' clause requires OpenMP version 5.1 or above}}53  for (int i = 0; i < argc; i++) {54    ++x;55    ++y;56  }57#endif // OMP5058 59  return 0;60}61