On 19/03/07, Nathan Sidwell <nathan@codesourcery.com> wrote:
> Manuel López-Ibáñez wrote:
>
> > I can copy the condition. Much better, I can put it inside mark_used
> > so we don't have to duplicate it everywhere.
>
> that seems a much better approach :)
>
Bad news. It produces ICE in:
libstdc++-v3/src/pool_allocator.cc:112: internal compiler error: in
build_call_a, at cp/call.c:325
if (TREE_CODE (function) == ADDR_EXPR
&& TREE_CODE (TREE_OPERAND (function, 0)) == FUNCTION_DECL)
{
decl = TREE_OPERAND (function, 0);
if (!TREE_USED (decl))
{
/* We invoke build_call directly for several library
functions. These may have been declared normally if
we're building libgcc, so we can't just check
DECL_ARTIFICIAL. */
gcc_assert (DECL_ARTIFICIAL (decl)
|| !strncmp (IDENTIFIER_POINTER (DECL_NAME (decl)),
"__", 2));
mark_used (decl);
}
}
DECL_ARTIFICIAL is false and IDENTIFIER_POINTER (DECL_NAME (decl)) is
"_M_allocate_chunk"
Any ideas?
> > It seems that check_global_declarations, which is the one that emits
> > the Wunused-function warnings, is not called for functions in an
> > anonymous namespace. I tried finding where the decision is made
> > without any success. Any ideas?
>
> sorry, nothing comes to mind. It is an orthogonal issue though, IMHO.
>
So what is the point in making my patch to worry about functions in
anonymous namespaces if anyway they are not equivalent to static with
respect to TREE_USED ? That is, no matter what my patch does, the
warning is not going to be emitted.
Cheers,
Manuel.