openmp: Add omp::decl support for C2X
commit8067caa85d038bfec829b7e3bd6b82d34e562904
authorJakub Jelinek <jakub@redhat.com>
Sat, 4 Nov 2023 08:14:08 +0000 (4 09:14 +0100)
committerJakub Jelinek <jakub@redhat.com>
Sat, 4 Nov 2023 08:14:08 +0000 (4 09:14 +0100)
tree1303615e3f3dde8f0a031fe25935ca9d3eaa72e4
parent40b9af020fc2842b4e22ae06742088815400631e
openmp: Add omp::decl support for C2X

This patch adds omp::decl support which has been added recently for
C++ also to C.

2023-11-04  Jakub Jelinek  <jakub@redhat.com>

* c-parser.h (c_maybe_parse_omp_decl): Declare.
* c-parser.cc (struct c_parser): Add in_omp_decl_attribute member.
(c_parser_std_attribute): Uncoment omp::decl handling.
(c_parser_omp_var_list_parens): If parser->in_omp_decl_attribute
don't expect any arguments, instead create clause or TREE_LIST for
that decl.
(c_maybe_parse_omp_decl): New function.
(c_parser_omp_declare_target): If parser->in_omp_decl_attribute and
first token isn't name or comma invoke c_parser_omp_var_list_parens.
* c-decl.cc (c_decl_attributes): Uncomment omp::decl handling and
use *node rather than non-existing *decl.

* gcc.dg/gomp/attrs-19.c: New test.
* gcc.dg/gomp/attrs-20.c: New test.
* gcc.dg/gomp/attrs-21.c: New test.
gcc/c/c-decl.cc
gcc/c/c-parser.cc
gcc/c/c-parser.h
gcc/testsuite/gcc.dg/gomp/attrs-19.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/attrs-20.c [new file with mode: 0644]
gcc/testsuite/gcc.dg/gomp/attrs-21.c [new file with mode: 0644]