CppUnit project page FAQ

Portability.h
Go to the documentation of this file.
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.15.0"
24#endif
25
26#include <cppunit/config/CppUnitApi.h> // define CPPUNIT_API & CPPUNIT_NEED_DLL_DECL
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
120#define CPPUNIT_STRINGIZE( symbol ) _CPPUNIT_DO_STRINGIZE( symbol )
121
123#define _CPPUNIT_DO_STRINGIZE( symbol ) #symbol
124
143#define CPPUNIT_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN( symbol1, symbol2 )
144
146#define _CPPUNIT_DO_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN2( symbol1, symbol2 )
147
149#define _CPPUNIT_DO_JOIN2( symbol1, symbol2 ) symbol1##symbol2
150
153#ifndef CPPUNIT_UNIQUE_COUNTER
154# define CPPUNIT_UNIQUE_COUNTER __LINE__
155#endif
156
161#define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, CPPUNIT_UNIQUE_COUNTER )
162
165#if !defined(CPPUNIT_WRAP_COLUMN)
166# define CPPUNIT_WRAP_COLUMN 79
167#endif
168
169#endif // CPPUNIT_PORTABILITY_H

Send comments to:
CppUnit Developers