1 #ifndef CPPUNIT_PORTABILITY_H
2 #define CPPUNIT_PORTABILITY_H
4 #if defined(_WIN32) && !defined(WIN32)
8 /* include platform specific config */
9 #if defined(__BORLANDC__)
10 # include <cppunit/config/config-bcb5.h>
11 #elif defined (_MSC_VER)
12 # if _MSC_VER == 1200 && defined(_WIN32_WCE) //evc4
13 # include <cppunit/config/config-evc4.h>
15 # include <cppunit/config/config-msvc6.h>
18 # include <cppunit/config-auto.h>
21 // Version number of package
22 #ifndef CPPUNIT_VERSION
23 #define CPPUNIT_VERSION "1.12.0"
26 #include <cppunit/config/CppUnitApi.h> // define CPPUNIT_API & CPPUNIT_NEED_DLL_DECL
27 #include <cppunit/config/SelectDllLoader.h>
30 /* Options that the library user may switch on or off.
31 * If the user has not done so, we chose default values.
35 /* Define to 1 if you wish to have the old-style macros
36 assert(), assertEqual(), assertDoublesEqual(), and assertLongsEqual() */
37 #if !defined(CPPUNIT_ENABLE_NAKED_ASSERT)
38 # define CPPUNIT_ENABLE_NAKED_ASSERT 0
41 /* Define to 1 if you wish to have the old-style CU_TEST family
43 #if !defined(CPPUNIT_ENABLE_CU_TEST_MACROS)
44 # define CPPUNIT_ENABLE_CU_TEST_MACROS 0
47 /* Define to 1 if the preprocessor expands (#foo) to "foo" (quotes incl.)
48 I don't think there is any C preprocess that does NOT support this! */
49 #if !defined(CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION)
50 # define CPPUNIT_HAVE_CPP_SOURCE_ANNOTATION 1
53 /* Assumes that STL and CppUnit are in global space if the compiler does not
55 #if !defined(CPPUNIT_HAVE_NAMESPACES)
56 # if !defined(CPPUNIT_NO_NAMESPACE)
57 # define CPPUNIT_NO_NAMESPACE 1
58 # endif // !defined(CPPUNIT_NO_NAMESPACE)
59 # if !defined(CPPUNIT_NO_STD_NAMESPACE)
60 # define CPPUNIT_NO_STD_NAMESPACE 1
61 # endif // !defined(CPPUNIT_NO_STD_NAMESPACE)
62 #endif // !defined(CPPUNIT_HAVE_NAMESPACES)
64 /* Define CPPUNIT_STD_NEED_ALLOCATOR to 1 if you need to specify
65 * the allocator you used when instantiating STL container. Typically
66 * used for compilers that do not support template default parameter.
67 * CPPUNIT_STD_ALLOCATOR will be used as the allocator. Default is
68 * std::allocator. On some compilers, you may need to change this to
71 #if CPPUNIT_STD_NEED_ALLOCATOR
72 # if !defined(CPPUNIT_STD_ALLOCATOR)
73 # define CPPUNIT_STD_ALLOCATOR std::allocator
74 # endif // !defined(CPPUNIT_STD_ALLOCATOR)
75 #endif // defined(CPPUNIT_STD_NEED_ALLOCATOR)
78 // Compiler error location format for CompilerOutputter
79 // If not define, assumes that it's gcc
80 // See class CompilerOutputter for format.
81 #if !defined(CPPUNIT_COMPILER_LOCATION_FORMAT)
82 #if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) )
83 // gcc/Xcode integration on Mac OS X
84 # define CPPUNIT_COMPILER_LOCATION_FORMAT "%p:%l: "
86 # define CPPUNIT_COMPILER_LOCATION_FORMAT "%f:%l:"
90 // If CPPUNIT_HAVE_CPP_CAST is defined, then c++ style cast will be used,
91 // otherwise, C style cast are used.
92 #if defined( CPPUNIT_HAVE_CPP_CAST )
93 # define CPPUNIT_CONST_CAST( TargetType, pointer ) \
94 const_cast<TargetType>( pointer )
96 # define CPPUNIT_STATIC_CAST( TargetType, pointer ) \
97 static_cast<TargetType>( pointer )
98 #else // defined( CPPUNIT_HAVE_CPP_CAST )
99 # define CPPUNIT_CONST_CAST( TargetType, pointer ) \
100 ((TargetType)( pointer ))
101 # define CPPUNIT_STATIC_CAST( TargetType, pointer ) \
102 ((TargetType)( pointer ))
103 #endif // defined( CPPUNIT_HAVE_CPP_CAST )
105 // If CPPUNIT_NO_STD_NAMESPACE is defined then STL are in the global space.
106 // => Define macro 'std' to nothing
107 #if defined(CPPUNIT_NO_STD_NAMESPACE)
110 #endif // defined(CPPUNIT_NO_STD_NAMESPACE)
112 // If CPPUNIT_NO_NAMESPACE is defined, then put CppUnit classes in the
113 // global namespace: the compiler does not support namespace.
114 #if defined(CPPUNIT_NO_NAMESPACE)
115 # define CPPUNIT_NS_BEGIN
116 # define CPPUNIT_NS_END
118 #else // defined(CPPUNIT_NO_NAMESPACE)
119 # define CPPUNIT_NS_BEGIN namespace CppUnit {
120 # define CPPUNIT_NS_END }
121 # define CPPUNIT_NS CppUnit
122 #endif // defined(CPPUNIT_NO_NAMESPACE)
124 /*! Stringize a symbol.
126 * Use this macro to convert a preprocessor symbol to a string.
130 * #define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTestPlugIn
131 * const char *name = CPPUNIT_STRINGIZE( CPPUNIT_PLUGIN_EXPORTED_NAME );
134 #define CPPUNIT_STRINGIZE( symbol ) _CPPUNIT_DO_STRINGIZE( symbol )
137 #define _CPPUNIT_DO_STRINGIZE( symbol ) #symbol
139 /*! Joins to symbol after expanding them into string.
141 * Use this macro to join two symbols. Example of usage:
144 * #define MAKE_UNIQUE_NAME(prefix) CPPUNIT_JOIN( prefix, __LINE__ )
147 * The macro defined in the example concatenate a given prefix with the line number
148 * to obtain a 'unique' identifier.
150 * \internal From boost documentation:
151 * The following piece of macro magic joins the two
152 * arguments together, even when one of the arguments is
153 * itself a macro (see 16.3.1 in C++ standard). The key
154 * is that macro expansion of macro arguments does not
155 * occur in CPPUNIT_JOIN2 but does in CPPUNIT_JOIN.
157 #define CPPUNIT_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN( symbol1, symbol2 )
160 #define _CPPUNIT_DO_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN2( symbol1, symbol2 )
163 #define _CPPUNIT_DO_JOIN2( symbol1, symbol2 ) symbol1##symbol2
165 /// \internal Unique suffix for variable name. Can be overridden in platform specific
166 /// config-*.h. Default to line number.
167 #ifndef CPPUNIT_UNIQUE_COUNTER
168 # define CPPUNIT_UNIQUE_COUNTER __LINE__
171 /*! Adds the line number to the specified string to create a unique identifier.
172 * \param prefix Prefix added to the line number to create a unique identifier.
173 * \see CPPUNIT_TEST_SUITE_REGISTRATION for an example of usage.
175 #define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, CPPUNIT_UNIQUE_COUNTER )
177 /*! Defines wrap colunm for %CppUnit. Used by CompilerOuputter.
179 #if !defined(CPPUNIT_WRAP_COLUMN)
180 # define CPPUNIT_WRAP_COLUMN 79
183 #endif // CPPUNIT_PORTABILITY_H