Warnings patrol

Zack Weinberg zack@codesourcery.com
Mon Jan 20 19:24:00 GMT 2003


Rainer Orth <ro@TechFak.Uni-Bielefeld.DE> writes:

> David Edelsohn <dje@watson.ibm.com> writes:
>>   
>> ! extern char *ldgetname PARAMS ((struct ldfile *, void *));
>>   
>>   /* COFF version to scan the name list of the loaded program for
>>      the symbols g++ uses for static constructors and destructors.
>
> I fear this change will break Tru64 UNIX builds (or at least generate a
> warning on that platform): ldgetname() is declared in <ldfcn.h> as
>
> extern  char    *ldgetname __((LDFILE *, pSYMR));
>
> with LDFILE != struct ldfile.  I suppose this is the reason why ldgetname
> is not currently prototyped.

The types of the actual arguments to ldgetname, when called, are
(LDFILE *, GCC_SYMENT *), where LDFILE is not defined in
collect2.c, and GCC_SYMENT is a #define to either SYMR or SYMENT
depending on whether EXTENDED_COFF is defined.  Presumably the
definitions of LDFILE, SYMR, SYMENT come from <ldfcn.h>, which is
included.

Since the whole issue here is that modern systems *do* prototype
ldgetname in <ldfcn.h> I would suggest the first thing to try is
delete the declaration of it in collect2.c.  If and only if someone
then complains about the missing declaration, then we can add a
conditional declaration as

extern char *ldgetname (LDFILE *, GCC_SYMENT *);

which should work okay with both the Tru64 and AIX definitions.

zw



More information about the Gcc-patches mailing list