Commit 91da2e5a authored by Yedidya Feldblum's avatar Yedidya Feldblum Committed by Facebook Github Bot

Avoid tautological compare in folly/experimental/symbolizer/

Summary:
[Folly] Avoid tautological compare in `folly/experimental/symbolizer/`.

`x < 0` when `x` is unsigned is tautological and there are warnings against such comparisons. The underlying type of an unscoped enumerations without a fixed underlying type is not specified, and whether it is signed is also not specified; it could be unsigned, and is unsigned in practice in common cases.

Reviewed By: Orvid, eduardo-elizondo

Differential Revision: D5897792

fbshipit-source-id: 24d84f9bf2c61c907585e1b675c2bbf11ef1720b
parent 47d37c8e
......@@ -249,7 +249,7 @@ void SymbolizePrinter::color(SymbolizePrinter::Color color) {
if ((options_ & COLOR) == 0 && ((options_ & COLOR_IF_TTY) == 0 || !isTty_)) {
return;
}
if (color < 0 || color >= kColorMap.size()) {
if (static_cast<size_t>(color) >= kColorMap.size()) { // catches underflow too
return;
}
doPrint(kColorMap[color]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment