rename DEBUG define to TINYXML2_DEBUG

The original name is to general. This prevents possible name collisions with other defines, enums, etc. from projects where tinyxml2 is used.
This commit is contained in:
Peter Matula
2018-01-09 12:52:26 +01:00
parent 703f91e6b8
commit 50689919b7
6 changed files with 16 additions and 16 deletions

View File

@@ -27,7 +27,7 @@ set(GENERIC_LIB_SOVERSION "6")
################################
# Add definitions
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DTINYXML2_DEBUG")
################################
# Add targets

View File

@@ -135,7 +135,7 @@ def cmakeRule2( line ):
fileProcess( "CMakeLists.txt", cmakeRule2 )
print( "Release note:" )
print( '1. Build. g++ -Wall -DDEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe' )
print( '1. Build. g++ -Wall -DTINYXML2_DEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe' )
print( '2. Commit. git commit -am"setting the version to ' + versionStr + '"' )
print( '3. Tag. git tag ' + versionStr )
print( ' OR git tag -a ' + versionStr + ' -m [tag message]' )

View File

@@ -2037,7 +2037,7 @@ void XMLDocument::Clear()
DeleteNode(_unlinked[0]); // Will remove from _unlinked as part of delete.
}
#ifdef DEBUG
#ifdef TINYXML2_DEBUG
const bool hadError = Error();
#endif
ClearError();
@@ -2052,7 +2052,7 @@ void XMLDocument::Clear()
_attributePool.Trace( "attribute" );
#endif
#ifdef DEBUG
#ifdef TINYXML2_DEBUG
if ( !hadError ) {
TIXMLASSERT( _elementPool.CurrentAllocs() == _elementPool.Untracked() );
TIXMLASSERT( _attributePool.CurrentAllocs() == _attributePool.Untracked() );

View File

@@ -47,15 +47,15 @@ distribution.
*/
/*
gcc:
g++ -Wall -DDEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe
g++ -Wall -DTINYXML2_DEBUG tinyxml2.cpp xmltest.cpp -o gccxmltest.exe
Formatting, Artistic Style:
AStyle.exe --style=1tbs --indent-switches --break-closing-brackets --indent-preprocessor tinyxml2.cpp tinyxml2.h
*/
#if defined( _DEBUG ) || defined (__DEBUG__)
# ifndef DEBUG
# define DEBUG
# ifndef TINYXML2_DEBUG
# define TINYXML2_DEBUG
# endif
#endif
@@ -79,7 +79,7 @@ distribution.
#endif
#if defined(DEBUG)
#if defined(TINYXML2_DEBUG)
# if defined(_MSC_VER)
# // "(void)0," is for suppressing C4127 warning in "assert(false)", "assert(true)" and the like
# define TIXMLASSERT( x ) if ( !((void)0,(x))) { __debugbreak(); }
@@ -395,7 +395,7 @@ public:
}
--_currentAllocs;
Item* item = static_cast<Item*>( mem );
#ifdef DEBUG
#ifdef TINYXML2_DEBUG
memset( item, 0xfe, sizeof( *item ) );
#endif
item->next = _root;

View File

@@ -137,7 +137,7 @@
buildSettings = {
CONFIGURATION_BUILD_DIR = "$(SYMROOT)/Debug";
COPY_PHASE_STRIP = NO;
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = DEBUG;
"GCC_PREPROCESSOR_DEFINITIONS[arch=*]" = TINYXML2_DEBUG;
ONLY_ACTIVE_ARCH = YES;
SYMROOT = build;
};

View File

@@ -292,7 +292,7 @@ bool example_4()
int main( int argc, const char ** argv )
{
#if defined( _MSC_VER ) && defined( DEBUG )
#if defined( _MSC_VER ) && defined( TINYXML2_DEBUG )
_CrtMemCheckpoint( &startMemState );
// Enable MS Visual C++ debug heap memory leaks dump on exit
_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
@@ -1861,7 +1861,7 @@ int main( int argc, const char ** argv )
}
{
// If this doesn't assert in DEBUG, all is well.
// If this doesn't assert in TINYXML2_DEBUG, all is well.
tinyxml2::XMLDocument doc;
tinyxml2::XMLElement *pRoot = doc.NewElement("Root");
doc.DeleteNode(pRoot);
@@ -1876,7 +1876,7 @@ int main( int argc, const char ** argv )
}
{
// If this doesn't assert in DEBUG, all is well.
// If this doesn't assert in TINYXML2_DEBUG, all is well.
XMLDocument doc;
XMLElement* unlinkedRoot = doc.NewElement( "Root" );
XMLElement* linkedRoot = doc.NewElement( "Root" );
@@ -1886,7 +1886,7 @@ int main( int argc, const char ** argv )
}
{
// Should not assert in DEBUG
// Should not assert in TINYXML2_DEBUG
XMLPrinter printer;
}
@@ -2266,7 +2266,7 @@ int main( int argc, const char ** argv )
delete[] mem;
static const char* note =
#ifdef DEBUG
#ifdef TINYXML2_DEBUG
"DEBUG";
#else
"Release";
@@ -2280,7 +2280,7 @@ int main( int argc, const char ** argv )
printf("\nParsing dream.xml (%s): %.3f milli-seconds\n", note, duration);
}
#if defined( _MSC_VER ) && defined( DEBUG )
#if defined( _MSC_VER ) && defined( TINYXML2_DEBUG )
{
_CrtMemCheckpoint( &endMemState );