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