1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 -o - %s -Wuninitialized 2 3 // RUN: %clang_cc1 -verify -fopenmp-simd -ferror-limit 100 -o - %s -Wuninitialized 4 5 void foo(); 6 7 template <class T, int N> 8 T tmain(T argc) { 9 int i; 10 #pragma omp target 11 #pragma omp teams 12 #pragma omp distribute parallel for simd default // expected-error {{expected '(' after 'default'}} 13 for (i = 0; i < argc; ++i) 14 foo(); 15 #pragma omp target 16 #pragma omp teams 17 #pragma omp distribute parallel for simd default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}} 18 for (i = 0; i < argc; ++i) 19 foo(); 20 #pragma omp target 21 #pragma omp teams 22 #pragma omp distribute parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} 23 for (i = 0; i < argc; ++i) 24 foo(); 25 #pragma omp target 26 #pragma omp teams 27 #pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note 2 {{explicit data sharing attribute requested here}} 28 for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} 29 foo(); 30 #pragma omp target 31 #pragma omp teams 32 #pragma omp distribute parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'default' clause}} 33 for (i = 0; i < argc; ++i) 34 foo(); 35 #pragma omp target 36 #pragma omp teams 37 #pragma omp distribute parallel for simd default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} 38 for (i = 0; i < argc; ++i) 39 foo(); 40 #pragma omp target 41 #pragma omp teams 42 #pragma omp distribute parallel for simd default(none) // expected-note 2 {{explicit data sharing attribute requested here}} 43 for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} 44 foo(); 45 46 #pragma omp parallel default(none) // expected-note 4 {{explicit data sharing attribute requested here}} 47 #pragma omp target 48 #pragma omp teams 49 #pragma omp distribute parallel for simd default(shared) 50 for (i = 0; i < argc; ++i) // expected-error 2 {{variable 'argc' must have explicitly specified data sharing attributes}} expected-error 2 {{variable 'i' must have explicitly specified data sharing attributes}} 51 foo(); 52 53 return T(); 54 } 55 main(int argc,char ** argv)56int main(int argc, char **argv) { 57 int i; 58 #pragma omp target 59 #pragma omp teams 60 #pragma omp distribute parallel for simd default // expected-error {{expected '(' after 'default'}} 61 for (i = 0; i < argc; ++i) 62 foo(); 63 #pragma omp target 64 #pragma omp teams 65 #pragma omp distribute parallel for simd default( // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} expected-error {{expected ')'}} expected-note {{to match this '('}} 66 for (i = 0; i < argc; ++i) 67 foo(); 68 #pragma omp target 69 #pragma omp teams 70 #pragma omp distribute parallel for simd default() // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} 71 for (i = 0; i < argc; ++i) 72 foo(); 73 #pragma omp target 74 #pragma omp teams 75 #pragma omp distribute parallel for simd default(none // expected-error {{expected ')'}} expected-note {{to match this '('}} expected-note {{explicit data sharing attribute requested here}} 76 for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} 77 foo(); 78 #pragma omp target 79 #pragma omp teams 80 #pragma omp distribute parallel for simd default(shared), default(shared) // expected-error {{directive '#pragma omp distribute parallel for simd' cannot contain more than one 'default' clause}} 81 for (i = 0; i < argc; ++i) 82 foo(); 83 #pragma omp target 84 #pragma omp teams 85 #pragma omp distribute parallel for simd default(x) // expected-error {{expected 'none' or 'shared' in OpenMP clause 'default'}} 86 for (i = 0; i < argc; ++i) 87 foo(); 88 #pragma omp target 89 #pragma omp teams 90 #pragma omp distribute parallel for simd default(none) // expected-note {{explicit data sharing attribute requested here}} 91 for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} 92 foo(); 93 94 #pragma omp parallel default(none) // expected-note 2 {{explicit data sharing attribute requested here}} 95 #pragma omp target 96 #pragma omp teams 97 #pragma omp distribute parallel for simd default(shared) 98 for (i = 0; i < argc; ++i) // expected-error {{variable 'argc' must have explicitly specified data sharing attributes}} expected-error {{variable 'i' must have explicitly specified data sharing attributes}} 99 foo(); 100 101 return (tmain<int, 5>(argc) + tmain<char, 1>(argv[0][0])); // expected-note {{in instantiation of function template specialization 'tmain<int, 5>' requested here}} expected-note {{in instantiation of function template specialization 'tmain<char, 1>' requested here}} 102 } 103