| 1 | // RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=45 %s |
| 2 | |
| 3 | // RUN: %clang_cc1 -verify -fopenmp-simd -fopenmp-version=45 %s |
| 4 | |
| 5 | void foo() { |
| 6 | } |
| 7 | |
| 8 | bool 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}} |
| 15 | int tmain(T argc, S **argv) { |
| 16 | int i; |
| 17 | #pragma omp target teams distribute if // expected-error {{expected '(' after 'if'}} |
| 18 | for (i = 0; i < argc; ++i) foo(); |
| 19 | |
| 20 | #pragma omp target teams distribute if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 21 | for (i = 0; i < argc; ++i) foo(); |
| 22 | |
| 23 | #pragma omp target teams distribute if () // expected-error {{expected expression}} |
| 24 | for (i = 0; i < argc; ++i) foo(); |
| 25 | |
| 26 | #pragma omp target teams distribute if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 27 | for (i = 0; i < argc; ++i) foo(); |
| 28 | |
| 29 | #pragma omp target teams distribute if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}} |
| 30 | for (i = 0; i < argc; ++i) foo(); |
| 31 | |
| 32 | #pragma omp target teams distribute if (argc > 0 ? argv[1] : argv[2]) |
| 33 | for (i = 0; i < argc; ++i) foo(); |
| 34 | |
| 35 | #pragma omp target teams distribute if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target teams distribute' cannot contain more than one 'if' clause}} |
| 36 | for (i = 0; i < argc; ++i) foo(); |
| 37 | |
| 38 | #pragma omp target teams distribute if (S) // expected-error {{'S' does not refer to a value}} |
| 39 | for (i = 0; i < argc; ++i) foo(); |
| 40 | |
| 41 | #pragma omp target teams distribute if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 42 | for (i = 0; i < argc; ++i) foo(); |
| 43 | |
| 44 | #pragma omp target teams distribute if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 45 | for (i = 0; i < argc; ++i) foo(); |
| 46 | |
| 47 | #pragma omp target teams distribute if(argc) |
| 48 | for (i = 0; i < argc; ++i) foo(); |
| 49 | |
| 50 | #pragma omp target teams distribute if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 51 | for (i = 0; i < argc; ++i) foo(); |
| 52 | |
| 53 | #pragma omp target teams distribute if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 54 | for (i = 0; i < argc; ++i) foo(); |
| 55 | |
| 56 | #pragma omp target teams distribute if(target : argc) |
| 57 | for (i = 0; i < argc; ++i) foo(); |
| 58 | |
| 59 | #pragma omp target teams distribute if(teams: argc) // expected-error {{directive name modifier 'teams' is not allowed for '#pragma omp target teams distribute'}} |
| 60 | for (i = 0; i < argc; ++i) foo(); |
| 61 | |
| 62 | #pragma omp target teams distribute if(distribute: argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}} |
| 63 | for (i = 0; i < argc; ++i) foo(); |
| 64 | |
| 65 | #pragma omp target teams distribute if(argc) if(teams: argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{directive name modifier 'teams' is not allowed for '#pragma omp target teams distribute'}} expected-error {{no more 'if' clause is allowed}} |
| 66 | for (i = 0; i < argc; ++i) foo(); |
| 67 | |
| 68 | #pragma omp target teams distribute if(argc) if(distribute: argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}} expected-error {{no more 'if' clause is allowed}} |
| 69 | for (i = 0; i < argc; ++i) foo(); |
| 70 | |
| 71 | #pragma omp target teams distribute if(distribute: argc) if (for:argc) // expected-error {{directive name modifier 'for' is not allowed for '#pragma omp target teams distribute'}} expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}} |
| 72 | for (i = 0; i < argc; ++i) foo(); |
| 73 | |
| 74 | #pragma omp target teams distribute if(target : argc) if (target :argc) // expected-error {{directive '#pragma omp target teams distribute' cannot contain more than one 'if' clause with 'target' name modifier}} |
| 75 | for (i = 0; i < argc; ++i) foo(); |
| 76 | |
| 77 | #pragma omp target teams distribute if(target : argc) if (argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{no more 'if' clause is allowed}} |
| 78 | for (i = 0; i < argc; ++i) foo(); |
| 79 | |
| 80 | #pragma omp target teams distribute if(target : argc) if(distribute: argc) if (argc) // expected-note 2 {{previous clause with directive name modifier specified here}} expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}} expected-error {{expected one of directive name modifiers}} |
| 81 | for (i = 0; i < argc; ++i) foo(); |
| 82 | |
| 83 | return 0; |
| 84 | } |
| 85 | |
| 86 | int main(int argc, char **argv) { |
| 87 | int i; |
| 88 | #pragma omp target teams distribute if // expected-error {{expected '(' after 'if'}} |
| 89 | for (i = 0; i < argc; ++i) foo(); |
| 90 | |
| 91 | #pragma omp target teams distribute if ( // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 92 | for (i = 0; i < argc; ++i) foo(); |
| 93 | |
| 94 | #pragma omp target teams distribute if () // expected-error {{expected expression}} |
| 95 | for (i = 0; i < argc; ++i) foo(); |
| 96 | |
| 97 | #pragma omp target teams distribute if (argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 98 | for (i = 0; i < argc; ++i) foo(); |
| 99 | |
| 100 | #pragma omp target teams distribute if (argc)) // expected-warning {{extra tokens at the end of '#pragma omp target teams distribute' are ignored}} |
| 101 | for (i = 0; i < argc; ++i) foo(); |
| 102 | |
| 103 | #pragma omp target teams distribute if (argc > 0 ? argv[1] : argv[2]) |
| 104 | for (i = 0; i < argc; ++i) foo(); |
| 105 | |
| 106 | #pragma omp target teams distribute if (foobool(argc)), if (true) // expected-error {{directive '#pragma omp target teams distribute' cannot contain more than one 'if' clause}} |
| 107 | for (i = 0; i < argc; ++i) foo(); |
| 108 | |
| 109 | #pragma omp target teams distribute if (S1) // expected-error {{'S1' does not refer to a value}} |
| 110 | for (i = 0; i < argc; ++i) foo(); |
| 111 | |
| 112 | #pragma omp target teams distribute if (argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 113 | for (i = 0; i < argc; ++i) foo(); |
| 114 | |
| 115 | #pragma omp target teams distribute if (argc argc) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 116 | for (i = 0; i < argc; ++i) foo(); |
| 117 | |
| 118 | #pragma omp target teams distribute if (1 0) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 119 | for (i = 0; i < argc; ++i) foo(); |
| 120 | |
| 121 | #pragma omp target teams distribute if(if(tmain(argc, argv) // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 122 | for (i = 0; i < argc; ++i) foo(); |
| 123 | |
| 124 | #pragma omp target teams distribute if(target : // expected-error {{expected expression}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 125 | for (i = 0; i < argc; ++i) foo(); |
| 126 | |
| 127 | #pragma omp target teams distribute if(target : argc // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 128 | for (i = 0; i < argc; ++i) foo(); |
| 129 | |
| 130 | #pragma omp target teams distribute if(teams : argc) // expected-error {{directive name modifier 'teams' is not allowed for '#pragma omp target teams distribute'}} |
| 131 | for (i = 0; i < argc; ++i) foo(); |
| 132 | |
| 133 | #pragma omp target teams distribute if(distribute : argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}} |
| 134 | for (i = 0; i < argc; ++i) foo(); |
| 135 | |
| 136 | #pragma omp target teams distribute if(target : argc) if (distribute :argc) // expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}} |
| 137 | for (i = 0; i < argc; ++i) foo(); |
| 138 | |
| 139 | #pragma omp target teams distribute if(target : argc) if (target :argc) // expected-error {{directive '#pragma omp target teams distribute' cannot contain more than one 'if' clause with 'target' name modifier}} |
| 140 | for (i = 0; i < argc; ++i) foo(); |
| 141 | |
| 142 | #pragma omp target teams distribute if(target : argc) if (argc) // expected-error {{no more 'if' clause is allowed}} expected-note {{previous clause with directive name modifier specified here}} |
| 143 | for (i = 0; i < argc; ++i) foo(); |
| 144 | |
| 145 | #pragma omp target teams distribute if(argc) if(teams: argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{directive name modifier 'teams' is not allowed for '#pragma omp target teams distribute'}} expected-error {{no more 'if' clause is allowed}} |
| 146 | for (i = 0; i < argc; ++i) foo(); |
| 147 | |
| 148 | #pragma omp target teams distribute if(argc) if(distribute: argc) // expected-note {{previous clause with directive name modifier specified here}} expected-error {{directive name modifier 'distribute' is not allowed for '#pragma omp target teams distribute'}} expected-error {{no more 'if' clause is allowed}} |
| 149 | for (i = 0; i < argc; ++i) foo(); |
| 150 | |
| 151 | return tmain(argc, argv); |
| 152 | } |
| 153 | |