This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch,openacc] use existing local variable in cp_parser_oacc_enter_exit_data


Hi!

On Thu, 29 Nov 2018 21:33:37 +0000, Julian Brown <julian@codesourcery.com> wrote:
> On Wed, 26 Sep 2018 11:21:33 -0700
> Cesar Philippidis <cesar@codesourcery.com> wrote:
> 
> > This is an old gomp4 patch that updates the location of the clause for
> > acc enter/exit data. Apparently, it didn't impact any test cases. Is
> > this OK for trunk or should we drop it from OG8?
> > 
> > I bootstrapped and regtested it for x86_64 Linux with nvptx
> > offloading.
> 
> At least at a glance, there is no actual change to behaviour given in
> this patch, it is just an extremely minor cleanup. I.e. in:
> 
>   location_t loc = pragma_tok->location;
>   [...]
>   SET_EXPR_LOCATION (stmt, pragma_tok->location);
> 
> the variable "loc" is used in the SET_EXPR_LOCATION instead. It doesn't
> look like anything could mutate either variable in the interim.

Thanks, agreed.

> So, OK, or shall we just drop this?

This tiny change obviously should've been part of (much) earlier changes
(when that code was reworked, "loc" added), and has now gotten much too
much attention already; committed to trunk in r266687:

commit 52b928e7cd1b7dee36c4ea14b5ac9df3f022efd5
Author: tschwinge <tschwinge@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Fri Nov 30 20:39:40 2018 +0000

    [C++] Use existing local variable in cp_parser_oacc_enter_exit_data
    
            gcc/cp/
            * parser.c (cp_parser_oacc_enter_exit_data): Use existing local
            variable.
    
    Reviewed-by: Thomas Schwinge <thomas@codesourcery.com>
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@266687 138bc75d-0d04-0410-961f-82ee72b054a4
---
 gcc/cp/ChangeLog | 5 +++++
 gcc/cp/parser.c  | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git gcc/cp/ChangeLog gcc/cp/ChangeLog
index 98a2528783a9..2c8b7d10ae4e 100644
--- gcc/cp/ChangeLog
+++ gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2018-11-30  James Norris  <jnorris@codesourcery.com>
+
+	* parser.c (cp_parser_oacc_enter_exit_data): Use existing local
+	variable.
+
 2018-11-29  Paolo Carlini  <paolo.carlini@oracle.com>
 
 	* decl.c (compute_array_index_type_loc): New, like the current
diff --git gcc/cp/parser.c gcc/cp/parser.c
index 3ef1eda45188..634485b5a8c7 100644
--- gcc/cp/parser.c
+++ gcc/cp/parser.c
@@ -38472,7 +38472,7 @@ cp_parser_oacc_enter_exit_data (cp_parser *parser, cp_token *pragma_tok,
   stmt = enter ? make_node (OACC_ENTER_DATA) : make_node (OACC_EXIT_DATA);
   TREE_TYPE (stmt) = void_type_node;
   OMP_STANDALONE_CLAUSES (stmt) = clauses;
-  SET_EXPR_LOCATION (stmt, pragma_tok->location);
+  SET_EXPR_LOCATION (stmt, loc);
   add_stmt (stmt);
   return stmt;
 }


Grüße
 Thomas


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]