[Lldb-commits] [PATCH] EmulationStateARM: Don't have >= comparisons against dwarf_r0
Todd Fiala
tfiala at google.com
Wed Jul 30 13:49:37 PDT 2014
Or you can disable warnings for that type, right? "Don't warn about
comparsions to 0 for type {enum type}, because the whole reason I'm using
enums is so I don't have to worry about the value of the enum."
Don't let the compiler dictate writing less safe code.
That's like that lame switch coverage warning that tells you "you have a
(supposedly superfluous) default when all enum values are covered by the
switch". And if the compiler can guarantee that something else in the
program doesn't inadvertently permute the switch variable to a value
outside the values of the enum, then great. If not, that's a dangerous
warning. I can't tell you the number of times I was glad I had a default
with some kind of sanity check on a game server to tip off a gnarly memory
overwrite condition. Yet the easy thing to do here would be to remove the
default, and miss catching the case of a bogus value.
/rant off.
In this case, a comment is likely sufficient. Another way to work around
this is to use a range-check method where the lower and upper bounds are
passed in, which would likely preserve both the intent and eliminate the
warning in one foul swoop :-)
http://reviews.llvm.org/D4629
More information about the lldb-commits
mailing list