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