From: Julian Brown <julian@codesourcery.com>
To: <gcc-patches@gcc.gnu.org>
Cc: <fortran@gcc.gnu.org>, <jakub@redhat.com>, <tobias@codesourcery.com>
Subject: [PATCH 5/8] OpenMP, Fortran: Pass list number to gfc_free_omp_namelist
Date: Tue, 5 Sep 2023 12:28:25 -0700 [thread overview]
Message-ID: <a4f1336860c3f9118c9984d7a0da38653070a80e.1693941293.git.julian@codesourcery.com> (raw)
In-Reply-To: <cover.1693941292.git.julian@codesourcery.com>
This is a cleanup to avoid passing an ever-longer list of boolean
arguments to gfc_free_omp_namelist, in support of the Fortran "declare
mapper" implementation further along this patch series.
This patch isn't intended to cause any behavioural changes.
2023-09-05 Julian Brown <julian@codesourcery.com>
gcc/fortran/
* gfortran.h (gfc_free_omp_namelist): Update prototype.
* match.cc (gfc_free_omp_namelist): Remove FREE_NS,
FREE_ALIGN_ALLOCATOR, FREE_MEM_TRAITS_SPACE parameters and replace
with LIST.
* openmp.cc (gfc_free_omp_clauses, gfc_match_omp_clause_reduction,
gfc_match_omp_clause_uses_allocators, gfc_match_omp_clauses,
gfc_match_omp_allocate, gfc_match_omp_flush, resolve_omp_clauses):
Update calls to gfc_free_omp_namelist.
* st.cc (gfc_free_statement): Update call to gfc_free_omp_namelist.
---
gcc/fortran/gfortran.h | 2 +-
gcc/fortran/match.cc | 7 ++++---
gcc/fortran/openmp.cc | 31 ++++++++++++++-----------------
gcc/fortran/st.cc | 2 +-
4 files changed, 20 insertions(+), 22 deletions(-)
diff --git a/gcc/fortran/gfortran.h b/gcc/fortran/gfortran.h
index 3c8270a0f83a..34ee800668ca 100644
--- a/gcc/fortran/gfortran.h
+++ b/gcc/fortran/gfortran.h
@@ -3605,7 +3605,7 @@ void gfc_free_iterator (gfc_iterator *, int);
void gfc_free_forall_iterator (gfc_forall_iterator *);
void gfc_free_alloc_list (gfc_alloc *);
void gfc_free_namelist (gfc_namelist *);
-void gfc_free_omp_namelist (gfc_omp_namelist *, bool, bool, bool);
+void gfc_free_omp_namelist (gfc_omp_namelist *, int = OMP_LIST_NUM);
void gfc_free_equiv (gfc_equiv *);
void gfc_free_equiv_until (gfc_equiv *, gfc_equiv *);
void gfc_free_data (gfc_data *);
diff --git a/gcc/fortran/match.cc b/gcc/fortran/match.cc
index ba23bcd96923..dd72a03027a1 100644
--- a/gcc/fortran/match.cc
+++ b/gcc/fortran/match.cc
@@ -5536,10 +5536,11 @@ gfc_free_namelist (gfc_namelist *name)
/* Free an OpenMP namelist structure. */
void
-gfc_free_omp_namelist (gfc_omp_namelist *name, bool free_ns,
- bool free_align_allocator,
- bool free_mem_traits_space)
+gfc_free_omp_namelist (gfc_omp_namelist *name, int list)
{
+ bool free_ns = (list == OMP_LIST_AFFINITY || list == OMP_LIST_DEPEND);
+ bool free_align_allocator = (list == OMP_LIST_ALLOCATE);
+ bool free_mem_traits_space = (list == OMP_LIST_USES_ALLOCATORS);
gfc_omp_namelist *n;
for (; name; name = n)
diff --git a/gcc/fortran/openmp.cc b/gcc/fortran/openmp.cc
index 234d896b2ce2..576b6784b441 100644
--- a/gcc/fortran/openmp.cc
+++ b/gcc/fortran/openmp.cc
@@ -186,10 +186,7 @@ gfc_free_omp_clauses (gfc_omp_clauses *c)
gfc_free_expr (c->num_workers_expr);
gfc_free_expr (c->vector_length_expr);
for (i = 0; i < OMP_LIST_NUM; i++)
- gfc_free_omp_namelist (c->lists[i],
- i == OMP_LIST_AFFINITY || i == OMP_LIST_DEPEND,
- i == OMP_LIST_ALLOCATE,
- i == OMP_LIST_USES_ALLOCATORS);
+ gfc_free_omp_namelist (c->lists[i], i);
gfc_free_expr_list (c->wait_list);
gfc_free_expr_list (c->tile_list);
free (CONST_CAST (char *, c->critical_name));
@@ -554,7 +551,7 @@ syntax:
gfc_error ("Syntax error in OpenMP variable list at %C");
cleanup:
- gfc_free_omp_namelist (head, false, false, false);
+ gfc_free_omp_namelist (head);
gfc_current_locus = old_loc;
return MATCH_ERROR;
}
@@ -644,7 +641,7 @@ syntax:
gfc_error ("Syntax error in OpenMP variable list at %C");
cleanup:
- gfc_free_omp_namelist (head, false, false, false);
+ gfc_free_omp_namelist (head);
gfc_current_locus = old_loc;
return MATCH_ERROR;
}
@@ -753,7 +750,7 @@ syntax:
gfc_error ("Syntax error in OpenMP SINK dependence-type list at %C");
cleanup:
- gfc_free_omp_namelist (head, false, false, false);
+ gfc_free_omp_namelist (head);
gfc_current_locus = old_loc;
return MATCH_ERROR;
}
@@ -1504,7 +1501,7 @@ gfc_match_omp_clause_reduction (char pc, gfc_omp_clauses *c, bool openacc,
*head = NULL;
gfc_error_now ("!$OMP DECLARE REDUCTION %s not found at %L",
buffer, &old_loc);
- gfc_free_omp_namelist (n, false, false, false);
+ gfc_free_omp_namelist (n, list_idx);
}
else
for (n = *head; n; n = n->next)
@@ -1795,7 +1792,7 @@ gfc_match_omp_clause_uses_allocators (gfc_omp_clauses *c)
return MATCH_YES;
error:
- gfc_free_omp_namelist (head, false, false, true);
+ gfc_free_omp_namelist (head, OMP_LIST_USES_ALLOCATORS);
return MATCH_ERROR;
}
@@ -1922,7 +1919,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
if (end_colon && gfc_match (" %e )", &alignment) != MATCH_YES)
{
- gfc_free_omp_namelist (*head, false, false, false);
+ gfc_free_omp_namelist (*head);
gfc_current_locus = old_loc;
*head = NULL;
break;
@@ -2865,7 +2862,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
end_colon = true;
else if (gfc_match (" )") != MATCH_YES)
{
- gfc_free_omp_namelist (*head, false, false, false);
+ gfc_free_omp_namelist (*head);
gfc_current_locus = old_loc;
*head = NULL;
break;
@@ -2876,7 +2873,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
{
if (gfc_match (" %e )", &step) != MATCH_YES)
{
- gfc_free_omp_namelist (*head, false, false, false);
+ gfc_free_omp_namelist (*head);
gfc_current_locus = old_loc;
*head = NULL;
goto error;
@@ -2973,7 +2970,7 @@ gfc_match_omp_clauses (gfc_omp_clauses **cp, const omp_mask mask,
}
if (has_error)
{
- gfc_free_omp_namelist (*head, false, false, false);
+ gfc_free_omp_namelist (*head);
*head = NULL;
goto error;
}
@@ -4519,7 +4516,7 @@ gfc_match_omp_allocate (void)
gfc_error ("Unexpected expression as list item at %L in ALLOCATE "
"directive", &n->expr->where);
- gfc_free_omp_namelist (vars, false, true, false);
+ gfc_free_omp_namelist (vars, OMP_LIST_ALLOCATE);
goto error;
}
@@ -4923,14 +4920,14 @@ gfc_match_omp_flush (void)
{
gfc_error ("List specified together with memory order clause in FLUSH "
"directive at %C");
- gfc_free_omp_namelist (list, false, false, false);
+ gfc_free_omp_namelist (list);
gfc_free_omp_clauses (c);
return MATCH_ERROR;
}
if (gfc_match_omp_eos () != MATCH_YES)
{
gfc_error ("Unexpected junk after $OMP FLUSH statement at %C");
- gfc_free_omp_namelist (list, false, false, false);
+ gfc_free_omp_namelist (list);
gfc_free_omp_clauses (c);
return MATCH_ERROR;
}
@@ -7831,7 +7828,7 @@ resolve_omp_clauses (gfc_code *code, gfc_omp_clauses *omp_clauses,
{
prev->next = n->next;
n->next = NULL;
- gfc_free_omp_namelist (n, false, true, false);
+ gfc_free_omp_namelist (n, OMP_LIST_ALLOCATE);
n = prev->next;
}
continue;
diff --git a/gcc/fortran/st.cc b/gcc/fortran/st.cc
index b6d87c402074..257e08bc074c 100644
--- a/gcc/fortran/st.cc
+++ b/gcc/fortran/st.cc
@@ -288,7 +288,7 @@ gfc_free_statement (gfc_code *p)
break;
case EXEC_OMP_FLUSH:
- gfc_free_omp_namelist (p->ext.omp_namelist, false, false, false);
+ gfc_free_omp_namelist (p->ext.omp_namelist);
break;
case EXEC_OMP_BARRIER:
--
2.41.0
next prev parent reply other threads:[~2023-09-05 19:30 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-05 19:28 [PATCH 0/8] OpenMP: lvalue parsing and "declare mapper" support Julian Brown
2023-09-05 19:28 ` [PATCH 1/8] OpenMP: lvalue parsing for map/to/from clauses (C++) Julian Brown
2023-12-20 14:31 ` Tobias Burnus
2024-01-05 12:23 ` Julian Brown
2024-01-07 15:04 ` Tobias Burnus
2024-01-09 23:02 ` Thomas Schwinge
2024-01-10 9:14 ` Jakub Jelinek
2024-01-10 13:17 ` Julian Brown
2023-09-05 19:28 ` [PATCH 2/8] OpenMP: lvalue parsing for map/to/from clauses (C) Julian Brown
2024-01-10 21:31 ` Tobias Burnus
2023-09-05 19:28 ` [PATCH 3/8] OpenMP: C++ "declare mapper" support Julian Brown
2023-09-05 19:28 ` [PATCH 4/8] OpenMP: Support OpenMP 5.0 "declare mapper" directives for C Julian Brown
2023-09-05 19:28 ` Julian Brown [this message]
2023-09-05 19:28 ` [PATCH 6/8] OpenMP, Fortran: Per-directive control for gfc_trans_omp_clauses Julian Brown
2023-09-05 19:28 ` [PATCH 7/8] OpenMP, Fortran: Split out OMP clause checking Julian Brown
2023-09-05 19:28 ` [PATCH 8/8] OpenMP: Fortran "!$omp declare mapper" support Julian Brown
2023-09-14 15:13 ` Bernhard Reutner-Fischer
2023-09-18 10:19 ` Julian Brown
2023-09-21 22:52 ` Bernhard Reutner-Fischer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=a4f1336860c3f9118c9984d7a0da38653070a80e.1693941293.git.julian@codesourcery.com \
--to=julian@codesourcery.com \
--cc=fortran@gcc.gnu.org \
--cc=gcc-patches@gcc.gnu.org \
--cc=jakub@redhat.com \
--cc=tobias@codesourcery.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).