On Mon, 27 Jan 1997 21:33:48 +0000 (GMT), alan@lxorguk.ukuu.org.uk (Alan Cox) wrote:>> \begin{C-Legalese}>> If you pass the address of object to another compilation unit>> (i.e. source file), this object does not need to be extern; it>> can be static or allocated (but NOT automatic).>> \end{C-legalese}>Ah but the following isnt going to work>>foo.c>>static void flobble(int x)>{>	printf("Kersplat\n");>}>>bar.c>>extern void flobble(int);>>int main()>{>	register_kersplat_handler(flobble);>}Nobody has suggested making *every* symbol static, only those symbolswhich are currently external and are not referenced by name from othersources.  The above example is a valid case where flobble has to benon-static and does not apply to the real problem.What Thomas Koenig and I have been complaining about is the ~2,000external symbols that are not declared as static but neither are theyreferenced by name from other sources.  The fact that they may bepassed by address to other routines is irrelevant, their name scope islocal no matter what their use scope.My approach is simple - if there are no external references *by name*to a non-automatic symbol then that symbol should be static.  Restrictsusage checking to the local source, makes it easier to track down thereal usage of the symbol and lets gcc find unused non-automaticsymbols.As an example, see drivers/scsi/53c7,8xx.c.  gcc flags one of theprocedures as unused, it can only do that because the procedure iscorrectly defined as static.  Comment out that procedure and anothercouple of procedures become unused because they are static and theironly reference is from the first unused proc.  Result - the removal ofcode that is never used and a smaller driver.We cannot do this with many sources because their procs and globalvariables are not defined as static.  However *if* they are neverreferenced by name from other sources, why are they not defined asstatic?My current report is ftp://ftp.ocs.com.au/pub/extra_externals-2.1.23.gz