openmp: Adjust diagnostics about same variable in link and to/enter clauses
authorJakub Jelinek <jakub@redhat.com>
Sat, 28 May 2022 06:26:57 +0000 (08:26 +0200)
committerJakub Jelinek <jakub@redhat.com>
Sat, 28 May 2022 06:30:15 +0000 (08:30 +0200)
commit931249276acb4bdab778fe2bf4e81a1a31a78e6c
tree86f20f2d4adb4dbb9986d43f1025092463c00105
parent221acd67ca50f8f069037e034a3250f13d75a9f5
openmp: Adjust diagnostics about same variable in link and to/enter clauses

On Fri, May 27, 2022 at 04:52:17PM +0200, Tobias Burnus wrote:
> The 'TO'/'ENTER' usage is first stored in a linked list – and
> then as attribute to the symbol. I am not sure how to handle it best.

This reminds me I've left the C/C++ FE diagnostics about mixing link and
to/enter on the same variable in separate directives as is, so it always
talked about mixing link and to clauses.

This patch adjusts it, so that if link is first, it talks about the
clause actually used and if link is later, uses to or enter together
in the wording.

2022-05-28  Jakub Jelinek  <jakub@redhat.com>

gcc/c/
* c-parser.cc (c_parser_omp_declare_target): If OMP_CLAUSE_LINK was
seen first, use "%<to%>" or "%<enter%>" depending on
OMP_CLAUSE_ENTER_TO of the current clause, otherwise use
"%<to%> or %<enter%>" wording.
gcc/cp/
* parser.cc (handle_omp_declare_target_clause): If OMP_CLAUSE_LINK was
seen first, use "%<to%>" or "%<enter%>" depending on
OMP_CLAUSE_ENTER_TO of the current clause, otherwise use
"%<to%> or %<enter%>" wording.
gcc/testsuite/
* c-c++-common/gomp/declare-target-2.c: Add further tests for mixing of
link and to/enter clauses on separate directives.
gcc/c/c-parser.cc
gcc/cp/parser.cc
gcc/testsuite/c-c++-common/gomp/declare-target-2.c