48 lines · cpp
1// RUN: %clang_cc1 -verify -fopenmp %s -Wuninitialized2 3// RUN: %clang_cc1 -verify -fopenmp-simd %s -Wuninitialized4 5// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=50 -DOMP50 %s -Wuninitialized6 7// RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=50 -DOMP50 %s -Wuninitialized8 9void foo();10 11namespace {12static int y = 0;13}14static int x = 0;15 16int main(int argc, char **argv) {17 #pragma omp target teams distribute default // expected-error {{expected '(' after 'default'}}18 for (int i=0; i<200; i++) foo();19#pragma omp target teams distribute 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 teams distribute 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 teams distribute default (none // expected-error {{expected ')'}} expected-note {{to match this '('}}24 for (int i=0; i<200; i++) foo();25 #pragma omp target teams distribute default (shared), default(shared) // expected-error {{directive '#pragma omp target teams distribute' cannot contain more than one 'default' clause}}26 for (int i=0; i<200; i++) foo();27#pragma omp target teams distribute default(x) // expected-error {{expected 'none', 'shared', 'private' or 'firstprivate' in OpenMP clause 'default'}}28 for (int i=0; i<200; i++) foo();29 30 #pragma omp target teams distribute default(none) // expected-note {{explicit data sharing attribute requested here}}31 for (int i=0; i<200; i++) ++argc; // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}}32 33#ifdef OMP5034#pragma omp target teams distribute default(firstprivate) // expected-error {{data-sharing attribute 'firstprivate' in 'default' clause requires OpenMP version 5.1 or above}}35 for (int i = 0; i < 200; i++) {36 ++x;37 ++y;38 }39#pragma omp target teams distribute default(private) // expected-error {{data-sharing attribute 'private' in 'default' clause requires OpenMP version 5.1 or above}}40 for (int i = 0; i < 200; i++) {41 ++x;42 ++y;43 }44#endif // OMP5045 46 return 0;47}48