public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* c++ vs decl_external
@ 2002-04-03  3:44 Richard Henderson
  2002-04-03 13:23 ` Mark Mitchell
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2002-04-03  3:44 UTC (permalink / raw)
  To: gcc

Why is it that _all_ functions are marked DECL_EXTERNAL (in grokfndecl)?
I thought that was supposed to mean not-present-this-UOT.


r~

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: c++ vs decl_external
  2002-04-03  3:44 c++ vs decl_external Richard Henderson
@ 2002-04-03 13:23 ` Mark Mitchell
  2002-04-03 13:41   ` Richard Henderson
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Mitchell @ 2002-04-03 13:23 UTC (permalink / raw)
  To: Richard Henderson, gcc



--On Wednesday, April 03, 2002 02:56:25 AM -0800 Richard Henderson 
<rth@redhat.com> wrote:

> Why is it that _all_ functions are marked DECL_EXTERNAL (in grokfndecl)?
> I thought that was supposed to mean not-present-this-UOT.

IIRC, they get unmarked later.  This is the 
slightly-odd-but-always-been-with-us DECL_NOT_REALLY_EXTERN bit.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: c++ vs decl_external
  2002-04-03 13:23 ` Mark Mitchell
@ 2002-04-03 13:41   ` Richard Henderson
  2002-04-03 14:19     ` Mark Mitchell
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Henderson @ 2002-04-03 13:41 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: gcc

On Wed, Apr 03, 2002 at 01:19:02PM -0800, Mark Mitchell wrote:
> IIRC, they get unmarked later.  This is the 
> slightly-odd-but-always-been-with-us DECL_NOT_REALLY_EXTERN bit.

In a case I'm looking at, it doesn't.

I'll check in a patch and (failing) test case to mainline here
in a minute and someone familiar with that slightly-oddness can
look at it.  The problem is not urgent -- we simply fail to
emit an unused function warning when we ought.


r~

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: c++ vs decl_external
  2002-04-03 13:41   ` Richard Henderson
@ 2002-04-03 14:19     ` Mark Mitchell
  2002-04-03 15:13       ` Jason Merrill
  0 siblings, 1 reply; 6+ messages in thread
From: Mark Mitchell @ 2002-04-03 14:19 UTC (permalink / raw)
  To: Richard Henderson; +Cc: gcc



--On Wednesday, April 03, 2002 01:38:31 PM -0800 Richard Henderson 
<rth@redhat.com> wrote:

> On Wed, Apr 03, 2002 at 01:19:02PM -0800, Mark Mitchell wrote:
>> IIRC, they get unmarked later.  This is the
>> slightly-odd-but-always-been-with-us DECL_NOT_REALLY_EXTERN bit.
>
> In a case I'm looking at, it doesn't.
>
> I'll check in a patch and (failing) test case to mainline here
> in a minute and someone familiar with that slightly-oddness can
> look at it.  The problem is not urgent -- we simply fail to
> emit an unused function warning when we ought.

Ah.

The game we're playing is that we don't want the back end to see
definitions of functions it doesn't really need to generate RTL for,
and we prevent this by the somewhat extreme technique of setting
DECL_EXTERNAL.  Since we didn't need the function, we didn't ever
unset DECL_EXTERNAL, hence no warning.

There is also this cryptic comment in cp-tree.h:

/* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
   so that assemble_external will work properly.  So we have this flag to
   tell us whether the decl is really not external.  */

Definitely this is something of a mess.  It's always bad when you play
games with flags that are supposed to be shared in common code.

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: c++ vs decl_external
  2002-04-03 14:19     ` Mark Mitchell
@ 2002-04-03 15:13       ` Jason Merrill
  2002-04-03 15:42         ` Mark Mitchell
  0 siblings, 1 reply; 6+ messages in thread
From: Jason Merrill @ 2002-04-03 15:13 UTC (permalink / raw)
  To: Mark Mitchell; +Cc: Richard Henderson, gcc

>>>>> "Mark" == Mark Mitchell <mark@codesourcery.com> writes:

> The game we're playing is that we don't want the back end to see
> definitions of functions it doesn't really need to generate RTL for,
> and we prevent this by the somewhat extreme technique of setting
> DECL_EXTERNAL.  Since we didn't need the function, we didn't ever
> unset DECL_EXTERNAL, hence no warning.

Yes.

> There is also this cryptic comment in cp-tree.h:

> /* DECL_EXTERNAL must be set on a decl until the decl is actually emitted,
>    so that assemble_external will work properly.  So we have this flag to
>    tell us whether the decl is really not external.  */

What's cryptic about this?  If we don't emit a definition of the function,
we need references to pass through assemble_external.  It's just like a
prototype followed by a call, which may or may not be followed by a
definition.

> Definitely this is something of a mess.  It's always bad when you play
> games with flags that are supposed to be shared in common code.

I have a plan (and partial patch) to overhaul the linkage code, which I
intend to get back to after 3.1.0 goes out.  I meant to get it into 3.1,
but it didn't happen.

Jason

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: c++ vs decl_external
  2002-04-03 15:13       ` Jason Merrill
@ 2002-04-03 15:42         ` Mark Mitchell
  0 siblings, 0 replies; 6+ messages in thread
From: Mark Mitchell @ 2002-04-03 15:42 UTC (permalink / raw)
  To: Jason Merrill; +Cc: Richard Henderson, gcc

>> There is also this cryptic comment in cp-tree.h:
>
>> /* DECL_EXTERNAL must be set on a decl until the decl is actually
>> emitted, so that assemble_external will work properly.  So we have this
>>    flag to tell us whether the decl is really not external.  */
>
> What's cryptic about this?  If we don't emit a definition of the function,
> we need references to pass through assemble_external.  It's just like a
> prototype followed by a call, which may or may not be followed by a
> definition.

Crypticity is in the eye of the beholder. :-)

Perhaps I should just have said that I didn't fully understand it.

Thanks for the explanation!

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-04-03 23:25 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-03  3:44 c++ vs decl_external Richard Henderson
2002-04-03 13:23 ` Mark Mitchell
2002-04-03 13:41   ` Richard Henderson
2002-04-03 14:19     ` Mark Mitchell
2002-04-03 15:13       ` Jason Merrill
2002-04-03 15:42         ` Mark Mitchell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).