[Patch, Fortran] gfc_get_code cleanup
Janus Weil
janus@gcc.gnu.org
Tue Aug 6 15:12:00 GMT 2013
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?
Cheers,
Janus
> diffstat gfc_code_cleanup_v2.diff
class.c | 180 +++++++++++++++--------------------------------------------
gfortran.h | 2
io.c | 18 +----
match.c | 58 +++++++------------
parse.c | 4 -
resolve.c | 30 +++------
st.c | 6 +
trans-expr.c | 3
trans-stmt.c | 3
9 files changed, 96 insertions(+), 208 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: gfc_code_cleanup_v2.diff
Type: application/octet-stream
Size: 31007 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20130806/3d556271/attachment.obj>
More information about the Fortran
mailing list