| 1 |
/* { dg-do compile } */ |
| 2 |
/* { dg-options "-Wall -std=c17 -fopenmp -pedantic-errors" } */ |
| 3 |
|
| 4 |
void f1(void) |
| 5 |
{ |
| 6 |
#pragma omp barrier a /* { dg-error "expected end of line" } */ |
| 7 |
} |
| 8 |
|
| 9 |
/* OpenMP 2.5, section 2.7.3: |
| 10 |
|
| 11 |
Note that because the barrier construct does not have a C language |
| 12 |
statement as part of its syntax, there are some restrictions on its |
| 13 |
placement within a program. The barrier directive may only be placed |
| 14 |
in the program at a position where ignoring or deleting the directive |
| 15 |
would result in a program with correct syntax. */ |
| 16 |
|
| 17 |
void f2(void) |
| 18 |
{ |
| 19 |
label: /* { dg-warning "defined but not used" } */ |
| 20 |
#pragma omp barrier /* { dg-error "may only be used in compound statements" } */ |
| 21 |
} |
| 22 |
|
| 23 |
void f3(_Bool p) |
| 24 |
{ |
| 25 |
if (p) |
| 26 |
#pragma omp barrier /* { dg-error "compound statements" } */ |
| 27 |
} |