[cfe-dev] Implicit declarations of builtins

Douglas Gregor dgregor at apple.com
Sun Jan 22 22:32:52 PST 2012



Sent from my iPhone

On Jan 22, 2012, at 2:54 PM, Eli Friedman <eli.friedman at gmail.com> wrote:

> On Sun, Jan 22, 2012 at 2:37 PM, Joerg Sonnenberger
> <joerg at britannica.bec.de> wrote:
>> Hi all,
>> I've just stumbled over a nasty surprise with the implicit prototypes
>> for library builtins. Consider the following input:
>> 
>> int main() { char *p = powl; return 0; }
>> 
>> This is from a configure test and expected to fail on NetBSD. Compiling
>> it with -O2 gives the expected
>> 
>> warning: implicitly declaring C library function 'powl' with type
>> 'long double (long double, long double)'
>> 
>> warning, but the undefined reference gets optimised away. Dow.
> 
> Hmm... IIRC, gcc only does implicit builtin declarations in contexts
> where the builtin is used as a function call.  Might be worth changing
> clang to follow gcc's example.

I agree. Clang should do the same. I could swear that it worked that way at one point. 

>> Even more
>> nasty: -Werror=implicit-function-declaration makes it still continue.
> 
> That's definitely a bug.
> 
> -Eli
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/cfe-dev



More information about the cfe-dev mailing list