On Thu, 4 Dec 2014, Richard Biener wrote:

> OTOH this also means the user cannot provide a conforming
> implementation on his own and get that used by GCC without editing
> system headers or including a header with -isystem or similar
> tricks.

Well - you could have a pragma / attribute for that purpose (declaring 
"this program is providing a version of function X that has the semantics 
GCC expects for function X", so GCC can both generate and optimize calls).  
Such a pragma / attribute could also override targetm.libc_has_function 
(for the case of the user providing their own definition of something 
missing from their system's standard libraries).  A related case would be 
declaring somehow "I will be linking in libm, even though this translation 
unit doesn't appear to be using libm functions, so calls to libm functions 
can be implicitly generated", if GCC were made to avoid introducing uses 
of libm.  (Again, this would be a matter of providing a cleaner interface 
rather than something that currently can't be expressed at all - the 
proposed definition of what it means to use libm explicitly implies that 
"if (0) (void) sqrt (0);" says that libm is being used.)

-- 
Joseph S. Myers
jos...@codesourcery.com

Reply via email to