From 2ad432033999490ecf9222d587d01d271f5385b0 Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Thu, 16 Apr 2015 12:18:58 +0300 Subject: [PATCH] Range check without clang "always true" warning --- tinyxml2.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tinyxml2.cpp b/tinyxml2.cpp index c6845db..d47e8ca 100755 --- a/tinyxml2.cpp +++ b/tinyxml2.cpp @@ -1958,6 +1958,9 @@ void XMLDocument::PrintError() const TIXML_SNPRINTF( buf2, LEN, "%s", _errorStr2 ); } + // Should check INT_MIN <= _errorID && _errorId <= INT_MAX, but that + // causes a clang "always true" -Wtautological-constant-out-of-range-compare warning + TIXMLASSERT( 0 <= _errorID && XML_ERROR_COUNT - 1 <= INT_MAX ); printf( "XMLDocument error id=%d '%s' str1=%s str2=%s\n", static_cast( _errorID ), ErrorName(), buf1, buf2 ); }