1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s 2 foo()3void foo() { 4 } 5 foobool(int argc)6bool foobool(int argc) { 7 return argc; 8 } 9 10 struct S1; // expected-note {{declared here}} 11 12 template <class T, class S> // expected-note {{declared here}} tmain(T argc,S ** argv)13int tmain(T argc, S **argv) { 14 #pragma omp taskloop simd num_tasks // expected-error {{expected '(' after 'num_tasks'}} 15 for (int i = 0; i < 10; ++i) 16 foo(); 17 #pragma omp taskloop simd num_tasks ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 18 for (int i = 0; i < 10; ++i) 19 foo(); 20 #pragma omp taskloop simd num_tasks () // expected-error {{expected expression}} 21 for (int i = 0; i < 10; ++i) 22 foo(); 23 #pragma omp taskloop simd num_tasks (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 24 for (int i = 0; i < 10; ++i) 25 foo(); 26 #pragma omp taskloop simd num_tasks (argc)) // expected-warning {{extra tokens at the end of '#pragma omp taskloop simd' are ignored}} 27 for (int i = 0; i < 10; ++i) 28 foo(); 29 #pragma omp taskloop simd num_tasks (argc > 0 ? argv[1][0] : argv[2][argc]) 30 for (int i = 0; i < 10; ++i) 31 foo(); 32 #pragma omp taskloop simd num_tasks (foobool(argc)), num_tasks (true) // expected-error {{directive '#pragma omp taskloop simd' cannot contain more than one 'num_tasks' clause}} 33 for (int i = 0; i < 10; ++i) 34 foo(); 35 #pragma omp taskloop simd num_tasks (S) // expected-error {{'S' does not refer to a value}} 36 for (int i = 0; i < 10; ++i) 37 foo(); 38 #pragma omp taskloop simd num_tasks (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} 39 for (int i = 0; i < 10; ++i) 40 foo(); 41 #pragma omp taskloop simd num_tasks(0) // expected-error {{argument to 'num_tasks' clause must be a strictly positive integer value}} 42 for (int i = 0; i < 10; ++i) 43 foo(); 44 #pragma omp taskloop simd num_tasks(-1) // expected-error {{argument to 'num_tasks' clause must be a strictly positive integer value}} 45 for (int i = 0; i < 10; ++i) 46 foo(); 47 #pragma omp taskloop simd num_tasks(argc) grainsize(argc) // expected-error {{'grainsize' and 'num_tasks' clause are mutually exclusive and may not appear on the same directive}} expected-note {{'num_tasks' clause is specified here}} 48 for (int i = 0; i < 10; ++i) 49 foo(); 50 51 return 0; 52 } 53 main(int argc,char ** argv)54int main(int argc, char **argv) { 55 #pragma omp taskloop simd num_tasks // expected-error {{expected '(' after 'num_tasks'}} 56 for (int i = 0; i < 10; ++i) 57 foo(); 58 #pragma omp taskloop simd num_tasks ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 59 for (int i = 0; i < 10; ++i) 60 foo(); 61 #pragma omp taskloop simd num_tasks () // expected-error {{expected expression}} 62 for (int i = 0; i < 10; ++i) 63 foo(); 64 #pragma omp taskloop simd num_tasks (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} 65 for (int i = 0; i < 10; ++i) 66 foo(); 67 #pragma omp taskloop simd num_tasks (argc)) // expected-warning {{extra tokens at the end of '#pragma omp taskloop simd' are ignored}} 68 for (int i = 0; i < 10; ++i) 69 foo(); 70 #pragma omp taskloop simd num_tasks (argc > 0 ? argv[1][0] : argv[2][argc]) 71 for (int i = 0; i < 10; ++i) 72 foo(); 73 #pragma omp taskloop simd num_tasks (foobool(argc)), num_tasks (true) // expected-error {{directive '#pragma omp taskloop simd' cannot contain more than one 'num_tasks' clause}} 74 for (int i = 0; i < 10; ++i) 75 foo(); 76 #pragma omp taskloop simd num_tasks (S1) // expected-error {{'S1' does not refer to a value}} 77 for (int i = 0; i < 10; ++i) 78 foo(); 79 #pragma omp taskloop simd num_tasks (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} 80 for (int i = 0; i < 10; ++i) 81 foo(); 82 #pragma omp taskloop simd num_tasks (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}} 83 for (int i = 0; i < 10; ++i) 84 foo(); 85 #pragma omp taskloop simd num_tasks(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} 86 for (int i = 0; i < 10; ++i) 87 foo(); 88 #pragma omp taskloop simd num_tasks(0) // expected-error {{argument to 'num_tasks' clause must be a strictly positive integer value}} 89 for (int i = 0; i < 10; ++i) 90 foo(); 91 #pragma omp taskloop simd num_tasks(-1) // expected-error {{argument to 'num_tasks' clause must be a strictly positive integer value}} 92 for (int i = 0; i < 10; ++i) 93 foo(); 94 #pragma omp taskloop simd num_tasks(argc) grainsize(argc) // expected-error {{'grainsize' and 'num_tasks' clause are mutually exclusive and may not appear on the same directive}} expected-note {{'num_tasks' clause is specified here}} 95 for (int i = 0; i < 10; ++i) 96 foo(); 97 98 return tmain(argc, argv); 99 } 100