Re: [Patch, Fortran] gfc_get_code cleanup
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
Re: [Patch, Fortran] gfc_get_code cleanup
2013/8/9 Mikael Morin mikael.mo...@sfr.fr: 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 Thanks, committed as r201635: http://gcc.gnu.org/viewcvs/gcc?limit_changes=0view=revisionrevision=201635 Cheers, Janus
[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(-) gfc_code_cleanup_v2.diff Description: Binary data