https://gcc.gnu.org/g:e9a8bd8280224ede88ffb90da9d0eeca3d3fe4e5

commit e9a8bd8280224ede88ffb90da9d0eeca3d3fe4e5
Author: Tobias Burnus <tbur...@baylibre.com>
Date:   Thu Jan 23 22:46:09 2025 +0100

    tree-core.h (omp_clause_code): Comments regarding range checks for 
OMP_CLAUSE_...
    
    gcc/ChangeLog:
    
            * tree-core.h (enum omp_clause_code): Add comments to cross ref to
            OMP_CLAUSE_DECL etc. and mark the ranges used in the range checks.
    
    (cherry picked from commit 6c45281a208652143c128541d80ce66da6d49868)

Diff:
---
 gcc/ChangeLog.omp |  8 ++++++++
 gcc/tree-core.h   | 24 +++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 1 deletion(-)

diff --git a/gcc/ChangeLog.omp b/gcc/ChangeLog.omp
index 31f2140cdd97..89fc9a7dc336 100644
--- a/gcc/ChangeLog.omp
+++ b/gcc/ChangeLog.omp
@@ -1,3 +1,11 @@
+2025-01-23  Tobias Burnus  <tbur...@baylibre.com>
+
+       Backported from master:
+       2024-10-28  Tobias Burnus  <tbur...@baylibre.com>
+
+       * tree-core.h (enum omp_clause_code): Add comments to cross ref to
+       OMP_CLAUSE_DECL etc. and mark the ranges used in the range checks.
+
 2025-01-23  Tobias Burnus  <tbur...@baylibre.com>
 
        Backported from master:
diff --git a/gcc/tree-core.h b/gcc/tree-core.h
index 7fa1f6ec7170..def059b1aad0 100644
--- a/gcc/tree-core.h
+++ b/gcc/tree-core.h
@@ -241,12 +241,19 @@ enum tree_code_class {
 };
 
 /* OMP_CLAUSE codes.  Do not reorder, as this is used to index into
-   the tables omp_clause_num_ops and omp_clause_code_name.  */
+   the tables omp_clause_num_ops and omp_clause_code_name.
+
+   Note additionally that there are various range checks such as
+   for OMP_CLAUSE_SIZE or OMP_CLAUSE_DECL; clauses having those shall
+   be inside that range, those that have not shall be outside.  */
+
 enum omp_clause_code {
   /* Clause zero is special-cased inside the parser
      (c_parser_omp_variable_list).  */
   OMP_CLAUSE_ERROR = 0,
 
+  /* Range START below for: OMP_CLAUSE_DECL  */
+
   /* OpenACC/OpenMP clause: private (variable_list).  */
   OMP_CLAUSE_PRIVATE,
 
@@ -259,6 +266,9 @@ enum omp_clause_code {
   /* OpenMP clause: lastprivate (variable_list).  */
   OMP_CLAUSE_LASTPRIVATE,
 
+  /* Range START below for: OMP_CLAUSE_REDUCTION_CODE and
+     OMP_CLAUSE_REDUCTION_{INIT,MERGE,{DECL_,}PLACEHOLDER,OMP_ORIG_REF}  */
+
   /* OpenACC/OpenMP clause: reduction (operator:variable_list).
      OMP_CLAUSE_REDUCTION_CODE: The tree_code of the operator.
      Operand 1: OMP_CLAUSE_REDUCTION_INIT: Stmt-list to initialize the var.
@@ -279,6 +289,9 @@ enum omp_clause_code {
   /* OpenMP clause: in_reduction (operator:variable_list).  */
   OMP_CLAUSE_IN_REDUCTION,
 
+  /* Range END above for: OMP_CLAUSE_REDUCTION_CODE  and
+     OMP_CLAUSE_REDUCTION_{INIT,MERGE,{DECL_,}PLACEHOLDER,OMP_ORIG_REF}  */
+
   /* OpenMP clause: copyin (variable_list).  */
   OMP_CLAUSE_COPYIN,
 
@@ -332,12 +345,17 @@ enum omp_clause_code {
   /* OpenMP clause: exclusive (variable-list).  */
   OMP_CLAUSE_EXCLUSIVE,
 
+  /* Range START below for: OMP_CLAUSE_SIZE  */
+  /* Range START below for: OMP_CLAUSE_MOTION_PRESENT  */
+
   /* OpenMP clause: from (variable-list).  */
   OMP_CLAUSE_FROM,
 
   /* OpenMP clause: to (variable-list).  */
   OMP_CLAUSE_TO,
 
+  /* Range END above for: OMP_CLAUSE_MOTION_PRESENT  */
+
   /* OpenACC clauses: {copy, copyin, copyout, create, delete, deviceptr,
      device, host (self), present, present_or_copy (pcopy), present_or_copyin
      (pcopyin), present_or_copyout (pcopyout), present_or_create (pcreate)}
@@ -360,6 +378,8 @@ enum omp_clause_code {
      #pragma acc cache (variable-list).  */
   OMP_CLAUSE__CACHE_,
 
+  /* Range END above for: OMP_CLAUSE_SIZE */
+
   /* OpenACC clause: gang [(gang-argument-list)].
      Where
       gang-argument-list: [gang-argument-list, ] gang-argument
@@ -392,6 +412,8 @@ enum omp_clause_code {
   /* Internal clause: temporary for inscan reductions.  */
   OMP_CLAUSE__SCANTEMP_,
 
+  /* Range END above for: OMP_CLAUSE_DECL  */
+
   /* OpenACC/OpenMP clause: if (scalar-expression).  */
   OMP_CLAUSE_IF,

Reply via email to