On Thu, Jun 09, 2022 at 02:21:13PM +0800, Chung-Lin Tang wrote:
> @@ -15651,6 +15653,213 @@ c_parser_omp_clause_allocate (c_parser *parser,
> tree list)
> return nl;
> }
>
> +/* OpenMP 5.0:
> + uses_allocators ( allocator-list )
> +
> + allocator-list:
> + allocator
> + allocator , allocator-list
> + allocator ( traits-array )
> + allocator ( traits-array ) , allocator-list
> +
> + OpenMP 5.2:
> +
> + uses_allocators ( modifier : allocator-list )
Please drop the -list above.
> + uses_allocators ( modifier , modifier : allocator-list )
and here too.
> + struct item_tok
> + {
> + location_t loc;
> + tree id;
> + item_tok (void) : loc (UNKNOWN_LOCATION), id (NULL_TREE) {}
> + };
> + struct item { item_tok name, arg; };
> + auto_vec<item> *modifiers = NULL, *allocators = NULL;
> + auto_vec<item> *cur_list = new auto_vec<item> (4);
I was hoping you'd drop all this.
See https://gcc.gnu.org/r13-1002
for implementation (both C and C++ FE) of something very similar,
the only difference there is that in the case of linear clause, it is
looking for
val
ref
uval
step ( whatever )
followed by , or )
(anod ref and uval not in C FE),
while you are looking for
memspace ( whatever )
traits ( whatever )
followed by : or by , (in case of , repeat).
But in both cases you can actually use the same parser APIs
for raw token pre-parsing to just compute if it is the modifier
syntax or not, set bool has_modifiers based on that (when you
come over probably valid syntax followed by CPP_COLON).
Jakub