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: Lars Brinkhoff <lars dot spam at nocrew dot org>
- Date: 01 Feb 2001 14:15:32 +0100
- Cc: gcc-patches at gcc dot gnu dot org
- Organization: nocrew
- References: <851ytk5ar9.fsf@junk.nocrew.org> <u9lmrsndp7.fsf@casey.cambridge.redhat.com> <85snly3ka8.fsf@junk.nocrew.org> <u9lmrqir64.fsf@casey.cambridge.redhat.com>
Jason Merrill <jason@redhat.com> writes:
> > -/* 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.
In the back end I'm currently writing, whenever a function call is to
be generated I need to know whether the function is defined in the
current translation unit or not. After reading the comment, I thought
DECL_EXTERNAL provided that information.
Since DECL_EXTERNAL doesn't quite work for this, is there another way
to find out whether a function is defined in the current translation
unit? I'm assuming that the user may have to explicitly declare this
(i.e. declaring a function to be "extern", or not, in C).
--
http://lars.nocrew.org/