[gfortran] Replace gfc_symtree in gfc_expr by gfc_symbol

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Mon Jun 7 13:08:00 GMT 2004


Since I will touch some of the expression handling code for the 
artificial variable work, I thought I'd do something first which I had 
planned to do for a while: this patch replaces the gfc_symtree *symtree 
in gfc_expr by a gfc_symbol.

Why?
Most code that touches the symtree component of a gfc_expr, actually 
does that in this way: expr->symtree->n.sym, i.e. it only deals with the 
symbol, not caring about the symtree. And this seems right: the symtree 
is a subobject of the namespace and meant to hold all symbols, the 
gfc_expr only has to deal with a single symbol, but not with the 
surrounding namespace.

Along the way I also changed iterator_stack to hold a gfc_symbol instead 
of a gfc_symtree, because only the symbol is needed.

Built and tested on i686-pc-linux with no regressions. This touches a 
lot of (most) files, and mostly in a very straightforward manner 
(s/symtree->n.sym/symbol/), so I chose not to list every single affected 
function in the ChangeLog.

Statistics: 129 lines added, 157 removed.

- Tobi

2004-06-07  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>

	* check.c, data.c, dependency.c, dump-parse-tree.c, intrinsic.c,
	io.c, match.c, primary.c, resolve.c, simplify.c, trans-array.c,
	trans-common.c, trans-expr.c, trans-intrinsic.c, trans-stmt.c:
	Use 'symbol' component of gfc_expr instead of 'symtree->n.sym'
	where appropriate.
	* array.c:  Same. Also use 'symbol' instead of 'symtree' in
	iterator_stack's.
	* expr.c (gfc_get_expression, gfc_build_conversion): Nullify
	'symbol' component instead of symtree component.
	(gfc_check_assign_symbol): Don't allocate a symtree.
	(ALL): Same as for the other files.
	* gfortran.h (gfc_expr): Replace component 'symtree' by
	component 'symbol'.
	(iterator_stack): Change component 'variable' from gfc_symtree
	to gfc_symbol.
	* interface.c (gfc_Extend_expr): No need to search through
	symtree any longer.
	(ALL): Same as for the other files.
	* module.c (mio_symtree_ref): Remove function and prototype.
	(mio_expr): Input/Output symbol instead of symtree.
	* trans-io.c (get_new_var_expr): No need to allocate symtree.
	(set_string): Same as in other files.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: sympatch.gz
Type: application/gzip
Size: 11151 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20040607/8cd13032/attachment.gz>


More information about the Fortran mailing list