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]

Re: __FUNCTION__


On Wed, Oct 11, 2000 at 10:57:03AM -0700, Geoff Keating wrote:
> "Zack Weinberg" <zackw@stanford.edu> writes:
> 
> > On Wed, Oct 11, 2000 at 08:20:21AM -0400, Richard Kenner wrote:
> > > Ot appears to be broken because fancy_abort doesn't work right.
> > > Is this a known problem?
> > 
> > I reported it, with extensive analysis, in
> > http://gcc.gnu.org/ml/gcc-bugs/2000-10/msg00038.html.  No one replied.
> 
> I have added your testcase as gcc.c-torture/execute/20001011-1.c.

Thanks.

> I'm not sure that your patch is correct.  __FUNCTION__ should be
> either undeclared or empty outside functions, so you'd want to call
> declare_function_name() too.

That shouldn't be necessary.  The global bindings for __FUNCTION__ and
__PRETTY_FUNCTION__ are set up at the start of compilation, and
shadowed by declarations in each function.  __func__ is not bound at
file scope.  When we leave a function, poplevel discards the
per-function bindings, making the global ones visible again.

Anyway, that's how it's supposed to work - the bug, as I see it, is
that we don't do the shadowing for the second and all further
functions in a translation unit.  So we're left with the toplevel
version of __FUNCTION__ (empty string) in those areas.

zw

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