1 | #ifndef CPPUNIT_PORTABILITY_H |
---|
2 | #define CPPUNIT_PORTABILITY_H |
---|
3 | |
---|
4 | #if defined(_WIN32) && !defined(WIN32) |
---|
5 | # define WIN32 1 |
---|
6 | #endif |
---|
7 | |
---|
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> |
---|
14 | # else |
---|
15 | # include <cppunit/config/config-msvc6.h> |
---|
16 | # endif |
---|
17 | #else |
---|
18 | # include <cppunit/config-auto.h> |
---|
19 | #endif |
---|
20 | |
---|
21 | // Version number of package |
---|
22 | #ifndef CPPUNIT_VERSION |
---|
23 | #define CPPUNIT_VERSION "1.12.0" |
---|
24 | #endif |
---|
25 | |
---|
26 | #include <cppunit/config/CppUnitApi.h> // define CPPUNIT_API & CPPUNIT_NEED_DLL_DECL |
---|
27 | #include <cppunit/config/SelectDllLoader.h> |
---|
28 | |
---|
29 | |
---|
30 | /* Options that the library user may switch on or off. |
---|
31 | * If the user has not done so, we chose default values. |
---|
32 | */ |
---|
33 | |
---|
34 | |
---|
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 |
---|
39 | #endif |
---|
40 | |
---|
41 | /* Define to 1 if you wish to have the old-style CU_TEST family |
---|
42 | of macros. */ |
---|
43 | #if !defined(CPPUNIT_ENABLE_CU_TEST_MACROS) |
---|
44 | # define CPPUNIT_ENABLE_CU_TEST_MACROS 0 |
---|
45 | #endif |
---|
46 | |
---|
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 |
---|
51 | #endif |
---|
52 | |
---|
53 | /* Assumes that STL and CppUnit are in global space if the compiler does not |
---|
54 | support namespace. */ |
---|
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) |
---|
63 | |
---|
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 |
---|
69 | * std::allocator<T>. |
---|
70 | */ |
---|
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) |
---|
76 | |
---|
77 | |
---|
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: " |
---|
85 | #else |
---|
86 | # define CPPUNIT_COMPILER_LOCATION_FORMAT "%f:%l:" |
---|
87 | #endif |
---|
88 | #endif |
---|
89 | |
---|
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 ) |
---|
95 | |
---|
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 ) |
---|
104 | |
---|
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) |
---|
108 | # undef std |
---|
109 | # define std |
---|
110 | #endif // defined(CPPUNIT_NO_STD_NAMESPACE) |
---|
111 | |
---|
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 |
---|
117 | # define CPPUNIT_NS |
---|
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) |
---|
123 | |
---|
124 | /*! Stringize a symbol. |
---|
125 | * |
---|
126 | * Use this macro to convert a preprocessor symbol to a string. |
---|
127 | * |
---|
128 | * Example of usage: |
---|
129 | * \code |
---|
130 | * #define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTestPlugIn |
---|
131 | * const char *name = CPPUNIT_STRINGIZE( CPPUNIT_PLUGIN_EXPORTED_NAME ); |
---|
132 | * \endcode |
---|
133 | */ |
---|
134 | #define CPPUNIT_STRINGIZE( symbol ) _CPPUNIT_DO_STRINGIZE( symbol ) |
---|
135 | |
---|
136 | /// \internal |
---|
137 | #define _CPPUNIT_DO_STRINGIZE( symbol ) #symbol |
---|
138 | |
---|
139 | /*! Joins to symbol after expanding them into string. |
---|
140 | * |
---|
141 | * Use this macro to join two symbols. Example of usage: |
---|
142 | * |
---|
143 | * \code |
---|
144 | * #define MAKE_UNIQUE_NAME(prefix) CPPUNIT_JOIN( prefix, __LINE__ ) |
---|
145 | * \endcode |
---|
146 | * |
---|
147 | * The macro defined in the example concatenate a given prefix with the line number |
---|
148 | * to obtain a 'unique' identifier. |
---|
149 | * |
---|
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. |
---|
156 | */ |
---|
157 | #define CPPUNIT_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN( symbol1, symbol2 ) |
---|
158 | |
---|
159 | /// \internal |
---|
160 | #define _CPPUNIT_DO_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN2( symbol1, symbol2 ) |
---|
161 | |
---|
162 | /// \internal |
---|
163 | #define _CPPUNIT_DO_JOIN2( symbol1, symbol2 ) symbol1##symbol2 |
---|
164 | |
---|
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__ |
---|
169 | #endif |
---|
170 | |
---|
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. |
---|
174 | */ |
---|
175 | #define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, CPPUNIT_UNIQUE_COUNTER ) |
---|
176 | |
---|
177 | /*! Defines wrap colunm for %CppUnit. Used by CompilerOuputter. |
---|
178 | */ |
---|
179 | #if !defined(CPPUNIT_WRAP_COLUMN) |
---|
180 | # define CPPUNIT_WRAP_COLUMN 79 |
---|
181 | #endif |
---|
182 | |
---|
183 | #endif // CPPUNIT_PORTABILITY_H |
---|