[fortran-exp, patch] get_expr code cleanup, part I
Daniel Franke
franke.daniel@gmail.com
Sun Jan 3 15:40:00 GMT 2010
Hi all.
There are a batch of function that build expressions and pre-initialize them.
In particular:
arith.c (gfc_constant_result (bt type, int kind, locus*))
constructor.c (gfc_build_array_expr (gfc_typespec*, locus*))
constructor.c (gfc_build_structure_constructor_expr (gfc_typespec*, locus*))
expr.c (gfc_int_expr (int))
expr.c (gfc_logical_expr (int, locus*))
As you can see, not only are they scattered between the files, their naming
and argument lists are somewhat inconsistent, too. Attached patch moves all
functions to the beginning of expr.c and names them gfc_get_<something>_expr.
Further, all these functions now take 'kind' and 'where' parameters. All other
changes are fix-ups of the respective function calls.
As a second step, I'll go comb through the sources and replace manual building
of such expressions by their corresponding function calls, adding
gfc_get_null_expr and others as required.
Regression tested on i686-pc-linux-gnu. Ok for fortran-exp?
Cheers
Daniel
2010-01-03 Daniel Franke <franke.daniel@gmail.com>
* arith.h (gfc_constant_result): Removed prototype.
* constructor.h (gfc_build_array_expr): Removed prototype.
(gfc_build_structure_constructor_expr): Removed prototype.
* gfortran.h (gfc_int_expr): Removed prototype.
(gfc_logical_expr): Removed prototype.
(gfc_get_array_expr): New prototype.
(gfc_get_structure_constructor_expr): New prototype.
(gfc_get_constant_expr): New prototype.
(gfc_get_int_expr): New prototype.
(gfc_get_logical_expr): New prototype.
* arith.c (gfc_constant_result): Moved and renamed to
expr.c (gfc_get_constant_expr). Fixed all callers.
* constructor.c (gfc_build_array_expr): Moved and renamed to
expr.c (gfc_get_array_expr). Split gfc_typespec argument to type
and kind. Fixed all callers.
(gfc_build_structure_constructor_expr): Moved and renamed to
expr.c (gfc_get_structure_constructor_expr). Split gfc_typespec argument
to type and kind. Fixed all callers.
* expr.c (gfc_logical_expr): Renamed to ...
(gfc_get_logical_expr): ... this. Added kind argument. Fixed all callers.
(gfc_int_expr): Renamed to ...
(gfc_get_int_expr): ... this. Added kind and where arguments. Fixed all
callers.
(gfc_get_constant_expr): New.
(gfc_get_array_expr): New.
(gfc_get_structure_constructor_expr): New.
* simplify.c (int_expr_with_kind): Removed, callers use gfc_get_int_expr
instead.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: get-expr-cleanup-1.diff.gz
Type: application/x-gzip
Size: 15747 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20100103/e589aef3/attachment.bin>
More information about the Gcc-patches
mailing list