Home | History | Annotate | Download | only in OpenMP
      1 // RUN: %clang_cc1 -verify -fopenmp -ferror-limit 100 %s
      2 
      3 void foo() {
      4 }
      5 
      6 bool 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}}
     13 int tmain(T argc, S **argv) {
     14 #pragma omp taskloop final // expected-error {{expected '(' after 'final'}}
     15   for (int i = 0; i < 10; ++i)
     16     foo();
     17 #pragma omp taskloop final( // 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 final() // expected-error {{expected expression}}
     21   for (int i = 0; i < 10; ++i)
     22     foo();
     23 #pragma omp taskloop final(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
     24   for (int i = 0; i < 10; ++i)
     25     foo();
     26 #pragma omp taskloop final(argc)) // expected-warning {{extra tokens at the end of '#pragma omp taskloop' are ignored}}
     27   for (int i = 0; i < 10; ++i)
     28     foo();
     29 #pragma omp taskloop final(argc > 0 ? argv[1] : argv[2])
     30   for (int i = 0; i < 10; ++i)
     31     foo();
     32 #pragma omp taskloop final(foobool(argc)), final(true) // expected-error {{directive '#pragma omp taskloop' cannot contain more than one 'final' clause}}
     33   for (int i = 0; i < 10; ++i)
     34     foo();
     35 #pragma omp taskloop final(S) // expected-error {{'S' does not refer to a value}}
     36   for (int i = 0; i < 10; ++i)
     37     foo();
     38 #pragma omp taskloop final(argv[1] = 2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     39   for (int i = 0; i < 10; ++i)
     40     foo();
     41 #pragma omp taskloop final(argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     42   for (int i = 0; i < 10; ++i)
     43     foo();
     44 #pragma omp taskloop final(argc)
     45   for (int i = 0; i < 10; ++i)
     46     foo();
     47 
     48   return 0;
     49 }
     50 
     51 int main(int argc, char **argv) {
     52 #pragma omp taskloop final // expected-error {{expected '(' after 'final'}}
     53   for (int i = 0; i < 10; ++i)
     54     foo();
     55 #pragma omp taskloop final( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}}
     56   for (int i = 0; i < 10; ++i)
     57     foo();
     58 #pragma omp taskloop final() // expected-error {{expected expression}}
     59   for (int i = 0; i < 10; ++i)
     60     foo();
     61 #pragma omp taskloop final(argc // expected-error {{expected ')'}} expected-note {{to match this '('}}
     62   for (int i = 0; i < 10; ++i)
     63     foo();
     64 #pragma omp taskloop final(argc)) // expected-warning {{extra tokens at the end of '#pragma omp taskloop' are ignored}}
     65   for (int i = 0; i < 10; ++i)
     66     foo();
     67 #pragma omp taskloop final(argc > 0 ? argv[1] : argv[2])
     68   for (int i = 0; i < 10; ++i)
     69     foo();
     70 #pragma omp taskloop final(foobool(argc)), final(true) // expected-error {{directive '#pragma omp taskloop' cannot contain more than one 'final' clause}}
     71   for (int i = 0; i < 10; ++i)
     72     foo();
     73 #pragma omp taskloop final(S1) // expected-error {{'S1' does not refer to a value}}
     74   for (int i = 0; i < 10; ++i)
     75     foo();
     76 #pragma omp taskloop final(argv[1] = 2) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     77   for (int i = 0; i < 10; ++i)
     78     foo();
     79 #pragma omp taskloop final(argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     80   for (int i = 0; i < 10; ++i)
     81     foo();
     82 #pragma omp taskloop final(1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}}
     83   for (int i = 0; i < 10; ++i)
     84     foo();
     85 #pragma omp taskloop final(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 
     89   return tmain(argc, argv);
     90 }
     91