aboutsummaryrefslogtreecommitdiff
path: root/gcc/c
diff options
context:
space:
mode:
authorTobias Burnus <tobias@codesourcery.com>2023-08-22 17:06:50 +0200
committerTobias Burnus <tobias@codesourcery.com>2023-08-22 17:06:50 +0200
commit0698c9fddfc5a41dd7f233928b7a486cb044fea3 (patch)
treec78723dcc4ba9247a5510f52b8c58250ebf03bcf /gcc/c
parent145da6a8e1ad60f048069012d81e37f84e1585fd (diff)
downloadgcc-0698c9fddfc5a41dd7f233928b7a486cb044fea3.zip
gcc-0698c9fddfc5a41dd7f233928b7a486cb044fea3.tar.gz
gcc-0698c9fddfc5a41dd7f233928b7a486cb044fea3.tar.bz2
OpenMP: Handle 'all' as category in defaultmap
Both, specifying no category and specifying 'all', implies that the implicit-behavior applies to all categories. gcc/c/ChangeLog: * c-parser.cc (c_parser_omp_clause_defaultmap): Parse 'all' as category. gcc/cp/ChangeLog: * parser.cc (cp_parser_omp_clause_defaultmap): Parse 'all' as category. gcc/fortran/ChangeLog: * gfortran.h (enum gfc_omp_defaultmap_category): Add OMP_DEFAULTMAP_CAT_ALL. * openmp.cc (gfc_match_omp_clauses): Parse 'all' as category. * trans-openmp.cc (gfc_trans_omp_clauses): Handle it. gcc/ChangeLog: * tree-core.h (enum omp_clause_defaultmap_kind): Add OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALL. * gimplify.cc (gimplify_scan_omp_clauses): Handle it. * tree-pretty-print.cc (dump_omp_clause): Likewise. libgomp/ChangeLog: * libgomp.texi (OpenMP 5.2 status): Add depobj with destroy-var argument as 'N'. Mark defaultmap with 'all' category as 'Y'. gcc/testsuite/ChangeLog: * gfortran.dg/gomp/defaultmap-1.f90: Update dg-error. * c-c++-common/gomp/defaultmap-5.c: New test. * c-c++-common/gomp/defaultmap-6.c: New test. * gfortran.dg/gomp/defaultmap-10.f90: New test. * gfortran.dg/gomp/defaultmap-9.f90: New test.
Diffstat (limited to 'gcc/c')
-rw-r--r--gcc/c/c-parser.cc19
1 files changed, 15 insertions, 4 deletions
diff --git a/gcc/c/c-parser.cc b/gcc/c/c-parser.cc
index 33fe7b1..4a4820d 100644
--- a/gcc/c/c-parser.cc
+++ b/gcc/c/c-parser.cc
@@ -15067,8 +15067,8 @@ c_parser_omp_clause_defaultmap (c_parser *parser, tree list)
if (!c_parser_next_token_is (parser, CPP_NAME))
{
invalid_category:
- c_parser_error (parser, "expected %<scalar%>, %<aggregate%> or "
- "%<pointer%>");
+ c_parser_error (parser, "expected %<scalar%>, %<aggregate%>, "
+ "%<pointer%> or %<all%>");
goto out_err;
}
p = IDENTIFIER_POINTER (c_parser_peek_token (parser)->value);
@@ -15077,6 +15077,8 @@ c_parser_omp_clause_defaultmap (c_parser *parser, tree list)
case 'a':
if (strcmp ("aggregate", p) == 0)
category = OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE;
+ else if (strcmp ("all", p) == 0)
+ category = OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALL;
else
goto invalid_category;
break;
@@ -15106,13 +15108,19 @@ c_parser_omp_clause_defaultmap (c_parser *parser, tree list)
for (c = list; c ; c = OMP_CLAUSE_CHAIN (c))
if (OMP_CLAUSE_CODE (c) == OMP_CLAUSE_DEFAULTMAP
&& (category == OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
+ || category == OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALL
|| OMP_CLAUSE_DEFAULTMAP_CATEGORY (c) == category
|| (OMP_CLAUSE_DEFAULTMAP_CATEGORY (c)
- == OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED)))
+ == OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED)
+ || (OMP_CLAUSE_DEFAULTMAP_CATEGORY (c)
+ == OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALL)))
{
enum omp_clause_defaultmap_kind cat = category;
location_t loc = OMP_CLAUSE_LOCATION (c);
- if (cat == OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED)
+ if (cat == OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED
+ || (cat == OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALL
+ && (OMP_CLAUSE_DEFAULTMAP_CATEGORY (c)
+ != OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED)))
cat = OMP_CLAUSE_DEFAULTMAP_CATEGORY (c);
p = NULL;
switch (cat)
@@ -15120,6 +15128,9 @@ c_parser_omp_clause_defaultmap (c_parser *parser, tree list)
case OMP_CLAUSE_DEFAULTMAP_CATEGORY_UNSPECIFIED:
p = NULL;
break;
+ case OMP_CLAUSE_DEFAULTMAP_CATEGORY_ALL:
+ p = "all";
+ break;
case OMP_CLAUSE_DEFAULTMAP_CATEGORY_AGGREGATE:
p = "aggregate";
break;