From: Benjamin Kramer Date: Tue, 23 Apr 2013 14:42:47 +0000 (+0000) Subject: Make compares unsigned. The expression can't become negative anyways. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=dd3e2d90418de46b77a9dde3bb992390610e343a;p=clang Make compares unsigned. The expression can't become negative anyways. Silences a sign compare warning on 32 bit archs. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@180110 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/TextDiagnostic.cpp b/lib/Frontend/TextDiagnostic.cpp index ca4ad60c52..1572d0f1d0 100644 --- a/lib/Frontend/TextDiagnostic.cpp +++ b/lib/Frontend/TextDiagnostic.cpp @@ -1095,7 +1095,7 @@ void TextDiagnostic::emitSnippetAndCaret( unsigned ColNo = SM.getColumnNumber(FID, FileOffset); // Arbitrarily stop showing snippets when the line is too long. - static const ptrdiff_t MaxLineLengthToPrint = 4096; + static const size_t MaxLineLengthToPrint = 4096; if (ColNo > MaxLineLengthToPrint) return; @@ -1110,7 +1110,7 @@ void TextDiagnostic::emitSnippetAndCaret( ++LineEnd; // Arbitrarily stop showing snippets when the line is too long. - if (LineEnd - LineStart > MaxLineLengthToPrint) + if (size_t(LineEnd - LineStart) > MaxLineLengthToPrint) return; // Copy the line of code into an std::string for ease of manipulation.