aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-family
diff options
context:
space:
mode:
authorTobias Burnus <tburnus@baylibre.com>2024-12-18 09:25:50 +0100
committerTobias Burnus <tburnus@baylibre.com>2024-12-18 12:03:50 +0100
commit12dd892b1a3ad719e76e6ca40f8cbc224610b849 (patch)
tree9f5f57d9904192117c76ab57eb74d79b5e859682 /gcc/c-family
parent84794671859ae8eb54ff81c7d3e32b4db8686024 (diff)
downloadgcc-12dd892b1a3ad719e76e6ca40f8cbc224610b849.zip
gcc-12dd892b1a3ad719e76e6ca40f8cbc224610b849.tar.gz
gcc-12dd892b1a3ad719e76e6ca40f8cbc224610b849.tar.bz2
OpenMP: Add declare variant's 'append_args' clause in C/C++
Add the append_args clause of 'declare variant' to C and C++, fix/improve diagnostic for 'interop' clause and 'declare_variant' clauses on the way. Cleanup dispatch handling in gimplify_call_expr a bit and partially handle 'append_args'. (Namely, those parts that do not require libraries calls, i.e. a dispatch construct where the 'device' and 'interop' clause has been specified.) The sorry can be removed once an enum value like omp_ipr_(ompx_gnu_)omp_device_num (cf. OpenMP Spec Issue 4451) has to be added to the runtime side such that omp_get_interop_int returns the device number of an interop object (as passed to dispatch via the interop clause); and a call to GOMP_interop has to be added to create interop objects. Once available, only a very localized change in gimplify_call_expr is required to claim for full support. - And Fortran parsing support. gcc/c-family/ChangeLog: * c-omp.cc (c_omp_interop_t_p): Handle error_mark_node. gcc/c/ChangeLog: * c-parser.cc (c_parser_omp_clause_init_modifiers): New; split of from ... (c_parser_omp_clause_init): ... here; call it. (c_finish_omp_declare_variant): Parse 'append_args' clause. (c_parser_omp_clause_interop): Set tree used/read. gcc/cp/ChangeLog: * decl.cc (omp_declare_variant_finalize_one): Handle append_args. * parser.cc (cp_parser_omp_clause_init_modifiers): New; split of from ... (cp_parser_omp_clause_init): ... here; call it. (cp_parser_omp_all_clauses): Replace interop parsing by a call to ... (cp_parser_omp_clause_interop): ... this new function; set tree used/read. (cp_finish_omp_declare_variant): Parse 'append_args' clause. (cp_parser_omp_declare): Update comment. * pt.cc (tsubst_attribute, tsubst_omp_clauses): Handle template substitution also for declare variant's append_args clause, using for 'init' the same code as for interop's init clause. gcc/ChangeLog: * gimplify.cc (gimplify_call_expr): Update for OpenMP's append_args; cleanup of OpenMP's dispatch clause handling. gcc/testsuite/ChangeLog: * c-c++-common/gomp/declare-variant-2.c: Update dg-error msg. * c-c++-common/gomp/dispatch-12.c: Likewise. * c-c++-common/gomp/dispatch-11.c: Likewise and extend a bit. * c-c++-common/gomp/append-args-1.c: New test. * c-c++-common/gomp/append-args-2.c: New test. * c-c++-common/gomp/append-args-3.c: New test. * g++.dg/gomp/append-args-1.C: New test. * g++.dg/gomp/append-args-2.C: New test. * g++.dg/gomp/append-args-3.C: New test.
Diffstat (limited to 'gcc/c-family')
-rw-r--r--gcc/c-family/c-omp.cc2
1 files changed, 2 insertions, 0 deletions
diff --git a/gcc/c-family/c-omp.cc b/gcc/c-family/c-omp.cc
index 7e20e5a..5f2db14 100644
--- a/gcc/c-family/c-omp.cc
+++ b/gcc/c-family/c-omp.cc
@@ -669,6 +669,8 @@ c_finish_omp_atomic (location_t loc, enum tree_code code,
bool
c_omp_interop_t_p (tree type)
{
+ if (type == error_mark_node)
+ return false;
type = TYPE_MAIN_VARIANT (type);
return (TREE_CODE (type) == ENUMERAL_TYPE
&& TYPE_NAME (type)