This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: PATCH: flag_external and DECL_EXTERNAL documentation
- To: Jason Merrill <jason at redhat dot com>
- Subject: Re: PATCH: flag_external and DECL_EXTERNAL documentation
- From: Fergus Henderson <fjh at cs dot mu dot oz dot au>
- Date: Thu, 1 Feb 2001 22:38:43 +1100
- Cc: Lars Brinkhoff <lars dot spam at nocrew dot org>, gcc-patches at gcc dot gnu dot org
- References: <851ytk5ar9.fsf@junk.nocrew.org> <u9lmrsndp7.fsf@casey.cambridge.redhat.com> <85snly3ka8.fsf@junk.nocrew.org> <u9lmrqir64.fsf@casey.cambridge.redhat.com>
On 01-Feb-2001, Jason Merrill <jason@redhat.com> wrote:
> >>>>> "Lars" == Lars Brinkhoff <lars.spam@nocrew.org> writes:
>
> > Jason Merrill <jason@redhat.com> writes:
> >> No, this is wrong. DECL_EXTERNAL is set on a function declaration when
> >> created, but it is cleared in start_function if the declaration is also a
> >> definition.
>
> > Right. How about this patch?
>
> > -/* In a VAR_DECL or FUNCTION_DECL,
> > - nonzero means external reference:
> > - do not allocate storage, and refer to a definition elsewhere. */
> > +/* In a VAR_DECL or FUNCTION_DECL, nonzero means external reference:
> > + do not allocate storage, and refer to a definition elsewhere.
> > + Note that DECL_EXTERNAL is always set when a non-nested function is
> > + declared, and cleared when the function definition is encountered. */
>
> This is describing C-specific behavior, and should not be in a backend
> file. In C, function declarations are implicitly extern, but this may not
> be true of other languages.
>
> I think the existing comment is fine.
I think the existing comment in tree.h is fine (now that I understand
what the C front-end does!). But it might be helpful to add a comment
in c-decl.c, where it sets DECL_EXTERNAL, mentioning that start_function()
will clear that flag if it turns out to be a function definition
rather than just a declaration.
--
Fergus Henderson <fjh@cs.mu.oz.au> | "I have always known that the pursuit
| of excellence is a lethal habit"
WWW: <http://www.cs.mu.oz.au/~fjh> | -- the last words of T. S. Garp.