[Patch, Fortran] OOP cleanup

Janus Weil janus@gcc.gnu.org
Sat May 15 18:59:00 GMT 2010


Hi all,

as suggested by Paul, this patch creates a new file "class.c", which
is used to collect some routines related to CLASS variables and the
implementation of polymorphism (via class containers and vtables). Up
to now these routines were scattered throughout the gfortran code. The
attached patch makes a start by moving some routines from expr.c and
symbol.c to the new class.c. The question is how far we push this.
Should we also move routines from e.g. resolve.c or trans-*.c, or are
they better left where they are? Probably I have missed some more
stuff which could be moved ...

Comments? Suggestions? Ok for trunk?

[Btw, after this re-shuffling of the polymorphism code I plan to do
some more cleanup. E.g. Tobias suggested to introduce encapsulating
routines for accessing attributes of class variables. This is very
much complicated by the presence of the class containers. It is
another thing which is scattered throughout the code, and depends
strongly on the internal representation of class variables. This point
surely could use some abstraction.]

Cheers,
Janus



2010-05-15  Janus Weil  <janus@gcc.gnu.org>

	* symbol.c (add_generic_specifics)
	(add_generics_to_declared_vtab, add_proc_component)
	(add_proc_comps, add_procs_to_declared_vtab)
	(add_procs_to_declared_vtab1, copy_vtab_proc_comps)
	(find_typebound_proc_uop, gfc_build_class_symbol)
	(gfc_find_derived_vtab, gfc_find_typebound_intrinsic_op)
	(gfc_find_typebound_proc, gfc_find_typebound_user_op)
	(gfc_get_tbp_symtree): Move to class.c.
	* class.c (gfc_add_component_ref)
	(gfc_class_null_initializer, gfc_build_class_symbol)
	(add_proc_component, add_proc_comps, add_procs_to_declared_vtab1)
	(copy_vtab_proc_comps, add_procs_to_declared_vtab)
	(add_generic_specifics, add_generics_to_declared_vtab)
	(gfc_find_derived_vtab, find_typebound_proc_uop)
	(gfc_find_typebound_proc, gfc_find_typebound_user_op)
	(gfc_find_typebound_intrinsic_op, gfc_get_tbp_symtree): Moved here from
	other places.
	* Make-lang.in: Add class.o.
	* gfortran.h (gfc_add_component_ref, gfc_class_null_initializer)
	(gfc_build_class_symbol,gfc_find_derived_vtab,gfc_find_typebound_proc)
	(gfc_find_typebound_user_op,gfc_find_typebound_intrinsic_op)
	(gfc_get_tbp_symtree): Moved to class.c
	* expr.c (gfc_add_component_ref,gfc_class_null_initializer): Moved to
	class.c.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: oop_cleanup.diff
Type: application/octet-stream
Size: 49147 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20100515/52b9079a/attachment.obj>


More information about the Fortran mailing list