Merge pull request #253 from Dmitry-Me/getRidOfC4127InAssert
Suppress C4127 in asserts
diff --git a/tinyxml2.cpp b/tinyxml2.cpp
index 82c6646..42659f2 100755
--- a/tinyxml2.cpp
+++ b/tinyxml2.cpp
@@ -526,15 +526,8 @@
static const int cdataHeaderLen = 9;
static const int elementHeaderLen = 1;
-#if defined(_MSC_VER)
-#pragma warning ( push )
-#pragma warning ( disable : 4127 )
-#endif
TIXMLASSERT( sizeof( XMLComment ) == sizeof( XMLUnknown ) ); // use same memory pool
TIXMLASSERT( sizeof( XMLComment ) == sizeof( XMLDeclaration ) ); // use same memory pool
-#if defined(_MSC_VER)
-#pragma warning (pop)
-#endif
XMLNode* returnNode = 0;
if ( XMLUtil::StringEqual( p, xmlHeader, xmlHeaderLen ) ) {
TIXMLASSERT( sizeof( XMLDeclaration ) == _commentPool.ItemSize() );
diff --git a/tinyxml2.h b/tinyxml2.h
index 14993ef..530160f 100755
--- a/tinyxml2.h
+++ b/tinyxml2.h
@@ -77,7 +77,8 @@
#if defined(DEBUG)
# if defined(_MSC_VER)
-# define TIXMLASSERT( x ) if ( !(x)) { __debugbreak(); } //if ( !(x)) WinDebugBreak()
+# // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like
+# define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); } //if ( !(x)) WinDebugBreak()
# elif defined (ANDROID_NDK)
# include <android/log.h>
# define TIXMLASSERT( x ) if ( !(x)) { __android_log_assert( "assert", "grinliz", "ASSERT in '%s' at %d.", __FILE__, __LINE__ ); }
diff --git a/xmltest.cpp b/xmltest.cpp
index 764b471..79ecf88 100644
--- a/xmltest.cpp
+++ b/xmltest.cpp
@@ -295,6 +295,10 @@
mkdir( "resources/out/", S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH);
#endif
+ {
+ TIXMLASSERT( true );
+ }
+
if ( argc > 1 ) {
XMLDocument* doc = new XMLDocument();
clock_t startTime = clock();