On Tue, May 16, 2017 at 11:18:01AM +0200, Theo Buehler wrote:
> Part of adventure's interesting internal obfuscation scheme makes clang
> very unhappy. It spews 240+ warnings of this kind:
> 
> /usr/src/games/adventure/wizard.c:71:17: warning: implicit conversion from 
> 'int' to 'char' changes value from 143 to -113
>       [-Wconstant-conversion]
>         strlcpy(magic, DECR(d,w,a,r,f), sizeof magic);
>                        ^~~~~~~~~~~~~~~
> /usr/src/games/adventure/hdr.h:159:33: note: expanded from macro 'DECR'
> #define DECR(a,b,c,d,e) decr(*#a+'+',*#b+'-',*#c+'#',*#d+'&',*#e+'%')
> 
> To avoid both, the warning and the signed underflow in decr(), let's do
> this no-op the other way around: subtract in the DECR macro and add back
> in decr().
> 
> Note that decr() is never called directly, it's only used via the
> DECR macro.

After the fix I did in gcc, you can also shut down selected warnings
just by adding -Wno-constant-conversion

Will work in gcc4, patch for gcc3 still awaiting review :)

Reply via email to