PATCH: flag_external and DECL_EXTERNAL documentation

David Korn dkorn@pixelpower.com
Fri Feb 2 02:12:00 GMT 2001


>-----Original Message-----
>From: Jason Merrill [ mailto:jason@redhat.com ]
>Sent: 02 February 2001 01:10


>> 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).
>
>The rs6000 port uses
>
>  ((TREE_ASM_WRITTEN || !TREE_PUBLIC) && ! DECL_WEAK).

  ...to set the SYMBOL_REF_FLAG, by any chance ?  There's a couple of
catches with that that I've discovered.  One is that TREE_ASM_WRITTEN isn't
set until the final pass begins outputting assembler, so this will only spot
public (global) functions, and not (what would be described in C as) 
module static functions.  You might like to search the archives for a 
thread or two with "tests TREE_ASM_WRITTEN too early" in the subject line;
deciding that a function exists in the current translation unit turns out to
be quite tricky.

      DaveK
-- 
The Boulder Pledge: "Under no circumstances will I ever purchase anything 
offered to me as the result of an unsolicited email message. Nor will I 
forward chain letters, petitions, mass mailings, or virus warnings to large 
numbers of others. This is my contribution to the survival of the online
community." 


**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************


More information about the Gcc-patches mailing list