This is the mail archive of the 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

On 15/03/07, Nathan Sidwell <> wrote:
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.


I could but I was not able to construct a case where it was necessary. How can a static function make a scoped recursive call? Sorry my knowledge of C++ is not so good.



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