From 91da2e5ab93302bbf728d2c71cd82fa143837321 Mon Sep 17 00:00:00 2001 From: Yedidya Feldblum Date: Fri, 22 Sep 2017 21:19:34 -0700 Subject: [PATCH] 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 --- folly/experimental/symbolizer/Symbolizer.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/folly/experimental/symbolizer/Symbolizer.cpp b/folly/experimental/symbolizer/Symbolizer.cpp index 64acdcb7..adf615f0 100644 --- a/folly/experimental/symbolizer/Symbolizer.cpp +++ b/folly/experimental/symbolizer/Symbolizer.cpp @@ -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(color) >= kColorMap.size()) { // catches underflow too return; } doPrint(kColorMap[color]); -- 2.34.1