From 0aa36101f47857301dbfb1dd3e5e05aedb5cdd31 Mon Sep 17 00:00:00 2001 From: brianhall77 Date: Thu, 4 Jan 2018 16:03:03 -0800 Subject: [PATCH] Portable range check for *cursor_ value. (#4582) Avoids the following compile error when char is unsigned: error: comparison of unsigned expression >= 0 is always true [-Werror,-Wtautological-unsigned-zero-compare] --- src/idl_parser.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/idl_parser.cpp b/src/idl_parser.cpp index dc8f58132..e89a39151 100644 --- a/src/idl_parser.cpp +++ b/src/idl_parser.cpp @@ -280,7 +280,7 @@ CheckedError Parser::Next() { int unicode_high_surrogate = -1; while (*cursor_ != c) { - if (*cursor_ < ' ' && *cursor_ >= 0) + if (*cursor_ < ' ' && static_cast(*cursor_) >= 0) return Error("illegal character in string constant"); if (*cursor_ == '\\') { cursor_++;