aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/semantics.cc
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2022-08-17 14:17:08 +0200
committerTobias Burnus <tobias@codesourcery.com>2022-08-17 14:31:53 +0200
commit92a5de3df2dc958d6b3d18a0466189ad31f5ae79 (patch)
tree997b8dadc16fa5ffac4baa480b249d8505e775e0 /gcc/cp/semantics.cc
parent06bca6950b154d7c85762acf1593d6792f8a2617 (diff)
downloadgcc-92a5de3df2dc958d6b3d18a0466189ad31f5ae79.zip
gcc-92a5de3df2dc958d6b3d18a0466189ad31f5ae79.tar.gz
gcc-92a5de3df2dc958d6b3d18a0466189ad31f5ae79.tar.bz2
OpenMP/C++: Allow classes with static members to be mappable [PR104493]
As this is the last lang-specific user of the omp_mappable_type hook, the hook is removed, keeping only a generic omp_mappable_type for incomplete types (or error_node). PR c++/104493 gcc/c/ChangeLog: * c-decl.cc (c_decl_attributes, finish_decl): Call omp_mappable_type instead of removed langhook. * c-typeck.cc (c_finish_omp_clauses): Likewise. gcc/cp/ChangeLog: * cp-objcp-common.h (LANG_HOOKS_OMP_MAPPABLE_TYPE): Remove. * cp-tree.h (cp_omp_mappable_type, cp_omp_emit_unmappable_type_notes): Remove. * decl2.cc (cp_omp_mappable_type_1, cp_omp_mappable_type, cp_omp_emit_unmappable_type_notes): Remove. (cplus_decl_attributes): Call omp_mappable_type instead of removed langhook. * decl.cc (cp_finish_decl): Likewise; call cxx_incomplete_type_inform in lieu of cp_omp_emit_unmappable_type_notes. * semantics.cc (finish_omp_clauses): Likewise. gcc/ChangeLog: * gimplify.cc (omp_notice_variable): Call omp_mappable_type instead of removed langhook. * omp-general.h (omp_mappable_type): New prototype. * omp-general.cc (omp_mappable_type): New; moved from ... * langhooks.cc (lhd_omp_mappable_type): ... here. * langhooks-def.h (lhd_omp_mappable_type, LANG_HOOKS_OMP_MAPPABLE_TYPE): Remove. (LANG_HOOKS_FOR_TYPES_INITIALIZER): Remote the latter. * langhooks.h (struct lang_hooks_for_types): Remove omp_mappable_type. gcc/testsuite/ChangeLog: * g++.dg/gomp/unmappable-1.C: Remove dg-error; remove dg-note no longer shown as TYPE_MAIN_DECL is NULL. * c-c++-common/gomp/map-incomplete-type.c: New test. Co-authored-by: Chung-Lin Tang <cltang@codesourcery.com>
Diffstat (limited to 'gcc/cp/semantics.cc')
-rw-r--r--gcc/cp/semantics.cc28
1 files changed, 18 insertions, 10 deletions
diff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc
index 16dea05..ae7c8ea 100644
--- a/gcc/cp/semantics.cc
+++ b/gcc/cp/semantics.cc
@@ -7992,13 +7992,15 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
t = OMP_CLAUSE_DECL (c);
if (TREE_CODE (t) != TREE_LIST
&& !type_dependent_expression_p (t)
- && !cp_omp_mappable_type (TREE_TYPE (t)))
+ && !omp_mappable_type (TREE_TYPE (t)))
{
error_at (OMP_CLAUSE_LOCATION (c),
"array section does not have mappable type "
"in %qs clause",
omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
- cp_omp_emit_unmappable_type_notes (TREE_TYPE (t));
+ if (TREE_TYPE (t) != error_mark_node
+ && !COMPLETE_TYPE_P (TREE_TYPE (t)))
+ cxx_incomplete_type_inform (TREE_TYPE (t));
remove = true;
}
while (TREE_CODE (t) == ARRAY_REF)
@@ -8134,12 +8136,14 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
t, omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
remove = true;
}
- else if (!cp_omp_mappable_type (TREE_TYPE (t)))
+ else if (!omp_mappable_type (TREE_TYPE (t)))
{
error_at (OMP_CLAUSE_LOCATION (c),
"%qE does not have a mappable type in %qs clause",
t, omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
- cp_omp_emit_unmappable_type_notes (TREE_TYPE (t));
+ if (TREE_TYPE (t) != error_mark_node
+ && !COMPLETE_TYPE_P (TREE_TYPE (t)))
+ cxx_incomplete_type_inform (TREE_TYPE (t));
remove = true;
}
while (TREE_CODE (t) == COMPONENT_REF)
@@ -8232,14 +8236,16 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
== GOMP_MAP_FIRSTPRIVATE_POINTER)))
&& t == OMP_CLAUSE_DECL (c)
&& !type_dependent_expression_p (t)
- && !cp_omp_mappable_type (TYPE_REF_P (TREE_TYPE (t))
- ? TREE_TYPE (TREE_TYPE (t))
- : TREE_TYPE (t)))
+ && !omp_mappable_type (TYPE_REF_P (TREE_TYPE (t))
+ ? TREE_TYPE (TREE_TYPE (t))
+ : TREE_TYPE (t)))
{
error_at (OMP_CLAUSE_LOCATION (c),
"%qD does not have a mappable type in %qs clause", t,
omp_clause_code_name[OMP_CLAUSE_CODE (c)]);
- cp_omp_emit_unmappable_type_notes (TREE_TYPE (t));
+ if (TREE_TYPE (t) != error_mark_node
+ && !COMPLETE_TYPE_P (TREE_TYPE (t)))
+ cxx_incomplete_type_inform (TREE_TYPE (t));
remove = true;
}
else if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_MAP
@@ -8409,12 +8415,14 @@ finish_omp_clauses (tree clauses, enum c_omp_region_type ort)
cname);
remove = true;
}
- else if (!cp_omp_mappable_type (TREE_TYPE (t)))
+ else if (!omp_mappable_type (TREE_TYPE (t)))
{
error_at (OMP_CLAUSE_LOCATION (c),
"%qD does not have a mappable type in %qs clause", t,
cname);
- cp_omp_emit_unmappable_type_notes (TREE_TYPE (t));
+ if (TREE_TYPE (t) != error_mark_node
+ && !COMPLETE_TYPE_P (TREE_TYPE (t)))
+ cxx_incomplete_type_inform (TREE_TYPE (t));
remove = true;
}
if (remove)