This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Patch, Fortran] PR 54997: -Wunused-function gives false warnings for procedures passed as actual argument


Hi all,

here is another patch to silence some more of the bogus warnings about
unused functions that gfortran is currently throwing (cf. also the
previous patch for PR 54224).

It fixes the usage of the 'referenced' attribute, which should only be
given to procedures which are actually 'used' (called/referenced).
Then TREE_USED is set according to this attribute, which in turn
silences the warning in the middle-end.

The patch was regtested on x86_64-unknown-linux-gnu. Ok for trunk?

Cheers,
Janus


2012-10-21  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/54997
	* decl.c (match_procedure_decl): Don't set 'referenced' attribute
	for PROCEDURE declarations.
	* parse.c (gfc_fixup_sibling_symbols,parse_contained): Don't set
	'referenced' attribute for all contained procedures.
	* trans-decl.c (gfc_get_symbol_decl): Allow for unreferenced procedures.
	(build_function_decl): Set TREE_USED for referenced procedures.

2012-10-21  Janus Weil  <janus@gcc.gnu.org>

	PR fortran/54997
	* gfortran.dg/warn_unused_function_2.f90: New.

Attachment: pr54997.diff
Description: Binary data

Attachment: warn_unused_function_2.f90
Description: Binary data


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]