Stephen Hines | 651f13c | 2014-04-23 16:59:28 -0700 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fopenmp=libiomp5 -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 parallel if // expected-error {{expected '(' after 'if'}} |
| 15 | #pragma omp parallel if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 16 | #pragma omp parallel if () // expected-error {{expected expression}} |
| 17 | #pragma omp parallel if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 18 | #pragma omp parallel if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} |
| 19 | #pragma omp parallel if (argc > 0 ? argv[1] : argv[2]) |
| 20 | #pragma omp parallel if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel' cannot contain more than one 'if' clause}} |
| 21 | #pragma omp parallel if (S) // expected-error {{'S' does not refer to a value}} |
| 22 | #pragma omp parallel if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 23 | #pragma omp parallel if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 24 | #pragma omp parallel if(argc) |
| 25 | foo(); |
| 26 | |
| 27 | return 0; |
| 28 | } |
| 29 | |
| 30 | int main(int argc, char **argv) { |
| 31 | #pragma omp parallel if // expected-error {{expected '(' after 'if'}} |
| 32 | #pragma omp parallel if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 33 | #pragma omp parallel if () // expected-error {{expected expression}} |
| 34 | #pragma omp parallel if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 35 | #pragma omp parallel if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp parallel' are ignored}} |
| 36 | #pragma omp parallel if (argc > 0 ? argv[1] : argv[2]) |
| 37 | #pragma omp parallel if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp parallel' cannot contain more than one 'if' clause}} |
| 38 | #pragma omp parallel if (S1) // expected-error {{'S1' does not refer to a value}} |
| 39 | #pragma omp parallel if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 40 | #pragma omp parallel if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 41 | #pragma omp parallel if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 42 | #pragma omp parallel if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 43 | foo(); |
| 44 | |
| 45 | return tmain(argc, argv); |
| 46 | } |