Bram Moolenaar <[email protected]> wrote:

>
> Christ van Willegen wrote:
>
>> I get the following during the compilation of Vim:
>>
>>
>> gcc -c -I. -Iproto -DHAVE_CONFIG_H     -g -O2 -U_FORTIFY_SOURCE
>> -D_FORTIFY_SOURCE=1       -o objects/ex_cmds2.o ex_cmds2.c
>> ex_cmds2.c: In function 'profile_divide':
>> ex_cmds2.c:985: warning: incompatible implicit declaration of built-in
>> function 'round'
>>
>> Apparently[*] -std=c99 needs to be added to the gcc flags.
>>
>> I'm not very familiar (...) with Vim's bild mechanism, not sure where
>> to add this. Any other info that needs to be provided?
>>
>> [*]: 
>> http://stackoverflow.com/questions/1783792/why-does-gcc-report-implicit-declaration-of-function-round
>
> Weird solution.  Adding -std=c99 changes much more than the round()
> header.  Not sure if that is such a good solution.  Vim works fine with
> c89 (ANSI C) and should work fine with that.
>
> The error message is also weird.  It does know about the built-in
> function, but then says it's implicitly declared.  That doesn't make
> sense.  It's not like it doesn't know about round().
>
> Anyway, it works fine for me without the c99 argument.  Thus it appears
> only some gcc installations suffer from this.
>
> I suppose we should use the workaround that's in eval.c in f_round().
>
> Well,


Elsewhere in Vim, we already have this:

src/eval.c:

15789         /* round() is not in C90, use ceil() or floor() instead. */
15790         rettv->vval.v_float = f > 0 ? floor(f + 0.5) : ceil(f - 0.5);

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Raspunde prin e-mail lui