| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-fopenmp -std=c23" } */ |
| 3 |
|
| 4 |
void |
| 5 |
foo (int x) |
| 6 |
{ |
| 7 |
[[omp::directive (parallel)]] |
| 8 |
#pragma omp for /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 9 |
for (int i = 0; i < 16; i++) |
| 10 |
; |
| 11 |
[[omp::directive (barrier)]] /* { dg-error "standalone OpenMP directives in 'omp::directive' attribute can only appear on an empty statement" } */ |
| 12 |
#pragma omp flush |
| 13 |
; |
| 14 |
#pragma omp parallel |
| 15 |
[[omp::directive (master)]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 16 |
; |
| 17 |
#pragma omp teams |
| 18 |
[[omp::sequence (directive (parallel), directive (master))]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 19 |
; |
| 20 |
#pragma omp task |
| 21 |
[[omp::directive (flush)]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 22 |
; |
| 23 |
#pragma omp master |
| 24 |
[[omp::directive (flush)]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 25 |
; |
| 26 |
#pragma omp for ordered |
| 27 |
for (int i = 0; i < 16; i++) |
| 28 |
#pragma omp ordered |
| 29 |
[[omp::directive (flush)]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 30 |
; |
| 31 |
#pragma omp single |
| 32 |
[[omp::directive (flush)]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 33 |
; |
| 34 |
#pragma omp taskgroup |
| 35 |
[[omp::directive (taskyield)]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 36 |
; |
| 37 |
#pragma omp target data map (tofrom: x) |
| 38 |
[[omp::directive (flush)]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 39 |
; |
| 40 |
#pragma omp target |
| 41 |
[[omp::directive (teams)]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 42 |
; |
| 43 |
[[omp::directive (parallel)]] |
| 44 |
#pragma omp master /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 45 |
[[omp::sequence (omp::directive (taskloop))]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 46 |
for (int i = 0; i < 16; i++) |
| 47 |
; |
| 48 |
#pragma omp parallel |
| 49 |
[[omp::directive (for)]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 50 |
for (int i = 0; i < 16; i++) |
| 51 |
; |
| 52 |
#pragma omp for |
| 53 |
[[omp::directive (master)]] /* { dg-error "loop nest expected before '\\\[' token" } */ |
| 54 |
; |
| 55 |
#pragma omp target teams |
| 56 |
[[omp::directive (parallel)]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 57 |
; |
| 58 |
#pragma omp parallel master |
| 59 |
[[omp::directive (taskloop)]] /* { dg-error "mixing OpenMP directives with attribute and pragma syntax on the same statement" } */ |
| 60 |
for (int i = 0; i < 16; i++) |
| 61 |
; |
| 62 |
} |