built-in function 'exp' declared as non-function

Martin Sebor msebor@gmail.com
Thu Apr 11 02:26:00 GMT 2019


On 4/10/19 4:51 PM, Segher Boessenkool wrote:
> [ Please keep replies on the list.  Thanks. ]
> 
> On Wed, Apr 10, 2019 at 06:04:30PM +0200, phi gcc wrote:
>> I can't really change the Makefile so the --no-builtin is not too easy for me.
>>
>> The pragma seems not work on my gcc
>>
>> TC$ gcc --version
>> gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
>>
>> TC$ echo "#pragma GCC diagnostic ignored \"-Wbuiltin-declaration-mismatch\"
>> int exp;" | cc -c -x c -
>> <stdin>:2:5: warning: built-in function 'exp' declared as non-function

Disabling the built-in is far safer than disabling these warnings.
Some optimizations transform calls to library functions made by
the program and recognized as built-ins to those to other functions
that the program never explicitly calls.  When an incompatible symbol
with the same name as one of the other built-in functions is defined
in a program, calls to the other built-in will very likely crash.

It ought to be possible to disable built-ins using an attribute
or #pragma, like #pragma GCC optimize, but it doesn't work.  If
there isn't a way to do it, filing an enhancement request might
help.

Martin



More information about the Gcc-help mailing list