This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [Patch, Fortran] gfc_get_code cleanup
- From: Mikael Morin <mikael dot morin at sfr dot fr>
- To: Janus Weil <janus at gcc dot gnu dot org>
- Cc: gfortran <fortran at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 09 Aug 2013 17:33:32 +0200
- Subject: Re: [Patch, Fortran] gfc_get_code cleanup
- References: <CAKwh3qjMP1M69mnjngZ3NyTXOqqnge2mg2wSeLdPDj2PaWp8Cw at mail dot gmail dot com>
Le 06/08/2013 17:12, Janus Weil a écrit :
> Hi all,
>
> attached is a cleanup patch which concerns the gfc_code structure and
> gfc_get_code function (in st.c). It basically does two things:
>
> 1) It replaces the many occurrences of "XCNEW (gfc_code)" in class.c
> by "gfc_get_code ()", which internally sets the locus and saves us
> from doing it manually afterward.
>
> 2) It adds an argument "op" to gfc_get_code to directly set the .op
> component of gfc_code. Every time we set up a new gfc_code structure,
> we certainly want to set its op.
>
> 2b) There are a few instances where we do not set the op after calling
> gfc_get_code, but instead copy the whole structure from someplace
> else. For those cases I'm using "XCNEW (gfc_code)" now (which also
> avoids setting the locus twice).
>
> 2c) In one place I'm using "gfc_get_code (EXEC_NOP)" for technical
> reasons, see 'new_level' in parse.c.
>
> Both items (1) and (2) result in more compact code and save a few
> extra lines (see diffstat below). Regtested on
> x86_64-unknown-linux-gnu. Ok for trunk with a suitable ChangeLog?
>
Yes, thanks
Mikael