diff options
author | Tobias Burnus <tobias@codesourcery.com> | 2023-11-24 15:10:49 +0100 |
---|---|---|
committer | Tobias Burnus <tobias@codesourcery.com> | 2023-11-24 15:10:49 +0100 |
commit | 1802f64e674eeef0c0d7e8f6ca2846145ec16315 (patch) | |
tree | e68838cde627c0e9a342e2ad2495a826d024fb88 /gcc/cp | |
parent | 726723c476800285cfbdfce612cedde4a9a7ad58 (diff) | |
download | gcc-1802f64e674eeef0c0d7e8f6ca2846145ec16315.zip gcc-1802f64e674eeef0c0d7e8f6ca2846145ec16315.tar.gz gcc-1802f64e674eeef0c0d7e8f6ca2846145ec16315.tar.bz2 |
OpenMP: Accept argument to depobj's destroy clause
Since OpenMP 5.2, the destroy clause takes an depend argument as argument;
for the depobj directive, it the new argument is optional but, if present,
it must be identical to the directive's argument.
gcc/c/ChangeLog:
* c-parser.cc (c_parser_omp_depobj): Accept optionally an argument
to the destroy clause.
gcc/cp/ChangeLog:
* parser.cc (cp_parser_omp_depobj): Accept optionally an argument
to the destroy clause.
gcc/fortran/ChangeLog:
* openmp.cc (gfc_match_omp_depobj): Accept optionally an argument
to the destroy clause.
libgomp/ChangeLog:
* libgomp.texi (5.2 Impl. Status): An argument to the destroy clause
is now supported.
gcc/testsuite/ChangeLog:
* c-c++-common/gomp/depobj-3.c: New test.
* gfortran.dg/gomp/depobj-3.f90: New test.
Diffstat (limited to 'gcc/cp')
-rw-r--r-- | gcc/cp/parser.cc | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc index f6d088b..e4e2fea 100644 --- a/gcc/cp/parser.cc +++ b/gcc/cp/parser.cc @@ -43173,6 +43173,9 @@ cp_parser_omp_critical (cp_parser *parser, cp_token *pragma_tok, bool *if_p) destroy update (dependence-type) + OpenMP 5.2 additionally: + destroy ( depobj ) + dependence-type: in out @@ -43219,7 +43222,27 @@ cp_parser_omp_depobj (cp_parser *parser, cp_token *pragma_tok) clause = error_mark_node; } else if (!strcmp ("destroy", p)) - kind = OMP_CLAUSE_DEPEND_LAST; + { + kind = OMP_CLAUSE_DEPEND_LAST; + matching_parens c_parens; + if (cp_lexer_next_token_is (parser->lexer, CPP_OPEN_PAREN) + && c_parens.require_open (parser)) + { + tree destobj = cp_parser_assignment_expression (parser); + if (depobj != error_mark_node + && destobj != error_mark_node + && !operand_equal_p (destobj, depobj, OEP_MATCH_SIDE_EFFECTS + | OEP_LEXICOGRAPHIC)) + warning_at (EXPR_LOC_OR_LOC (destobj, c_loc), 0, + "the %<destroy%> expression %qE should be the same " + "as the %<depobj%> argument %qE", destobj, depobj); + if (!c_parens.require_close (parser)) + cp_parser_skip_to_closing_parenthesis (parser, + /*recovering=*/true, + /*or_comma=*/false, + /*consume_paren=*/true); + } + } else if (!strcmp ("update", p)) { matching_parens c_parens; |