Warn implicit enum conversions
Giovanni Bajo
giovannibajo@libero.it
Mon Nov 22 18:52:00 GMT 2004
Richter, Jörg <Joerg.Richter@pdv-FS.de> wrote:
> I can't imagine, that this demand is so uncommon. Perhaps someone
> knows of a patch that does something like this? Or alternatively you
> can point me to some functions in gcc where I can start to try to
> implement it myself?
> Ah yes, I need it for C++.
Look into cp/cvt.c, ocp_convert(). It already handles errors for enum to enum
conversion and integer to enum conversion, so you can add your warning there.
Googling a bit should give you at list one link to a patch adding a new warning
message (get something recent!), so that you see all the places you need to
updated.
Remember to work on mainline, not a release branch.
Giovanni Bajo
More information about the Gcc
mailing list