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.14.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 // Compiler error location format for CompilerOutputter
65 // If not define, assumes that it's gcc
66 // See class CompilerOutputter for format.
67 #if !defined(CPPUNIT_COMPILER_LOCATION_FORMAT)
68 #if defined(__GNUC__) && ( defined(__APPLE_CPP__) || defined(__APPLE_CC__) )
69 // gcc/Xcode integration on Mac OS X
70 # define CPPUNIT_COMPILER_LOCATION_FORMAT "%p:%l: "
71 #else
72 # define CPPUNIT_COMPILER_LOCATION_FORMAT "%f:%l:"
73 #endif
74 #endif
75 
76 // If CPPUNIT_HAVE_CPP_CAST is defined, then c++ style cast will be used,
77 // otherwise, C style cast are used.
78 #if defined( CPPUNIT_HAVE_CPP_CAST )
79 # define CPPUNIT_CONST_CAST( TargetType, pointer ) \
80     const_cast<TargetType>( pointer )
81 
82 # define CPPUNIT_STATIC_CAST( TargetType, pointer ) \
83     static_cast<TargetType>( pointer )
84 #else // defined( CPPUNIT_HAVE_CPP_CAST )
85 # define CPPUNIT_CONST_CAST( TargetType, pointer ) \
86     ((TargetType)( pointer ))
87 # define CPPUNIT_STATIC_CAST( TargetType, pointer ) \
88     ((TargetType)( pointer ))
89 #endif // defined( CPPUNIT_HAVE_CPP_CAST )
90 
91 // If CPPUNIT_NO_STD_NAMESPACE is defined then STL are in the global space.
92 // => Define macro 'std' to nothing
93 #if defined(CPPUNIT_NO_STD_NAMESPACE)
94 # undef std
95 # define std
96 #endif  // defined(CPPUNIT_NO_STD_NAMESPACE)
97 
98 // If CPPUNIT_NO_NAMESPACE is defined, then put CppUnit classes in the
99 // global namespace: the compiler does not support namespace.
100 #if defined(CPPUNIT_NO_NAMESPACE)
101 # define CPPUNIT_NS_BEGIN
102 # define CPPUNIT_NS_END
103 # define CPPUNIT_NS
104 #else   // defined(CPPUNIT_NO_NAMESPACE)
105 # define CPPUNIT_NS_BEGIN namespace CppUnit {
106 # define CPPUNIT_NS_END }
107 # define CPPUNIT_NS CppUnit
108 #endif  // defined(CPPUNIT_NO_NAMESPACE)
109 
110 /*! Stringize a symbol.
111  *
112  * Use this macro to convert a preprocessor symbol to a string.
113  *
114  * Example of usage:
115  * \code
116  * #define CPPUNIT_PLUGIN_EXPORTED_NAME cppunitTestPlugIn
117  * const char *name = CPPUNIT_STRINGIZE( CPPUNIT_PLUGIN_EXPORTED_NAME );
118  * \endcode
119  */
120 #define CPPUNIT_STRINGIZE( symbol ) _CPPUNIT_DO_STRINGIZE( symbol )
121 
122 /// \internal
123 #define _CPPUNIT_DO_STRINGIZE( symbol ) #symbol
124 
125 /*! Joins to symbol after expanding them into string.
126  *
127  * Use this macro to join two symbols. Example of usage:
128  *
129  * \code
130  * #define MAKE_UNIQUE_NAME(prefix) CPPUNIT_JOIN( prefix, __LINE__ )
131  * \endcode
132  *
133  * The macro defined in the example concatenate a given prefix with the line number
134  * to obtain a 'unique' identifier.
135  *
136  * \internal From boost documentation:
137  * The following piece of macro magic joins the two
138  * arguments together, even when one of the arguments is
139  * itself a macro (see 16.3.1 in C++ standard).  The key
140  * is that macro expansion of macro arguments does not
141  * occur in CPPUNIT_JOIN2 but does in CPPUNIT_JOIN.
142  */
143 #define CPPUNIT_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN( symbol1, symbol2 )
144 
145 /// \internal
146 #define _CPPUNIT_DO_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN2( symbol1, symbol2 )
147 
148 /// \internal
149 #define _CPPUNIT_DO_JOIN2( symbol1, symbol2 ) symbol1##symbol2
150 
151 /// \internal Unique suffix for variable name. Can be overridden in platform specific
152 /// config-*.h. Default to line number.
153 #ifndef CPPUNIT_UNIQUE_COUNTER
154 # define CPPUNIT_UNIQUE_COUNTER __LINE__
155 #endif
156 
157 /*! Adds the line number to the specified string to create a unique identifier.
158  * \param prefix Prefix added to the line number to create a unique identifier.
159  * \see CPPUNIT_TEST_SUITE_REGISTRATION for an example of usage.
160  */
161 #define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, CPPUNIT_UNIQUE_COUNTER )
162 
163 /*! Defines wrap colunm for %CppUnit. Used by CompilerOuputter.
164  */
165 #if !defined(CPPUNIT_WRAP_COLUMN)
166 # define CPPUNIT_WRAP_COLUMN 79
167 #endif
168 
169 #endif // CPPUNIT_PORTABILITY_H
170