CppUnit project page FAQ CppUnit home page

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.12.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/* 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
134#define CPPUNIT_STRINGIZE( symbol ) _CPPUNIT_DO_STRINGIZE( symbol )
135
137#define _CPPUNIT_DO_STRINGIZE( symbol ) #symbol
138
157#define CPPUNIT_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN( symbol1, symbol2 )
158
160#define _CPPUNIT_DO_JOIN( symbol1, symbol2 ) _CPPUNIT_DO_JOIN2( symbol1, symbol2 )
161
163#define _CPPUNIT_DO_JOIN2( symbol1, symbol2 ) symbol1##symbol2
164
169#define CPPUNIT_MAKE_UNIQUE_NAME( prefix ) CPPUNIT_JOIN( prefix, __LINE__ )
170
173#if !defined(CPPUNIT_WRAP_COLUMN)
174# define CPPUNIT_WRAP_COLUMN 79
175#endif
176
177#endif // CPPUNIT_PORTABILITY_H

SourceForge Logo hosts this site. Send comments to:
CppUnit Developers