1 #ifndef UNITTEST_HELPERMACROS_H 2 #define UNITTEST_HELPERMACROS_H 3 4 #include "Config.h" 5 6 #define UNITTEST_MULTILINE_MACRO_BEGIN do { 7 8 #if defined(UNITTEST_WIN32) && !defined(UNITTEST_COMPILER_IS_MSVC6) 9 #define UNITTEST_MULTILINE_MACRO_END \ 10 } __pragma(warning(push)) __pragma(warning(disable: 4127)) while (0) __pragma(warning(pop)) 11 #else 12 #define UNITTEST_MULTILINE_MACRO_END } while(0) 13 #endif 14 15 16 #ifdef UNITTEST_WIN32_DLL 17 #define UNITTEST_IMPORT __declspec(dllimport) 18 #define UNITTEST_EXPORT __declspec(dllexport) 19 20 #ifdef UNITTEST_DLL_EXPORT 21 #define UNITTEST_LINKAGE UNITTEST_EXPORT 22 #define UNITTEST_IMPEXP_TEMPLATE 23 #else 24 #define UNITTEST_LINKAGE UNITTEST_IMPORT 25 #define UNITTEST_IMPEXP_TEMPLATE extern 26 #endif 27 28 #define UNITTEST_STDVECTOR_LINKAGE(T) \ 29 __pragma(warning(push)) \ 30 __pragma(warning(disable: 4231)) \ 31 UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::allocator< T >; \ 32 UNITTEST_IMPEXP_TEMPLATE template class UNITTEST_LINKAGE std::vector< T >; \ 33 __pragma(warning(pop)) 34 #else 35 #define UNITTEST_IMPORT 36 #define UNITTEST_EXPORT 37 #define UNITTEST_LINKAGE 38 #define UNITTEST_IMPEXP_TEMPLATE 39 #define UNITTEST_STDVECTOR_LINKAGE(T) 40 #endif 41 42 #ifdef UNITTEST_WIN32 43 #define UNITTEST_JMPBUF jmp_buf 44 #define UNITTEST_SETJMP setjmp 45 #define UNITTEST_LONGJMP longjmp 46 #elif defined UNITTEST_POSIX 47 #define UNITTEST_JMPBUF std::jmp_buf 48 #define UNITTEST_SETJMP setjmp 49 #define UNITTEST_LONGJMP std::longjmp 50 #endif 51 52 #endif 53