| 1 |
// RUN: %clang_cc1 -verify -fopenmp -fopenmp-version=52 %s |
| 2 |
|
| 3 |
typedef enum omp_allocator_handle_t { |
| 4 |
omp_null_allocator = 0, |
| 5 |
omp_default_mem_alloc = 1, |
| 6 |
omp_large_cap_mem_alloc = 2, |
| 7 |
omp_const_mem_alloc = 3, |
| 8 |
omp_high_bw_mem_alloc = 4, |
| 9 |
omp_low_lat_mem_alloc = 5, |
| 10 |
omp_cgroup_mem_alloc = 6, |
| 11 |
omp_pteam_mem_alloc = 7, |
| 12 |
omp_thread_mem_alloc = 8, |
| 13 |
} omp_allocator_handle_t; |
| 14 |
|
| 15 |
int myAlloc() { |
| 16 |
return 100; |
| 17 |
} |
| 18 |
|
| 19 |
int main() { |
| 20 |
int a, b, c; |
| 21 |
// expected-error@+4 {{expected '('}} |
| 22 |
// expected-error@+3 {{expected expression}} |
| 23 |
// expected-error@+2 {{expected ')'}} |
| 24 |
// expected-note@+1 {{to match this '('}} |
| 25 |
#pragma omp scope private(c) allocate(allocator |
| 26 |
// expected-error@+6 {{expected expression}} |
| 27 |
// expected-error@+5 {{expected ')'}} |
| 28 |
// expected-note@+4 {{to match this '('}} |
| 29 |
// expected-error@+3 {{expected expression}} |
| 30 |
// expected-error@+2 {{expected ')'}} |
| 31 |
// expected-note@+1 {{to match this '('}} |
| 32 |
#pragma omp scope private(c) allocate(allocator( |
| 33 |
// expected-error@+4 {{expected expression}} |
| 34 |
// expected-error@+3 {{expected expression}} |
| 35 |
// expected-error@+2 {{expected ')'}} |
| 36 |
// expected-note@+1 {{to match this '('}} |
| 37 |
#pragma omp scope private(c) allocate(allocator() |
| 38 |
// expected-error@+2 {{expected expression}} |
| 39 |
// expected-error@+1 {{expected expression}} |
| 40 |
#pragma omp scope private(c) allocate(allocator()) |
| 41 |
// expected-error@+6 {{expected ')'}} |
| 42 |
// expected-note@+5 {{to match this '('}} |
| 43 |
// expected-error@+4 {{missing ':' after allocate clause modifier}} |
| 44 |
// expected-error@+3 {{expected expression}} |
| 45 |
// expected-error@+2 {{expected ')'}} |
| 46 |
// expected-note@+1 {{to match this '('}} |
| 47 |
#pragma omp scope private(c) allocate(allocator(omp_default_mem_alloc |
| 48 |
// expected-error@+6 {{missing ':' after allocate clause modifier}} |
| 49 |
// expected-error@+5 {{expected expression}} |
| 50 |
// expected-error@+4 {{expected ')'}} |
| 51 |
// expected-note@+3 {{to match this '('}} |
| 52 |
// expected-error@+2 {{expected ')'}} |
| 53 |
// expected-note@+1 {{to match this '('}} |
| 54 |
#pragma omp scope private(c) allocate(allocator(omp_large_cap_mem_alloc: |
| 55 |
// expected-error@+4 {{missing ':' after allocate clause modifier}} |
| 56 |
// expected-error@+3 {{expected expression}} |
| 57 |
// expected-error@+2 {{expected ')'}} |
| 58 |
// expected-note@+1 {{to match this '('}} |
| 59 |
#pragma omp scope private(c) allocate(allocator(omp_const_mem_alloc) |
| 60 |
// expected-error@+2 {{missing ':' after allocate clause modifier}} |
| 61 |
// expected-error@+1 {{expected expression}} |
| 62 |
#pragma omp scope private(c) allocate(allocator(omp_high_bw_mem_alloc)) |
| 63 |
// expected-error@+1 {{expected expression}} |
| 64 |
#pragma omp scope private(c) allocate(allocator(omp_low_lat_mem_alloc):) |
| 65 |
// expected-error@+6 {{expected ')'}} |
| 66 |
// expected-note@+5 {{to match this '('}} |
| 67 |
// expected-error@+4 {{missing ':' after allocate clause modifier}} |
| 68 |
// expected-error@+3 {{expected expression}} |
| 69 |
// expected-error@+2 {{expected ')'}} |
| 70 |
// expected-note@+1 {{to match this '('}} |
| 71 |
#pragma omp scope private(c) allocate(allocator(omp_cgroup_mem_alloc:) |
| 72 |
// expected-error@+4 {{expected ')'}} |
| 73 |
// expected-note@+3 {{to match this '('}} |
| 74 |
// expected-error@+2 {{missing ':' after allocate clause modifier}} |
| 75 |
// expected-error@+1 {{expected expression}} |
| 76 |
#pragma omp scope private(c) allocate(allocator(omp_pteam_mem_alloc:)) |
| 77 |
// expected-error@+4 {{expected ')'}} |
| 78 |
// expected-note@+3 {{to match this '('}} |
| 79 |
// expected-error@+2 {{missing ':' after allocate clause modifier}} |
| 80 |
// expected-error@+1 {{expected expression}} |
| 81 |
#pragma omp scope private(c) allocate(allocator(omp_thread_mem_alloc:c)) |
| 82 |
// expected-error@+1 {{expected variable name}} |
| 83 |
#pragma omp scope private(c) allocate(allocator(omp_const_mem_alloc):1) |
| 84 |
// expected-error@+1 {{expected variable name}} |
| 85 |
#pragma omp scope private(c) allocate(allocator(omp_const_mem_alloc):-10) |
| 86 |
// expected-error@+4 {{expected ',' or ')' in 'allocate' clause}} |
| 87 |
// expected-error@+3 {{expected ')'}} |
| 88 |
// expected-warning@+2 {{extra tokens at the end of '#pragma omp scope' are ignored}} |
| 89 |
// expected-note@+1 {{to match this '('}} |
| 90 |
#pragma omp scope private(a,b,c) allocate(allocator(omp_const_mem_alloc):c:b;a) |
| 91 |
// expected-error@+1 {{initializing 'const omp_allocator_handle_t' (aka 'const enum omp_allocator_handle_t') with an expression of incompatible type 'int'}} |
| 92 |
#pragma omp scope private(c,a,b) allocate(allocator(myAlloc()):a,b,c) |
| 93 |
// expected-error@+2 {{missing ':' after allocate clause modifier}} |
| 94 |
// expected-error@+1 {{expected expression}} |
| 95 |
#pragma omp scope private(c) allocate(allocator(omp_default_mem_alloc);c) |
| 96 |
// expected-error@+2 {{duplicate modifier 'allocator' in 'allocate' clause}} |
| 97 |
// expected-warning@+1 {{aligned clause will be ignored because the requested alignment is not a power of 2}} |
| 98 |
#pragma omp scope private(a) allocate(allocator(omp_default_mem_alloc), allocator(omp_default_mem_alloc), align(3) : a) |
| 99 |
// expected-error@+4 {{expected '('}} |
| 100 |
// expected-error@+3 {{expected expression}} |
| 101 |
// expected-error@+2 {{expected ')'}} |
| 102 |
// expected-note@+1 {{to match this '('}} |
| 103 |
#pragma omp scope private(a) allocate(allocator |
| 104 |
// expected-error@+4 {{expected '('}} |
| 105 |
// expected-error@+3 {{expected expression}} |
| 106 |
// expected-error@+2 {{expected ')'}} |
| 107 |
// expected-note@+1 {{to match this '('}} |
| 108 |
#pragma omp scope private(b) allocate(align |
| 109 |
// expected-error@+1 {{duplicate modifier 'align' in 'allocate' clause}} |
| 110 |
#pragma omp scope private(a) allocate(align(8), align(4) : a) |
| 111 |
// expected-error@+5 {{use of undeclared identifier 'align'}} |
| 112 |
// expected-error@+4 {{expected ',' or ')' in 'allocate' clause}} |
| 113 |
// expected-error@+3 {{expected ')'}} |
| 114 |
// expected-note@+2 {{to match this '('}} |
| 115 |
// expected-error@+1 {{expected variable name}} |
| 116 |
#pragma omp scope private(a) allocate(omp_default_mem_alloc, align(8) : a) |
| 117 |
// expected-error@+3 {{expected modifier in 'allocate' clause}} |
| 118 |
// expected-error@+2 {{missing ':' after allocate clause modifier}} |
| 119 |
// expected-error@+1 {{expected expression}} |
| 120 |
#pragma omp scope private(a) allocate(align(8), omp_default_mem_alloc : a) |
| 121 |
// expected-error@+5 {{expected ',' or ')' in 'allocate' clause}} |
| 122 |
// expected-error@+4 {{expected ')'}} |
| 123 |
// expected-note@+3 {{to match this '('}} |
| 124 |
// expected-error@+2 {{expected variable name}} |
| 125 |
// expected-error@+1 {{expected variable name}} |
| 126 |
#pragma omp scope private(a) allocate(omp_default_mem_alloc, omp_default_mem_alloc : a) |
| 127 |
// expected-error@+2 {{use of undeclared identifier 'undefinedVar'}} |
| 128 |
// expected-error@+1 {{expected expression}} |
| 129 |
#pragma omp scope private(a) allocate(undefinedVar : a) |
| 130 |
// expected-error@+1 {{expected expression}} |
| 131 |
#pragma omp scope private(a) allocate(align(8), allocator(omp_default_mem_alloc) : ) |
| 132 |
// expected-error@+2 {{missing ':' after allocate clause modifier}} |
| 133 |
// expected-error@+1 {{expected expression}} |
| 134 |
#pragma omp scope private(a) allocate(align(8), allocator(omp_default_mem_alloc) ) |
| 135 |
// expected-error@+3 {{expected expression}} |
| 136 |
// expected-error@+2 {{expected ')'}} |
| 137 |
// expected-note@+1 {{to match this '('}} |
| 138 |
#pragma omp scope private(a) allocate(align(8), allocator(omp_default_mem_alloc) : |
| 139 |
|
| 140 |
// expected-error@+4 {{missing ':' after allocate clause modifier}} |
| 141 |
// expected-error@+3 {{expected expression}} |
| 142 |
// expected-error@+2 {{expected ')'}} |
| 143 |
// expected-note@+1 {{to match this '('}} |
| 144 |
#pragma omp scope private(a) allocate(align(8), allocator(omp_default_mem_alloc) |
| 145 |
// expected-error@+4 {{expected '('}} |
| 146 |
// expected-error@+3 {{expected '('}} |
| 147 |
// expected-error@+2 {{expected expression}} |
| 148 |
// expected-error@+1 {{use of undeclared identifier 'allocator'}} |
| 149 |
#pragma omp scope private(a) allocate(align, allocator : ) |
| 150 |
// expected-error@+7 {{expected expression}} |
| 151 |
// expected-error@+6 {{expected expression}} |
| 152 |
// expected-error@+5 {{expected expression}} |
| 153 |
// expected-error@+4 {{use of undeclared identifier 'allocator'}} |
| 154 |
// expected-error@+3 {{expected ',' or ')' in 'allocate' clause}} |
| 155 |
// expected-error@+2 {{expected ')'}} |
| 156 |
// expected-note@+1 {{to match this '('}} |
| 157 |
#pragma omp scope private(a) allocate(align(), allocator() : ) |
| 158 |
++a; |
| 159 |
} |