Re: [chrony-dev] [PATCH] Fix precision loss warnings

[ Thread Index | Date Index | More chrony.tuxfamily.org/chrony-dev Archives ]


On Sun, Aug 09, 2015 at 05:40:11PM +1200, Bryan Christianson wrote:
> Suppress precision loss warnings that result from long being typecast to int. In all cases the typecast is OK so this patch is designed to suppress the compiler warnings, assuming int is 32 bit on all platforms and long may be either 64 or 32 bits depending on platform and compiler used.

With what compiler do you see these warnings? Is it something similar to
the gcc -Wconversion -Wno-sign-conversion options and can it be
disabled?

When I enable the options I get 127 warnings with the current code.
That's quite a lot. I agree the warnings could be useful in detecting
a real bug, but I'm not sure if it's worth fixing and keeping the code
free of them. When I write new code, I rely on the implicit conversion
and this looks to me a bit like spoon-feeding the compiler.

What do others think?

> @@ -69,7 +69,9 @@ static int on_terminal = 0;
>  
>  static int no_dns = 0;
>  
> +#ifdef IP_RECVERR
>  static int recv_errqueue = 0;
> +#endif

This and some other hunks fix a different warning, don't they? That
shouldn't be included in a patch described as fixing the "loss of
precision" warnings. Please make a separate patch for that.

I'm not sure how your git workflow looks, maybe the git add -p command
could be useful for you to select the hunks if you don't use git gui,
tig, or similar. Also, git rebase -i is an extremely useful command
when preparing a patch series.

-- 
Miroslav Lichvar

-- 
To unsubscribe email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "unsubscribe" in the subject.
For help email chrony-dev-request@xxxxxxxxxxxxxxxxxxxx with "help" in the subject.
Trouble?  Email listmaster@xxxxxxxxxxxxxxxxxxxx.


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/