diff options
author | Jakub Jelinek <jakub@redhat.com> | 2023-09-20 08:43:02 +0200 |
---|---|---|
committer | Jakub Jelinek <jakub@redhat.com> | 2023-09-20 08:43:02 +0200 |
commit | 04b2fb5bb644f172879a02e8374ad50b669e3d6d (patch) | |
tree | 233009950b5218bbf9d39af714df2365572ebd85 /gcc/cp/parser.h | |
parent | d024a31a09d18d2586769602205a60ff3afe568c (diff) | |
download | gcc-04b2fb5bb644f172879a02e8374ad50b669e3d6d.zip gcc-04b2fb5bb644f172879a02e8374ad50b669e3d6d.tar.gz gcc-04b2fb5bb644f172879a02e8374ad50b669e3d6d.tar.bz2 |
openmp: Add omp::decl attribute support [PR111392]
This patch adds support for (so far C++) omp::decl attribute. For
declare simd and declare variant directives it is essentially another
spelling of omp::decl, except per discussions it is not allowed inside
of omp::sequence attribute. For threadprivate, declare target, allocate
and later groupprivate directives it should appertain to variable (or for
declare target also function definitions and) declarations and where in
normal syntax one specifies a list of variables (or variables and functions),
either as argument of the directive or clause argument, such argument is
not specified and implied to be the variable it applies to.
2023-09-20 Jakub Jelinek <jakub@redhat.com>
PR c++/111392
gcc/
* attribs.cc (decl_attributes): Don't warn on omp::directive attribute
on vars or function decls if -fopenmp or -fopenmp-simd.
gcc/c-family/
* c-omp.cc (c_omp_directives): Add commented out groupprivate
directive entry.
gcc/cp/
* parser.h (struct cp_lexer): Add in_omp_decl_attribute member.
* cp-tree.h (cp_maybe_parse_omp_decl): Declare.
* parser.cc (cp_parser_handle_statement_omp_attributes): Diagnose
omp::decl attribute on statements. Adjust diagnostic wording for
omp::decl.
(cp_parser_omp_directive_args): Add DECL_P argument, set TREE_PUBLIC
to it on the DEFERRED_PARSE tree.
(cp_parser_omp_sequence_args): Adjust caller.
(cp_parser_std_attribute): Handle omp::decl attribute.
(cp_parser_omp_var_list): If parser->lexer->in_omp_decl_attribute
don't expect any arguments, instead create clause or TREE_LIST for
that decl.
(cp_parser_late_parsing_omp_declare_simd): Adjust diagnostic wording
for omp::decl.
(cp_maybe_parse_omp_decl): New function.
(cp_parser_omp_declare_target): If
parser->lexer->in_omp_decl_attribute and first token isn't name or
comma invoke cp_parser_omp_var_list.
* decl2.cc (cplus_decl_attributes): Adjust diagnostic wording for
omp::decl. Handle omp::decl on declarations.
* name-lookup.cc (finish_using_directive): Adjust diagnostic wording
for omp::decl.
gcc/testsuite/
* g++.dg/gomp/attrs-19.C: New test.
* g++.dg/gomp/attrs-20.C: New test.
* g++.dg/gomp/attrs-21.C: New test.
libgomp/
* libgomp.texi: Mark decl attribute was added to the C++ attribute
syntax as implemented.
Diffstat (limited to 'gcc/cp/parser.h')
-rw-r--r-- | gcc/cp/parser.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/gcc/cp/parser.h b/gcc/cp/parser.h index 6cbb9a8..9ba8021 100644 --- a/gcc/cp/parser.h +++ b/gcc/cp/parser.h @@ -107,6 +107,10 @@ struct GTY (()) cp_lexer { /* The next lexer in a linked list of lexers. */ struct cp_lexer *next; + /* Set for omp::decl attribute parsing to the decl to which it + appertains. */ + tree in_omp_decl_attribute; + /* True if we should output debugging information. */ bool debugging_p; |