[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gcc-fortran
Subject:    Re: [PATCH] Fix select type parsing (PR fortran/78026)
From:       Jakub Jelinek <jakub () redhat ! com>
Date:       2016-10-27 19:52:37
Message-ID: 20161027195237.GS3541 () tucnak ! redhat ! com
[Download RAW message or body]

On Thu, Oct 27, 2016 at 12:45:25PM -0700, Steve Kargl wrote:
> Thanks for the detailed analysis.  The patch looks ok to me.
> I would prefer functional and cosmetic changes to be committed 
> separately, but in this case the cosmetic changes are small.
> 
> > +	{
> > +	  std::swap (ns, gfc_current_ns);
> > +	  gfc_free_namespace (ns);
> > +	  return m;
> > +	}
> 
> Not being C++ literate.  I assume that the above is essential
> 
> tmp_ns = ns
> ns = gfc_currrent_ns
> gfc_current_ns = tmp_ns
> free(ns)

Yeah.  I could have written
  ns = gfc_current_ns;
  gfc_current_ns = gfc_current_ns->parent;
  gfc_free_namespace (ns);
too, but that is longer.  I'm also not too much enthusiastic about
putting C++ constructs everywhere, but std::swap is actually one of the few
things I like about C++ in GCC sources, it is more readable.

	Jakub
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic