summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBaptiste Lepilleur <gaiacrtn@free.fr>2009-11-24 09:53:17 +0000
committerBaptiste Lepilleur <gaiacrtn@free.fr>2009-11-24 09:53:17 +0000
commit6e787c94c54bc4d49794c6284306873090428aeb (patch)
tree87cc6a3eeb1b4fdaddcaec30c6a6ddc76a105fc5
parent01c095d4eba446240fb8b01de1e7cfad0502a46e (diff)
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.
-rw-r--r--ChangeLog6
-rw-r--r--NEWS4
-rw-r--r--include/cppunit/Portability.h8
-rw-r--r--include/cppunit/config/config-msvc6.h3
4 files changed, 20 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 61875e0..1526f8e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,10 +1,16 @@
2009-11-24 Baptiste Lepilleur <blep@users.sourceforge.net>
* src/cppunit/TestResult.cpp: flush stdout & stderr in destructor
to avoid message loss in case of crash (bug #2832029).
+
* include/cppunit/plugin/TestPlugIn.h:
* include/cppunit/plugin/TestPlugInDefaultImpl.h: added missing dllexport
for CppUnitTestPlugIn.
+ * 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.
+
2009-11-23 Baptiste Lepilleur <blep@users.sourceforge.net>
* src/DllPlugInTester/Makefile.am:
diff --git a/NEWS b/NEWS
index 2b355e6..8a9d859 100644
--- a/NEWS
+++ b/NEWS
@@ -2,6 +2,10 @@
----------------------
* Portability:
+ - Added support for macro CPPUNIT_UNIQUE_COUNTER to config-*.h. It
+ should expands to a unique number per translation unit. Default
+ to __LINE__ if not defined. Use __COUNTER__ on MSVS 7.0+.
+ (Bug #2031696)
* Compilation:
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