What's the best way to fix warnings from unused result

Hal Murray hmurray at megapathdsl.net
Sun Apr 7 11:11:11 UTC 2019


esr at thyrsus.com said:
> Probablty compiler version. As GCC has evolved it has gotten stricter about
> this sort of thing. 

Fedora 29, no warnings:
gcc (GCC) 8.3.1 20190223 (Red Hat 8.3.1-2)

Ubuntu 18.10, warnings
gcc (Ubuntu 8.2.0-7ubuntu1) 8.2.0

Ubuntu 18.04.2 LTS, warnings
gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0

---------

> This is probably what you want:
> ./include/ntp_stdlib.h:162:#define IGNORE(r) do{if(r){}}while(0)

Thanks.  Seems to be working.

While does that need the do/while around the if?  Doesn't the if alone do what 
we want?


-- 
These are my opinions.  I hate spam.





More information about the devel mailing list