From: Francis Visoiu Mistrih Date: Mon, 9 Sep 2019 19:47:25 +0000 (+0000) Subject: [Remarks] Fix warning for uint8_t < 0 comparison X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4e9325567eba24108f7030e2aaec2ff15ba3aa2d;p=llvm [Remarks] Fix warning for uint8_t < 0 comparison http://lab.llvm.org:8011/builders/clang-with-thin-lto-ubuntu/builds/19109/steps/build-stage1-compiler/logs/stdio git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@371443 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Remarks/BitstreamRemarkParser.cpp b/lib/Remarks/BitstreamRemarkParser.cpp index a65e845bd53..2da23623345 100644 --- a/lib/Remarks/BitstreamRemarkParser.cpp +++ b/lib/Remarks/BitstreamRemarkParser.cpp @@ -365,8 +365,8 @@ Error BitstreamRemarkParser::processCommonMeta( "Error while parsing BLOCK_META: missing container version."); if (Optional Type = MetaHelper.ContainerType) { - if (*Type < static_cast(BitstreamRemarkContainerType::First) || - *Type > static_cast(BitstreamRemarkContainerType::Last)) + // Always >= BitstreamRemarkContainerType::First since it's unsigned. + if (*Type > static_cast(BitstreamRemarkContainerType::Last)) return createStringError( std::make_error_code(std::errc::illegal_byte_sequence), "Error while parsing BLOCK_META: invalid container type."); @@ -493,8 +493,8 @@ BitstreamRemarkParser::processRemark(BitstreamRemarkParserHelper &Helper) { std::make_error_code(std::errc::illegal_byte_sequence), "Error while parsing BLOCK_REMARK: missing remark type."); - if (*Helper.Type < static_cast(Type::First) || - *Helper.Type > static_cast(Type::Last)) + // Always >= Type::First since it's unsigned. + if (*Helper.Type > static_cast(Type::Last)) return createStringError( std::make_error_code(std::errc::illegal_byte_sequence), "Error while parsing BLOCK_REMARK: unknown remark type.");