https://gcc.gnu.org/g:92d9d640f60089c222a8630a81a2b4a2827facd1

commit 92d9d640f60089c222a8630a81a2b4a2827facd1
Author: Julian Brown <jul...@codesourcery.com>
Date:   Tue Aug 8 12:35:48 2023 +0000

    OpenMP: Introduce C_ORT_{,OMP_}DECLARE_MAPPER c_omp_region_type types
    
    This patch adds C_ORT_DECLARE_MAPPER and C_ORT_OMP_DECLARE_MAPPER
    region types to the c_omp_region_type enum, and uses them in cp/pt.cc.
    Previously the C_ORT_DECLARE_SIMD code was being abused to inhibit calling
    finish_omp_clauses within mapper definitions, but this patch uses one
    of the new enumeration values for that purpose instead.  This shouldn't
    result in any behaviour change, but improves self-documentation.
    
    2023-08-10  Julian Brown  <jul...@codesourcery.com>
    
    gcc/c-family/
            * c-common.h (c_omp_region_type): Add C_ORT_DECLARE_MAPPER and
            C_ORT_OMP_DECLARE_MAPPER codes.
    
    gcc/cp/
            * pt.cc (tsubst_omp_clauses): Use C_ORT_OMP_DECLARE_MAPPER.
            (tsubst_expr): Likewise.

Diff:
---
 gcc/c-family/ChangeLog.omp | 5 +++++
 gcc/c-family/c-common.h    | 2 ++
 gcc/cp/ChangeLog.omp       | 5 +++++
 gcc/cp/pt.cc               | 4 ++--
 4 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/gcc/c-family/ChangeLog.omp b/gcc/c-family/ChangeLog.omp
index 914ac60f0e5..572315bd425 100644
--- a/gcc/c-family/ChangeLog.omp
+++ b/gcc/c-family/ChangeLog.omp
@@ -1,3 +1,8 @@
+2023-08-10  Julian Brown  <jul...@codesourcery.com>
+
+       * c-common.h (c_omp_region_type): Add C_ORT_DECLARE_MAPPER and
+       C_ORT_OMP_DECLARE_MAPPER codes.
+
 2023-07-06  Julian Brown  <jul...@codesourcery.com>
 
        * c-common.h (c_omp_region_type): Add C_ORT_EXIT_DATA,
diff --git a/gcc/c-family/c-common.h b/gcc/c-family/c-common.h
index 6c905baf807..6ca9ffb2d6f 100644
--- a/gcc/c-family/c-common.h
+++ b/gcc/c-family/c-common.h
@@ -1280,9 +1280,11 @@ enum c_omp_region_type
   C_ORT_DECLARE_SIMD           = 1 << 2,
   C_ORT_TARGET                 = 1 << 3,
   C_ORT_EXIT_DATA              = 1 << 4,
+  C_ORT_DECLARE_MAPPER         = 1 << 6,
   C_ORT_OMP_DECLARE_SIMD       = C_ORT_OMP | C_ORT_DECLARE_SIMD,
   C_ORT_OMP_TARGET             = C_ORT_OMP | C_ORT_TARGET,
   C_ORT_OMP_EXIT_DATA          = C_ORT_OMP | C_ORT_EXIT_DATA,
+  C_ORT_OMP_DECLARE_MAPPER     = C_ORT_OMP | C_ORT_DECLARE_MAPPER,
   C_ORT_ACC_TARGET             = C_ORT_ACC | C_ORT_TARGET
 };
 
diff --git a/gcc/cp/ChangeLog.omp b/gcc/cp/ChangeLog.omp
index c4f46122139..14acf2bb56a 100644
--- a/gcc/cp/ChangeLog.omp
+++ b/gcc/cp/ChangeLog.omp
@@ -1,3 +1,8 @@
+2023-08-10  Julian Brown  <jul...@codesourcery.com>
+
+       * pt.cc (tsubst_omp_clauses): Use C_ORT_OMP_DECLARE_MAPPER.
+       (tsubst_expr): Likewise.
+
 2023-07-06  Julian Brown  <jul...@codesourcery.com>
 
        * parser.cc (cp_parser_omp_target_data): Instantiate mappers for 'omp
diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc
index fa3dc002f9c..0c11263b303 100644
--- a/gcc/cp/pt.cc
+++ b/gcc/cp/pt.cc
@@ -17866,7 +17866,7 @@ tsubst_omp_clauses (tree clauses, enum 
c_omp_region_type ort,
     }
 
   new_clauses = nreverse (new_clauses);
-  if (ort != C_ORT_OMP_DECLARE_SIMD)
+  if (ort != C_ORT_OMP_DECLARE_SIMD && ort != C_ORT_OMP_DECLARE_MAPPER)
     {
       if (ort & C_ORT_OMP)
        new_clauses = c_omp_instantiate_mappers (new_clauses, ort);
@@ -19454,7 +19454,7 @@ tsubst_stmt (tree t, tree args, tsubst_flags_t 
complain, tree in_decl)
        decl = tsubst (decl, args, complain, in_decl);
        tree type = tsubst (TREE_TYPE (t), args, complain, in_decl);
        tree clauses = OMP_DECLARE_MAPPER_CLAUSES (t);
-       clauses = tsubst_omp_clauses (clauses, C_ORT_OMP_DECLARE_SIMD, args,
+       clauses = tsubst_omp_clauses (clauses, C_ORT_OMP_DECLARE_MAPPER, args,
                                      complain, in_decl);
        TREE_TYPE (t) = type;
        OMP_DECLARE_MAPPER_DECL (t) = decl;

Reply via email to