Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
rw_testdefs.h
Go to the documentation of this file.
1
31#ifndef RW_TESTDEFS_H_INCLUDED
32#define RW_TESTDEFS_H_INCLUDED
33
34
35#include <rw/_defs.h>
36
37#ifdef _RWSTD_TEST_SRC
38 // #undef-ine the Compaq C++ macro #defined in response to
39 // the -std strict_ansi_errors compiler option in order to
40 // allow C++ extensions (such POSIX names) to be declared
41 // by C++ libc headers when building the test driver
42# undef __PURE_CNAME
43#endif // _RWSTD_TEST_SRC
44
45
46#if defined (_MSC_VER) && (defined (RWDLL) || defined (_RWSHARED))
47# ifndef _RWSTD_TEST_SRC
48 // using a shared lib, import names
49# define _TEST_EXPORT __declspec (dllimport)
50# else
51 // building a shared (test) lib, export names
52# define _TEST_EXPORT __declspec (dllexport)
53# endif // _RWSTD_LIB_SRC
54#else
55# define _TEST_EXPORT
56#endif // archive/shared library
57
58
59#if defined (_RWSTD_NO_NAMESPACE) && !defined std
60# define std /* empty */
61#endif // _RWSTD_NO_NAMESPACE && !std
62
63
64#if defined (_RWSTD_NO_EXCEPTIONS)
65# ifndef try
66# define try if (0); else
67# endif // try
68# ifdef catch
69# define catch void foo; while (0)
70# endif
71# define RW_CATCH_ALL(ignore) while (0)
72#else // if !defined (_RWSTD_NO_EXCEPTIONS)
73# define RW_CATCH_ALL(dot_dot_dot) catch (dot_dot_dot)
74#endif // _RWSTD_NO_EXCEPTIONS
75
76// give the for-init-variable a local scope
77#ifdef _RWSTD_NO_FOR_LOCAL_SCOPE
78# define for if (0); else for
79#endif // _RWSTD_NO_FOR_LOCAL_SCOPE
80
81
82// convenience macro for exception specification on function pointers
83#ifndef _RWSTD_NO_PTR_EXCEPTION_SPEC
84
85#define _PTR_THROWS(spec) _THROWS (spec)
86
87#else // if defined (_RWSTD_NO_PTR_EXCEPTION_SPEC)
88
89// throw specs on pointers to functions not implemented...
90#define _PTR_THROWS(ignore)
91
92#endif // _RWSTD_NO_PTR_EXCEPTION_SPEC
93
94
95// _RWSTD_PRI{d,i,o,u,x}MAX: macros corresponding to those described
96// in 7.8.1 of C99; each of them expands to a character string literal
97// containing a conversion specifier, possibly modified by a length
98// modifier, suitable for use within the format argument of a formatted
99// input/output function when converting the corresponding integer type
100#if _RWSTD_LONG_SIZE < _RWSTD_LLONG_SIZE
101 // using LLONG_SIZE instead of ULLONG_MAX in the preprocessor
102 // conditional above to work around a gcc 3.2 bug (PR #28595)
103# define _RWSTD_PRIdMAX _RWSTD_LLONG_PRINTF_PREFIX "d"
104# define _RWSTD_PRIiMAX _RWSTD_LLONG_PRINTF_PREFIX "i"
105# define _RWSTD_PRIoMAX _RWSTD_LLONG_PRINTF_PREFIX "o"
106# define _RWSTD_PRIuMAX _RWSTD_LLONG_PRINTF_PREFIX "u"
107# define _RWSTD_PRIxMAX _RWSTD_LLONG_PRINTF_PREFIX "x"
108#elif _RWSTD_INT_SIZE < _RWSTD_LONG_SIZE
109# define _RWSTD_PRIdMAX "ld"
110# define _RWSTD_PRIiMAX "li"
111# define _RWSTD_PRIoMAX "lo"
112# define _RWSTD_PRIuMAX "lu"
113# define _RWSTD_PRIxMAX "lx"
114#else
115# define _RWSTD_PRIdMAX "d"
116# define _RWSTD_PRIiMAX "i"
117# define _RWSTD_PRIoMAX "o"
118# define _RWSTD_PRIuMAX "u"
119# define _RWSTD_PRIxMAX "x"
120#endif
121
122
123// _RWSTD_PRIz: expands to a conversion specifier corresponding
124// to "%z" (i.e., C99 size_t specifier)
125#if _RWSTD_SIZE_MAX == _RWSTD_UINT_MAX
126 // sizeof (size_t) == sizeof (unsigned int)
127# define _RWSTD_PRIz ""
128#elif _RWSTD_SIZE_MAX == _RWSTD_ULONG_MAX
129 // sizeof (size_t) == sizeof (unsigned long)
130# define _RWSTD_PRIz "l"
131#elif _RWSTD_SIZE_MAX == _RWSTD_ULLONG_MAX
132 // sizeof (size_t) == sizeof (unsigned long long)
133# define _RWSTD_PRIz _RWSTD_LLONG_PRINTF_PREFIX ""
134#else
135 // assume sizeof (size_t) == sizeof (unsigned)
136# define _RWSTD_PRIz ""
137#endif
138
139
140// test assertion
141#ifndef _RWSTD_NO_PRETTY_FUNCTION
142 // gcc, HP aCC, and Intel C++ all support __PRETTY_FUNCTION__
143# define RW_ASSERT(expr) \
144 ((expr) ? (void)0 : _RW::__rw_assert_fail (#expr, __FILE__, __LINE__, \
145 __PRETTY_FUNCTION__))
146#elif !defined (_RWSTD_NO_FUNC)
147 // C99 specifies the __func__ special identifier
148# define RW_ASSERT(expr) \
149 ((expr) ? (void)0 : _RW::__rw_assert_fail (#expr, __FILE__, __LINE__, \
150 __func__))
151#elif defined (__FUNCSIG__)
152 // MSVC macro
153# define RW_ASSERT(expr) \
154 ((expr) ? (void)0 : _RW::__rw_assert_fail (#expr, __FILE__, __LINE__, \
155 __FUNCSIG__))
156#else // if _RWSTD_NO_PRETTY_FUNCTION && _RWSTD_NO_FUNC
157# define RW_ASSERT(expr) \
158 ((expr) ? (void)0 : _RW::__rw_assert_fail (#expr, __FILE__, __LINE__, 0))
159#endif // _RWSTD_NO_PRETTY_FUNCTION, _RWSTD_NO_FUNC
160
161// convenience macro to get number of elements in a c style array
162#define RW_COUNT_OF(x) (sizeof(x) / sizeof(*x))
163
164#if defined (__INTEL_COMPILER) && __INTEL_COMPILER <= 1000
165 // disable warning #279: controlling expression is constant
166 // issued for the commonly used RW_ASSERT(!"not implemented")
167# pragma warning (disable: 279)
168#endif // Intel C++ 10.0 and prior
169
170#if ((4 < __GNUC__) || ((4 == __GNUC__) && (3 < __GNUC_MINOR__))) \
171 || (310 < __EDG_VERSION__)
172# define _RWSTD_TT_STRICT_CXX_0X_CONFORM
173#endif
174
175#endif // RW_TESTDEFS_H_INCLUDED