aef7feb3e6
"Find explicit casts from signed to unsigned integer in comparison against
unsigned integer, where the cast is presumably used to avoid warnings about
signed vs. unsigned comparisons, and could thus be replaced with
o3tl::make_unsigned for clairty." (compilerplugins/clang/unsignedcompare.cxx)
o3tl::make_unsigned requires its argument to be non-negative, and there is a
chance that some original code like
static_cast<sal_uInt32>(n) >= c
used the explicit cast to actually force a (potentially negative) value of
sal_Int32 to be interpreted as an unsigned sal_uInt32, rather than using the
cast to avoid a false "signed vs. unsigned comparison" warning in a case where
n is known to be non-negative. It appears that restricting this plugin to non-
equality comparisons (<, >, <=, >=) and excluding equality comparisons (==, !=)
is a useful heuristic to avoid such false positives. The only remainging false
positive I found was
|
||
---|---|---|
.. | ||
beans | ||
chart | ||
container | ||
diff | ||
document | ||
drawing | ||
helper | ||
lang | ||
sheet | ||
style | ||
table | ||
text | ||
util | ||
view | ||
bootstrapfixture.cxx | ||
calc_unoapi_test.cxx | ||
callgrind.cxx | ||
htmltesttools.cxx | ||
isheadless.hxx | ||
screenshot_test.cxx | ||
setupvcl.cxx | ||
unoapi_property_testers.cxx | ||
unoapi_test.cxx | ||
vclbootstrapprotector.cxx | ||
xmltesttools.cxx |