This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 0/4] bitpos expansion summary reloaded
On Sat, 29 Sep 2012 20:11:41 +0200, Jan Kratochvil wrote:
> 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.
Or gcc with -Wconversion:
t.c: In function ‘main’:
t.c:5:3: warning: conversion to ‘int’ from ‘long int’ may alter its value [-Wconversion]
t.c:6:24: warning: conversion to ‘int’ from ‘long int’ may alter its value [-Wconversion]
With gcc-4.8+ featuring the carets:
t.c: In function ‘main’:
t.c:5:3: warning: conversion to ‘int’ from ‘long int’ may alter its value [-Wconversion]
reported = longvar;
^
t.c:6:24: warning: conversion to ‘int’ from ‘long int’ may alter its value [-Wconversion]
missed = longvar + a - b;
^
This way one can use --enable-targets=all currently incompatible with clang.
Jan