Re: [PATCH 0/4] bitpos expansion summary reloaded

Jan Kratochvil
2012-09-29T18:12:02Z

On Sat, 29 Sep 2012 19:39:38 +0200, Jan Kratochvil wrote:
> We need to either fix splint or (more likely) use a different tool, there are
> too many cases missed this way.

clang-3.0+ (Fedora-17+) can do it:

$ clang -o t t.c -Wshorten-64-to-32
t.c:5:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
reported = longvar;
~ ^~~~~~~
t.c:6:12: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
missed = longvar + a - b;
~ ^~~~~~~~~~~~~~~
2 warnings generated.

For GDB:
CC=clang CFLAGS="-Wshorten-64-to-32" ./configure --disable-werror;make

I did not analyse how to possibly reformat the warnings for their easier later
processing. The patchset will need some extensions but I think the current
completed work can be completely easily reused.

Thanks,
Jan