Re: gcc abusive builtins ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 30 November 2017 at 13:36, phi gcc <phi.gcc@xxxxxxxxx> wrote:
> Hi All,
>
> Still learning gcc, I discover a scary feature of gcc, I hope I
> misunderstand something.
>
> NC$ cat c.c
> #include <stdio.h>
> int exp2(){return(7);}
> int main()
> { printf("%d\n");
> }
>
> NC$ cc -c c.c
> c.c:2:5: warning: conflicting types for built-in function 'exp2'
>  int exp2(){return(7);}
>      ^~~~
>
> It's all sounds like gcc got its own idea about what I am trying to
> do, I don't include math.h on purpose, yet I got some magic builtins ?

This is the documented behaviour, see -fno-builtin in the manual:
https://gcc.gnu.org/onlinedocs/gcc/C-Dialect-Options.html#index-fno-builtin

> Is there a pragma I I could stuff in my own .h where exp2() is
> exported, I can't temper the Makefile.

No, I don't think there's a way to use -fno-builtin-* options via pragmas.

> So far I ended up with a
> #define exp2 my_exp2
>
> So at least the workaround is located in only one file, but now the
> habit of using exp2() as a BP target is impaired :(

Read the manual.

> Any pointers about #unbuiltin what gcc has builtined would be appreciated :)
>
> Cheers,
> Phi



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux