https://gcc.gnu.org/g:6c45281a208652143c128541d80ce66da6d49868
commit r15-4716-g6c45281a208652143c128541d80ce66da6d49868 Author: Tobias Burnus <tbur...@baylibre.com> Date: Mon Oct 28 10:00:08 2024 +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. Diff: --- gcc/tree-core.h | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/gcc/tree-core.h b/gcc/tree-core.h index e82f3a5f4f5b..2a91e7935ca1 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. @@ -277,6 +287,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, @@ -330,12 +343,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)} @@ -354,6 +372,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 @@ -386,6 +406,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,