[llvm] 558caf6 - [MCParser] Fix a warning

Kazu Hirata via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 09:56:50 PDT 2022


Author: Kazu Hirata
Date: 2022-08-10T09:56:44-07:00
New Revision: 558caf6d2bab08c83c372a56124fee9c813186fa

URL: https://github.com/llvm/llvm-project/commit/558caf6d2bab08c83c372a56124fee9c813186fa
DIFF: https://github.com/llvm/llvm-project/commit/558caf6d2bab08c83c372a56124fee9c813186fa.diff

LOG: [MCParser] Fix a warning

This patch fixes:

  llvm/lib/MC/MCParser/COFFMasmParser.cpp:333:28: error: comparison of
  integers of different signs: 'unsigned int' and 'int'
  [-Werror,-Wsign-compare]

Added: 
    

Modified: 
    llvm/lib/MC/MCParser/COFFMasmParser.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/lib/MC/MCParser/COFFMasmParser.cpp b/llvm/lib/MC/MCParser/COFFMasmParser.cpp
index b89eea498d68..9109333cb467 100644
--- a/llvm/lib/MC/MCParser/COFFMasmParser.cpp
+++ b/llvm/lib/MC/MCParser/COFFMasmParser.cpp
@@ -330,7 +330,7 @@ bool COFFMasmParser::ParseDirectiveSegment(StringRef Directive, SMLoc Loc) {
                 .CaseLower("nocache", COFF::IMAGE_SCN_MEM_NOT_CACHED)
                 .CaseLower("discard", COFF::IMAGE_SCN_MEM_DISCARDABLE)
                 .Default(-1);
-        if (Characteristic == -1) {
+        if (Characteristic == static_cast<unsigned>(-1)) {
           return Error(KeywordLoc,
                        "Expected characteristic in SEGMENT directive; found '" +
                            Keyword + "'");


        


More information about the llvm-commits mailing list