This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC built-in functions


On 10-2-25 äå3:30, Steve Teale wrote:
> There's a fair chunk of code in GCC that builds tables of information
> about built-in functions.
> 
> I assume that these are there for good reason, and my guess was that
> they would obviate the need for many common header files, which in fact
I think built-in functions are more than functions. My understanding is that a
built-in function cannot be defined as a normal function and it needs the
special support of the compiler.
> they seem to do. But if I have a tiny program like:
> 
> int main()
> {
>     float f;
>     f = cos(1.0);
>     printf("%f\n", f);
>     return 0;
> }
> 
> compilation produces warnings:
> 
> steve@Ubuntu:~/scratch$ gcc nohead.c
> nohead.c: In function âmainâ:
> nohead.c:4: warning: incompatible implicit declaration of built-in
> function âcosâ
> nohead.c:5: warning: incompatible implicit declaration of built-in
> function âprintfâ
> steve@Ubuntu:~/scratch$ ./a.out
> 0.540302
> 
> The program runs. Why is gcc warning me about its own internals? Also,
> incompatible with what?
cos and printf are not built-in functions of GCC. They are defined in C library.
You don't provide their declarations, and I guess GCC somehow assume that they
are built-in functions.

Zheng Da


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]