[Bug c/39170] cannot silence -Wconversion warnings for bit-fields
manu at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Sun Mar 8 03:30:00 GMT 2009
------- Comment #3 from manu at gcc dot gnu dot org 2009-03-08 03:30 -------
> The old behavior was just fine!
You absolutely did not understand what the old -Wconversion did.
http://gcc.gnu.org/wiki/NewWconversion
But if you still want the old behaviour, just use -Wtraditional-conversion.
> I'm sure many people do not even realize they are NOT getting implicit
> conversions warnings anymore because they are not caught by "-Wall"
See the FAQ in the link above.
> anymore. We only discovered this be tracing a bug in our code! We then
The new Wconversion is mentioned in the changes of GCC 4.3.
> turned on "-Wconversion" only to discover thousands of warnings with no
> way practical way to fix them.
I admit it is unfortunate that there is no way to specify casts to bit-fields.
But that is hardly the fault of Wconversion. Nonetheless, it could be possible
to use bitwise-and to tell Wconversion that some conversion is really desired.
Example:
struct foo
{
int a : 2;
};
void assign( struct foo v, int x )
{
v.a = x & 0x3;
}
Do you think this would be an acceptable solution? (I don't know if this works
now in GCC 4.4)
--
manu at gcc dot gnu dot org changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |manu at gcc dot gnu dot org
Status|UNCONFIRMED |WAITING
Summary|-Wconversion useless |cannot silence -Wconversion
| |warnings for bit-fields
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39170
More information about the Gcc-bugs
mailing list