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