This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: __FUNCTION__
- To: Geoff Keating <geoffk at cygnus dot com>
- Subject: Re: __FUNCTION__
- From: "Zack Weinberg" <zackw at Stanford dot EDU>
- Date: Wed, 11 Oct 2000 16:20:15 -0700
- Cc: gcc-patches at gcc dot gnu dot org
- References: <10010111220.AA28747@vlsi1.ultra.nyu.edu> <20001011083210.H14744@wolery.stanford.edu> <jm4s2jntw0.fsf@envy.cygnus.com>
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