egcs, does gcc fixincludes etc guarantee a stdlib.h exists?

Philippe De Muyter phdm@macqel.be
Mon Apr 20 04:16:00 GMT 1998


> 
> 	We also need a prototype if the return convention for pointers and ints
> 	are different (e.g. on some m68k systems : d0 for ints a0 for pointers)
> 
> Good point.  However, I think the same reasoning applies here.  Either these
> systems must already have appropriate declarations in the system headers, or
> else the compiler must already be using a safe ABI (e.g. some m68k systems
> return pointers in both a0 and d0 just to be safe).  Otherwise, the compiler
> that came with the system wouldn't work.

The declarations provided are not necessarily in stdlib.h (especially when
there is no stdlib.h :)), but can be in malloc.h e.g., or only in the
man pages.

> 
> 	Another reason for needing a prototype is when we take the address
> 	of the function.
> 
> Not clear what you mean.  A prototype is certainly desirable, but it is not
> obvious that it is required.

I meant 'a declaration' but that was a side note.  That happens in the support
library for ObjC : one module takes the address of malloc, free and friends
to initialize some structure fields.  If malloc and friends are not declared
before as being functions, the compilation fails.

> 
> If there is a problem, then we certainly should fix it, but I don't believe
> that defining __USE_FIXED_PROTOTYPES__ is a good solution.
> 
> Jim
> 

Perhaps could we put malloc and friends outside of __USE_FIXED_PROTOTYPES__
in the generated stdlib.h, even without a parameter list if a parameter list
seems risky ?



More information about the Gcc mailing list