[gfortran] Enhance error reporting with attributes

Tobias Schlüter tobias.schlueter@physik.uni-muenchen.de
Mon Feb 7 21:19:00 GMT 2005


This patch passes an additional const char * to the gfc_add_* functions which
allows for the symbol name to be printed when issuing an error.  Only the
functions which are called in places where the symbol is known are changed
(some are only called when current_attr is the only information present), the
others are left untouched.

The change to parse_derived might look weird, but gfc_current_block is a
macro, which expands to a gfc_symbol*.

Bubblestrapped and tested on i686-pc-linux-gnu.  The idea and the list of
functions is from g95.

- Tobi

2005-02-07  Tobias Schlueter  <tobias.schlueter@physik.uni-muenchen.de>

	* gfortran.h (gfc_add_dimension, gfc_add_result, gfc_add_save,
	gfc_add_dummy, gfc_add_generic, gfc_add_in_common, gfc_add_data,
	gfc_add_in_namelist, gfc_add_sequence, gfc_add_function,
	gfc_add_subroutine, gfc_add_access, gfc_add_flavor, gfc_add_entry,
	gfc_add_procedure): Add argument.
	* array.c (gfc_set_array_spec), decl.c (var_element, get_proc_name,
	gfc_match_null, match_type_spec, match_attr_spec,
	gfc_match_formal_arglist, match_result, gfc_match_function_decl):
	Update callers to match.
	(gfc_match_entry) : Likewise, fix comment typo.
	(gfc_match_subroutine, attr_decl1, gfc_add_dimension,
	access_attr_decl, do_parm, gfc_match_save, gfc_match_modproc,
	gfc_match_derived_decl), match.c (gfc_match_label, gfc_add_flavor,
	gfc_match_call, gfc_match_common, gfc_match_block_data,
	gfc_match_namelist, gfc_match_module, gfc_match_st_function),
	parse.c (parse_derived, parse_interface, parse_contained),
	primary.c (gfc_match_rvalue, gfc_match_variable), resolve.c
	(resolve_formal_arglist, resolve_entries): Update callers.
	* symbol.c (check_conflict, check_used): Add new 'name' argument,
	use when printing error message.
	(gfc_add_dimension, gfc_add_result, gfc_add_save, gfc_add_dummy,
	gfc_add_generic, gfc_add_in_common, gfc_add_data,
	gfc_add_in_namelist, gfc_add_sequence, gfc_add_function,
	gfc_add_subroutine, gfc_add_access, gfc_add_flavor, gfc_add_entry,
	gfc_add_procedure): Add new 'name' argument.  Pass along to
	check_conflict and check_used.
	(gfc_add_allocatable, gfc_add_external, gfc_add_intrinsic,
	gfc_add_optional, gfc_add_pointer, gfc_add_target, gfc_add_elemental,
	gfc_add_pure, gfc_add_recursive, gfc_add_intent,
	gfc_add_explicit_interface, gfc_copy_attr): Pass NULL for new
	argument in calls to any of the modified functions.

-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: err.diff
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050207/5e6351e8/attachment.ksh>


More information about the Fortran mailing list