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 16/03/07, Nathan Sidwell <> wrote:
Manuel López-Ibáñez wrote:

> 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.

namespace { struct X { void Foo () { X::Foo (); }}}

might just cut it.  Yes I know anonymous namespaces are not quite the same as
static, and I don't know if we'll check this, but it seems wise to copy the
idiom you've introduced.

I can copy the condition. Much better, I can put it inside mark_used so we don't have to duplicate it everywhere. But still we cannot catch the above case. We don't even catch

namespace {
   void foobar();
   void foobar() { return; }

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?


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