diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/gomp/attrs-21.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/gomp/attrs-21.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/gomp/attrs-21.c b/gcc/testsuite/gcc.dg/gomp/attrs-21.c new file mode 100644 index 0000000..bd8ff11 --- /dev/null +++ b/gcc/testsuite/gcc.dg/gomp/attrs-21.c @@ -0,0 +1,28 @@ +/* { dg-do compile } */ +/* { dg-options "-fopenmp -std=c2x" */ + +void +foo () +{ + [[omp::decl]] int v1; /* { dg-error "'omp::decl' attribute requires argument" } */ + [[omp::decl ()]] int v2; /* { dg-error "expected OpenMP directive name" } */ + /* { dg-error "'omp::directive' not allowed to be specified in this context" "" { target *-*-* } .-1 } */ + [[omp::decl (nonexistent foobar)]] int v3; /* { dg-error "unknown OpenMP directive name in 'omp::decl' attribute argument" } */ + /* { dg-error "'omp::directive' not allowed to be specified in this context" "" { target *-*-* } .-1 } */ + [[omp::sequence(decl(threadprivate))]] int v4; /* { dg-error "expected 'directive' or 'sequence'" } */ + /* { dg-error "'omp::directive' not allowed to be specified in this context" "" { target *-*-* } .-1 } */ + [[omp::sequence(omp::decl(threadprivate))]] int v5; /* { dg-error "expected 'directive' or 'sequence'" } */ + /* { dg-error "'omp::directive' not allowed to be specified in this context" "" { target *-*-* } .-1 } */ + [[omp::decl (barrier)]]; /* { dg-error "OpenMP 'omp::decl' attribute on a statement" } */ + [[omp::decl (parallel)]] {}; /* { dg-error "OpenMP 'omp::decl' attribute on a statement" } */ + extern int [[omp::decl (threadprivate)]] *v6; /* { dg-warning "'omp::directive' scoped attribute directive ignored" } */ + [[omp::decl (threadprivate (v5))]] static int v7; /* { dg-error "expected end of line before '\\\(' token" } */ + extern int v8; + [[omp::decl (declare target (v8))]] static int v9; /* { dg-error "expected end of line before '\\\(' token" } */ + [[omp::decl (declare target enter (v8))]] static int v10; /* { dg-error "expected an OpenMP clause before '\\\(' token" } */ + [[omp::decl (declare target, link (v9))]] static int v11; /* { dg-error "expected an OpenMP clause before '\\\(' token" } */ + [[omp::decl (declare target device_type (any))]] static int v12; /* { dg-error "directive with only 'device_type' clause" } */ +} + +int i; +[[omp::decl (assume (i < 42))]]; /* { dg-error "OpenMP 'omp::decl' attribute on a statement" } */ |