Alexey Bataev | db39021 | 2015-05-20 04:24:19 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 -verify -fopenmp %s |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 2 | |
Alexey Bataev | a8a9153a | 2017-12-29 18:07:07 +0000 | [diff] [blame] | 3 | // RUN: %clang_cc1 -verify -fopenmp-simd %s |
| 4 | |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 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, typename S, int N, int ST> // expected-note {{declared here}} |
| 15 | T tmain(T argc, S **argv) { |
| 16 | #pragma omp for schedule // expected-error {{expected '(' after 'schedule'}} |
| 17 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 18 | #pragma omp for schedule ( // expected-error {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 19 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 20 | #pragma omp for schedule () // expected-error {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 21 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 22 | #pragma omp for schedule (auto // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 23 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 24 | #pragma omp for schedule (monotonic // expected-error {{expected ')'}} expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}} expected-warning {{missing ':' after schedule modifier - ignoring}} expected-note {{to match this '('}} |
| 25 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 26 | #pragma omp for schedule (auto_dynamic // expected-error {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 27 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 28 | #pragma omp for schedule (nonmonotonic, // expected-error {{expected ')'}} expected-error {{expected 'simd' in OpenMP clause 'schedule'}} expected-warning {{missing ':' after schedule modifier - ignoring}} expected-note {{to match this '('}} |
| 29 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 30 | #pragma omp for schedule (simd: // expected-error {{expected ')'}} expected-error {{expected 'static', 'dynamic', 'guided', 'auto' or 'runtime' in OpenMP clause 'schedule'}} expected-note {{to match this '('}} |
| 31 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 32 | #pragma omp for schedule (monotonic, auto // expected-error {{expected ')'}} expected-warning {{missing ':' after schedule modifier - ignoring}} expected-error {{expected 'simd' in OpenMP clause 'schedule'}} expected-note {{to match this '('}} |
| 33 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 34 | #pragma omp for schedule (nonmonotonic: auto, // expected-error {{expected ')'}} expected-error {{'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind}} expected-note {{to match this '('}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 35 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 36 | #pragma omp for schedule (auto, // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 37 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 38 | #pragma omp for schedule (runtime, 3) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 39 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 40 | // expected-error@+1 {{expected ')'}} expected-note@+1 {{to match this '('}} |
| 41 | #pragma omp for schedule (guided argc |
| 42 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 43 | // expected-error@+1 2 {{argument to 'schedule' clause must be a strictly positive integer value}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 44 | #pragma omp for schedule (static, ST // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 45 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 46 | #pragma omp for schedule (dynamic, 1)) // expected-warning {{extra tokens at the end of '#pragma omp for' are ignored}} |
| 47 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 48 | #pragma omp for schedule (guided, (ST > 0) ? 1 + ST : 2) |
| 49 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 50 | // expected-error@+2 2 {{directive '#pragma omp for' cannot contain more than one 'schedule' clause}} |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 51 | // expected-error@+1 {{argument to 'schedule' clause must be a strictly positive integer value}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 52 | #pragma omp for schedule (static, foobool(argc)), schedule (dynamic, true), schedule (guided, -5) |
| 53 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
Alexey Bataev | 6b8046a | 2015-09-03 07:23:48 +0000 | [diff] [blame] | 54 | #pragma omp for schedule (static, S) // expected-error {{'S' does not refer to a value}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 55 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 56 | // expected-error@+1 2 {{expression must have integral or unscoped enumeration type, not 'char *'}} |
| 57 | #pragma omp for schedule (guided, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 58 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 59 | #pragma omp for schedule (dynamic, 1) |
| 60 | for (int i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 61 | #pragma omp for schedule (static, N) // expected-error {{argument to 'schedule' clause must be a strictly positive integer value}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 62 | for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 63 | #pragma omp for schedule (nonmonotonic: static) // expected-error {{'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind}} |
| 64 | for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 65 | #pragma omp for schedule (nonmonotonic: auto) // expected-error {{'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind}} |
| 66 | for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 67 | #pragma omp for schedule (nonmonotonic: runtime) // expected-error {{'nonmonotonic' modifier can only be specified with 'dynamic' or 'guided' schedule kind}} |
| 68 | for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 69 | #pragma omp for schedule (monotonic, nonmonotonic: auto) // expected-error {{modifier 'nonmonotonic' cannot be used along with modifier 'monotonic'}} |
| 70 | for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 71 | #pragma omp for schedule (nonmonotonic, monotonic: auto) // expected-error {{modifier 'monotonic' cannot be used along with modifier 'nonmonotonic'}} |
| 72 | for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 73 | #pragma omp for schedule (nonmonotonic, nonmonotonic: auto) // expected-error {{modifier 'nonmonotonic' cannot be used along with modifier 'nonmonotonic'}} |
| 74 | for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 75 | #pragma omp for schedule (monotonic, monotonic: auto) // expected-error {{modifier 'monotonic' cannot be used along with modifier 'monotonic'}} |
| 76 | for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 77 | #pragma omp for schedule (nonmonotonic: guided) ordered // expected-error {{'schedule' clause with 'nonmonotonic' modifier cannot be specified if an 'ordered' clause is specified}} |
| 78 | for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
| 79 | #pragma omp for ordered(1) schedule(nonmonotonic: dynamic) // expected-error {{'schedule' clause with 'nonmonotonic' modifier cannot be specified if an 'ordered' clause is specified}} |
| 80 | for (T i = ST; i < N; i++) argv[0][i] = argv[0][i] - argv[0][i-ST]; |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 81 | return argc; |
| 82 | } |
| 83 | |
| 84 | int main(int argc, char **argv) { |
| 85 | #pragma omp for schedule // expected-error {{expected '(' after 'schedule'}} |
| 86 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 87 | #pragma omp for schedule ( // expected-error {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 88 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 89 | #pragma omp for schedule () // expected-error {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 90 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 91 | #pragma omp for schedule (auto // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 92 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
Alexey Bataev | 6402bca | 2015-12-28 07:25:51 +0000 | [diff] [blame] | 93 | #pragma omp for schedule (auto_dynamic // expected-error {{expected 'static', 'dynamic', 'guided', 'auto', 'runtime', 'monotonic', 'nonmonotonic' or 'simd' in OpenMP clause 'schedule'}} expected-error {{expected ')'}} expected-note {{to match this '('}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 94 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 95 | #pragma omp for schedule (auto, // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 96 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 97 | #pragma omp for schedule (runtime, 3) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 98 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 99 | #pragma omp for schedule (guided, 4 // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 100 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 101 | #pragma omp for schedule (static, 2+2)) // expected-warning {{extra tokens at the end of '#pragma omp for' are ignored}} |
| 102 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 103 | #pragma omp for schedule (dynamic, foobool(1) > 0 ? 1 : 2) |
| 104 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 105 | // expected-error@+2 2 {{directive '#pragma omp for' cannot contain more than one 'schedule' clause}} |
Alexey Bataev | a056935 | 2015-12-01 10:17:31 +0000 | [diff] [blame] | 106 | // expected-error@+1 {{argument to 'schedule' clause must be a strictly positive integer value}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 107 | #pragma omp for schedule (guided, foobool(argc)), schedule (static, true), schedule (dynamic, -5) |
| 108 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
Alexey Bataev | 6b8046a | 2015-09-03 07:23:48 +0000 | [diff] [blame] | 109 | #pragma omp for schedule (guided, S1) // expected-error {{'S1' does not refer to a value}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 110 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 111 | // expected-error@+1 {{expression must have integral or unscoped enumeration type, not 'char *'}} |
| 112 | #pragma omp for schedule (static, argv[1]=2) // expected-error {{expected ')'}} expected-note {{to match this '('}} |
| 113 | for (int i = 4; i < 12; i++) argv[0][i] = argv[0][i] - argv[0][i-4]; |
| 114 | // expected-error@+3 {{statement after '#pragma omp for' must be a for loop}} |
| 115 | // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, -1, -2>' requested here}} |
Alexey Bataev | 6b8046a | 2015-09-03 07:23:48 +0000 | [diff] [blame] | 116 | #pragma omp for schedule(dynamic, schedule(tmain<int, char, -1, -2>(argc, argv) // expected-error 2 {{expected ')'}} expected-note 2 {{to match this '('}} |
Alexey Bataev | 56dafe8 | 2014-06-20 07:16:17 +0000 | [diff] [blame] | 117 | foo(); |
| 118 | // expected-note@+1 {{in instantiation of function template specialization 'tmain<int, char, 1, 0>' requested here}} |
| 119 | return tmain<int, char, 1, 0>(argc, argv); |
| 120 | } |
| 121 | |