diff options
author | Paul-Antoine Arras <parras@baylibre.com> | 2025-01-06 18:38:11 +0100 |
---|---|---|
committer | Paul-Antoine Arras <parras@baylibre.com> | 2025-01-13 18:56:18 +0100 |
commit | 2ea4801cf7a4ebc0145b84f84ae7f4961e57b64f (patch) | |
tree | bb1d6c26dc857186ff7394848cdb2e80e6647ea5 /gcc/testsuite/c-c++-common/gomp | |
parent | ecf688edc217472774817cc1284e75a9f72fe1b4 (diff) | |
download | gcc-2ea4801cf7a4ebc0145b84f84ae7f4961e57b64f.zip gcc-2ea4801cf7a4ebc0145b84f84ae7f4961e57b64f.tar.gz gcc-2ea4801cf7a4ebc0145b84f84ae7f4961e57b64f.tar.bz2 |
Accept commas between clauses in OpenMP declare variant
Add support to the Fortran parser for the OpenMP syntax that allows a comma
after the directive name and between clauses of declare variant. The C and C++
parsers already support this syntax so only a new test is added.
gcc/fortran/ChangeLog:
* openmp.cc (gfc_match_omp_declare_variant): Match comma after directive
name and between clauses. Emit more useful diagnostics.
gcc/testsuite/ChangeLog:
* gfortran.dg/gomp/declare-variant-2.f90: Remove error test for a comma
after the directive name. Add tests for other invalid syntaxes (extra
comma and invalid clause).
* c-c++-common/gomp/adjust-args-5.c: New test.
* gfortran.dg/gomp/adjust-args-11.f90: New test.
Diffstat (limited to 'gcc/testsuite/c-c++-common/gomp')
-rw-r--r-- | gcc/testsuite/c-c++-common/gomp/adjust-args-5.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/gcc/testsuite/c-c++-common/gomp/adjust-args-5.c b/gcc/testsuite/c-c++-common/gomp/adjust-args-5.c new file mode 100644 index 0000000..8aff73c --- /dev/null +++ b/gcc/testsuite/c-c++-common/gomp/adjust-args-5.c @@ -0,0 +1,21 @@ +/* { dg-do compile } */ + +/* Check that the OpenMP 5.1 syntax with commas after the directive name and + between clauses is supported. */ + +int f (int a, void *b, float c[2]); + +#pragma omp declare variant (f), match (construct={dispatch}), adjust_args (nothing: a), adjust_args (need_device_ptr: b, c) +int f0 (int a, void *b, float c[2]); + +int test () { + int a; + void *b; + float c[2]; + struct {int a;} s; + + #pragma omp dispatch, novariants(0), nocontext(1) + s.a = f0 (a, b, c); + + return s.a; +} |