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]

[Patch, Fortran] gfc_get_code cleanup


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(-)

Attachment: gfc_code_cleanup_v2.diff
Description: Binary data


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