From 6e787c94c54bc4d49794c6284306873090428aeb Mon Sep 17 00:00:00 2001 From: Baptiste Lepilleur Date: Tue, 24 Nov 2009 09:53:17 +0000 Subject: Include/cppunit/portability/config-msvc6. include/cppunit/portability/config-msvc6.h: * include/cppunit/portability/Portability.h: Added macro CPPUNIT_UNIQUE_COUNTER on MSVS 7.0+ using __COUNTER__ to fix bug #2031696. --- include/cppunit/Portability.h | 8 +++++++- include/cppunit/config/config-msvc6.h | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) (limited to 'include/cppunit') diff --git a/include/cppunit/Portability.h b/include/cppunit/Portability.h index ddf0316..591eb86 100644 --- a/include/cppunit/Portability.h +++ b/include/cppunit/Portability.h @@ -162,11 +162,17 @@ /// \internal #define _CPPUNIT_DO_JOIN2( symbol1, symbol2 ) symbol1##symbol2 +/// \internal Unique suffix for variable name. Can be overridden in platform specific +/// config-*.h. Default to line number. +#ifndef CPPUNIT_UNIQUE_COUNTER +# define CPPUNIT_UNIQUE_COUNTER __LINE__ +#endif + /*! Adds the line number to the specified string to create a unique identifier. * \param prefix Prefix added to the line number to create a unique identifier. * \see CPPUNIT_TEST_SUITE_REGISTRATION for an example of usage. */ -#define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, __LINE__ ) +#define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, CPPUNIT_UNIQUE_COUNTER ) /*! Defines wrap colunm for %CppUnit. Used by CompilerOuputter. */ diff --git a/include/cppunit/config/config-msvc6.h b/include/cppunit/config/config-msvc6.h index d688171..54bce82 100644 --- a/include/cppunit/config/config-msvc6.h +++ b/include/cppunit/config/config-msvc6.h @@ -78,6 +78,9 @@ //#define CPPUNIT_NO_NAMESPACE 1 */ +#if _MSC_VER >= 1300 // VS 7.0 +#define CPPUNIT_UNIQUE_COUNTER __COUNTER__ +#endif // if _MSC_VER >= 1300 // VS 7.0 /* _INCLUDE_CPPUNIT_CONFIG_MSVC6_H */ #endif -- cgit v1.2.1