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]

Re: [PING^2] [C/C++] PR c/4076 -Wunused doesn't warn about static function only called by itself


Manuel López-Ibáñez wrote:

Index: gcc/cp/semantics.c
===================================================================
--- gcc/cp/semantics.c (revision 122472)
+++ gcc/cp/semantics.c (working copy)
@@ -2852,7 +2852,8 @@ finish_id_expression (tree id_expression
if (TREE_CODE (first_fn) == TEMPLATE_DECL)
first_fn = DECL_TEMPLATE_RESULT (first_fn);
- if (!really_overloaded_fn (decl))
+ /* Recursive call does not count as usage. */
+ if (!really_overloaded_fn (decl) && decl != current_function_decl)
mark_used (first_fn);
if (!template_arg_p

what about the other mark_used earlier on in that function:


      if (scope)
	{
	  decl = (adjust_result_of_qualified_name_lookup
		  (decl, scope, current_class_type));

	  if (TREE_CODE (decl) == FUNCTION_DECL)
	    mark_used (decl);

why not similarly protect that? the other c++ bits are ok.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk


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