public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/omp/gcc-11] openmp: Allow classes with static members to be mappable
@ 2022-03-11 13:51 Chung-Lin Tang
0 siblings, 0 replies; only message in thread
From: Chung-Lin Tang @ 2022-03-11 13:51 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:28ea857df2ef384627b3bc803c8a5a4ce037e6b2
commit 28ea857df2ef384627b3bc803c8a5a4ce037e6b2
Author: Chung-Lin Tang <cltang@codesourcery.com>
Date: Fri Mar 11 21:50:52 2022 +0800
openmp: Allow classes with static members to be mappable
In OpenMP 5.x, static members are supposed to be not a barrier for a class
to be target-mapped. Remove the check for static members inside
cp_omp_mappable_type_1, and adjusts a testcase.
Merged from:
https://gcc.gnu.org/pipermail/gcc-patches/2022-March/591449.html
gcc/cp/ChangeLog:
* decl2.cc (cp_omp_mappable_type_1): Remove requirement that all
members must be non-static; remove check for static fields.
gcc/testsuite/ChangeLog:
* g++.dg/gomp/unmappable-1.C: Adjust testcase.
Diff:
---
gcc/cp/decl2.c | 16 +++-------------
gcc/testsuite/g++.dg/gomp/unmappable-1.C | 2 +-
2 files changed, 4 insertions(+), 14 deletions(-)
diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c
index cf433acde65..ccb98fdc193 100644
--- a/gcc/cp/decl2.c
+++ b/gcc/cp/decl2.c
@@ -1456,24 +1456,14 @@ cp_omp_mappable_type_1 (tree type, bool notes)
"type %qT with virtual members is not mappable", type);
result = false;
}
- /* All data members must be non-static. */
+
if (CLASS_TYPE_P (type))
{
tree field;
for (field = TYPE_FIELDS (type); field; field = DECL_CHAIN (field))
- if (VAR_P (field)
- /* Fields that are 'static constexpr' can be folded away at compile
- time, thus does not interfere with mapping. */
- && !DECL_DECLARED_CONSTEXPR_P (field))
- {
- if (notes)
- inform (DECL_SOURCE_LOCATION (field),
- "static field %qD is not mappable", field);
- result = false;
- }
/* All fields must have mappable types. */
- else if (TREE_CODE (field) == FIELD_DECL
- && !cp_omp_mappable_type_1 (TREE_TYPE (field), notes))
+ if (TREE_CODE (field) == FIELD_DECL
+ && !cp_omp_mappable_type_1 (TREE_TYPE (field), notes))
result = false;
}
return result;
diff --git a/gcc/testsuite/g++.dg/gomp/unmappable-1.C b/gcc/testsuite/g++.dg/gomp/unmappable-1.C
index d00ccb5ad79..aba8497003f 100644
--- a/gcc/testsuite/g++.dg/gomp/unmappable-1.C
+++ b/gcc/testsuite/g++.dg/gomp/unmappable-1.C
@@ -4,7 +4,7 @@
class C /* { dg-message "type .C. with virtual members is not mappable" } */
{
public:
- static int static_member; /* { dg-message "static field .C::static_member. is not mappable" } */
+ static int static_member;
virtual void f() {}
};
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-03-11 13:51 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-11 13:51 [gcc/devel/omp/gcc-11] openmp: Allow classes with static members to be mappable Chung-Lin Tang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).