Skip to content

Commit bb7555c

Browse files
committed
Tweak preprocessor blocks.
1 parent f82c403 commit bb7555c

File tree

9 files changed

+95
-92
lines changed

9 files changed

+95
-92
lines changed

.uncrustify

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ cmt_insert_func_header = ""
476476
cmt_insert_class_header = ""
477477
cmt_insert_oc_msg_header = ""
478478
cmt_insert_before_preproc = false
479-
pp_indent = remove
479+
pp_indent = ignore
480480
pp_indent_at_level = false
481481
pp_indent_count = 3
482482
pp_space = ignore

UnitTest++/CheckMacros.h

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,27 @@
1111
#include "ReportAssertImpl.h"
1212

1313
#ifdef CHECK
14-
#error UnitTest++ redefines CHECK
14+
#error UnitTest++ redefines CHECK
1515
#endif
1616

1717
#ifdef CHECK_EQUAL
18-
#error UnitTest++ redefines CHECK_EQUAL
18+
#error UnitTest++ redefines CHECK_EQUAL
1919
#endif
2020

2121
#ifdef CHECK_CLOSE
22-
#error UnitTest++ redefines CHECK_CLOSE
22+
#error UnitTest++ redefines CHECK_CLOSE
2323
#endif
2424

2525
#ifdef CHECK_ARRAY_EQUAL
26-
#error UnitTest++ redefines CHECK_ARRAY_EQUAL
26+
#error UnitTest++ redefines CHECK_ARRAY_EQUAL
2727
#endif
2828

2929
#ifdef CHECK_ARRAY_CLOSE
30-
#error UnitTest++ redefines CHECK_ARRAY_CLOSE
30+
#error UnitTest++ redefines CHECK_ARRAY_CLOSE
3131
#endif
3232

3333
#ifdef CHECK_ARRAY2D_CLOSE
34-
#error UnitTest++ redefines CHECK_ARRAY2D_CLOSE
34+
#error UnitTest++ redefines CHECK_ARRAY2D_CLOSE
3535
#endif
3636

3737
#define CHECK(value) \
@@ -158,6 +158,7 @@
158158

159159
// CHECK_THROW and CHECK_ASSERT only exist when UNITTEST_NO_EXCEPTIONS isn't defined (see config.h)
160160
#ifndef UNITTEST_NO_EXCEPTIONS
161+
161162
#define CHECK_THROW(expression, ExpectedExceptionType) \
162163
UNITTEST_MULTILINE_MACRO_BEGIN \
163164
bool caught_ = false; \
@@ -176,4 +177,5 @@
176177
UnitTest::Detail::ExpectAssert(false); \
177178
UNITTEST_MULTILINE_MACRO_END
178179
#endif
180+
179181
#endif

UnitTest++/Config.h

Lines changed: 19 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,28 +4,29 @@
44
// Standard defines documented here: http://predef.sourceforge.net
55

66
#if defined(_MSC_VER)
7-
#pragma warning(disable:4702)// unreachable code
8-
#pragma warning(disable:4722)// destructor never returns, potential memory leak
9-
10-
#if (_MSC_VER == 1200) // VC6
11-
#define UNITTEST_COMPILER_IS_MSVC6
12-
#pragma warning(disable:4786)
13-
#pragma warning(disable:4290)
14-
#endif
15-
16-
#ifdef _USRDLL
17-
#define UNITTEST_WIN32_DLL
18-
#endif
19-
#define UNITTEST_WIN32
7+
#pragma warning(disable:4702)// unreachable code
8+
#pragma warning(disable:4722)// destructor never returns, potential memory leak
9+
10+
#if (_MSC_VER == 1200) // VC6
11+
#define UNITTEST_COMPILER_IS_MSVC6
12+
#pragma warning(disable:4786)
13+
#pragma warning(disable:4290)
14+
#endif
15+
16+
#ifdef _USRDLL
17+
#define UNITTEST_WIN32_DLL
18+
#endif
19+
20+
#define UNITTEST_WIN32
2021
#endif
2122

2223
#if defined(unix) || defined(__unix__) || defined(__unix) || defined(linux) || \
2324
defined(__APPLE__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__)
24-
#define UNITTEST_POSIX
25+
#define UNITTEST_POSIX
2526
#endif
2627

2728
#if defined(__MINGW32__)
28-
#define UNITTEST_MINGW
29+
#define UNITTEST_MINGW
2930
#endif
3031

3132

@@ -43,7 +44,7 @@
4344
// well as Google Code HEAD users that may have used or defined
4445
// UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM outside of this configuration file.
4546
#ifndef UNITTEST_USE_CUSTOM_STREAMS
46-
#define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
47+
#define UNITTEST_MEMORYOUTSTREAM_IS_STD_OSTRINGSTREAM
4748
#endif
4849

4950
// DeferredTestReporter uses the STL to collect test results for subsequent export by reporters like
@@ -65,9 +66,9 @@
6566
// std namespace qualification: used for functions like strcpy that
6667
// may live in std:: namespace (cstring header).
6768
#if defined( UNITTEST_COMPILER_IS_MSVC6 )
68-
#define UNIITEST_NS_QUAL_STD(x) x
69+
#define UNIITEST_NS_QUAL_STD(x) x
6970
#else
70-
#define UNIITEST_NS_QUAL_STD(x) ::std::x
71+
#define UNIITEST_NS_QUAL_STD(x) ::std::x
7172
#endif
7273

7374
#endif

UnitTest++/ExceptionMacros.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
#include "Config.h"
55

66
#ifndef UNITTEST_NO_EXCEPTIONS
7-
#define UT_TRY(x) try x
8-
#define UT_THROW(x) throw x
9-
#define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody
10-
#define UT_CATCH_ALL(CatchBody) catch(...) CatchBody
7+
#define UT_TRY(x) try x
8+
#define UT_THROW(x) throw x
9+
#define UT_CATCH(ExceptionType, ExceptionName, CatchBody) catch(ExceptionType& ExceptionName) CatchBody
10+
#define UT_CATCH_ALL(CatchBody) catch(...) CatchBody
1111
#else
12-
#define UT_TRY(x) x
13-
#define UT_THROW(x)
14-
#define UT_CATCH(ExceptionType, ExceptionName, CatchBody)
15-
#define UT_CATCH_ALL(CatchBody)
12+
#define UT_TRY(x) x
13+
#define UT_THROW(x)
14+
#define UT_CATCH(ExceptionType, ExceptionName, CatchBody)
15+
#define UT_CATCH_ALL(CatchBody)
1616
#endif
1717

1818
#endif

UnitTest++/HelperMacros.h

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,47 +6,47 @@
66
#define UNITTEST_MULTILINE_MACRO_BEGIN do {
77

88
#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))
9+
#define UNITTEST_MULTILINE_MACRO_END \
10+
} __pragma(warning(push)) __pragma(warning(disable: 4127)) while (0) __pragma(warning(pop))
1111
#else
12-
#define UNITTEST_MULTILINE_MACRO_END } while(0)
12+
#define UNITTEST_MULTILINE_MACRO_END } while(0)
1313
#endif
1414

1515

1616
#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))
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))
3434
#else
35-
#define UNITTEST_IMPORT
36-
#define UNITTEST_EXPORT
37-
#define UNITTEST_LINKAGE
38-
#define UNITTEST_IMPEXP_TEMPLATE
39-
#define UNITTEST_STDVECTOR_LINKAGE(T)
35+
#define UNITTEST_IMPORT
36+
#define UNITTEST_EXPORT
37+
#define UNITTEST_LINKAGE
38+
#define UNITTEST_IMPEXP_TEMPLATE
39+
#define UNITTEST_STDVECTOR_LINKAGE(T)
4040
#endif
4141

4242
#ifdef UNITTEST_WIN32
43-
#define UNITTEST_JMPBUF jmp_buf
44-
#define UNITTEST_SETJMP setjmp
45-
#define UNITTEST_LONGJMP longjmp
43+
#define UNITTEST_JMPBUF jmp_buf
44+
#define UNITTEST_SETJMP setjmp
45+
#define UNITTEST_LONGJMP longjmp
4646
#elif defined UNITTEST_POSIX
47-
#define UNITTEST_JMPBUF std::jmp_buf
48-
#define UNITTEST_SETJMP setjmp
49-
#define UNITTEST_LONGJMP std::longjmp
47+
#define UNITTEST_JMPBUF std::jmp_buf
48+
#define UNITTEST_SETJMP setjmp
49+
#define UNITTEST_LONGJMP std::longjmp
5050
#endif
5151

5252
#endif

UnitTest++/ReportAssert.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include "TestDetails.h"
77

88
#ifdef UNITTEST_NO_EXCEPTIONS
9-
#include "ReportAssertImpl.h"
9+
#include "ReportAssertImpl.h"
1010
#endif
1111

1212
namespace UnitTest {

UnitTest++/ReportAssertImpl.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#include "HelperMacros.h"
66

77
#ifdef UNITTEST_NO_EXCEPTIONS
8-
#include <csetjmp>
8+
#include <csetjmp>
99
#endif
1010

1111
namespace UnitTest {

UnitTest++/TimeHelpers.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "Config.h"
22

33
#if defined UNITTEST_POSIX
4-
#include "Posix/TimeHelpers.h"
4+
#include "Posix/TimeHelpers.h"
55
#else
6-
#include "Win32/TimeHelpers.h"
6+
#include "Win32/TimeHelpers.h"
77
#endif

tests/TestTestMacros.cpp

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,33 +13,33 @@ using namespace std;
1313
/* test for c++11 support */
1414
#ifndef _MSC_VER
1515

16-
/* Test for clang >= 3.3 */
17-
#ifdef __clang__
18-
#if (__clang__ == 1) && (__clang_major__ > 3 || (__clang_major__ == 3 && (__clang_minor__ > 2 )))
19-
#define _NOEXCEPT_OP(x) noexcept(x)
20-
#else
21-
#define _NOEXCEPT_OP(x)
22-
#endif
23-
#endif
24-
25-
#ifndef __clang__
26-
/* Test for GCC >= 4.8.0 */
27-
#ifdef __GNUC__
28-
#if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ > 7 ))
29-
#define _NOEXCEPT_OP(x) noexcept(x)
30-
#else
31-
#define _NOEXCEPT_OP(x)
32-
#endif
33-
#endif
34-
#endif
16+
/* Test for clang >= 3.3 */
17+
#ifdef __clang__
18+
#if (__clang__ == 1) && (__clang_major__ > 3 || (__clang_major__ == 3 && (__clang_minor__ > 2 )))
19+
#define _NOEXCEPT_OP(x) noexcept(x)
20+
#else
21+
#define _NOEXCEPT_OP(x)
22+
#endif
23+
#endif
24+
25+
#ifndef __clang__
26+
/* Test for GCC >= 4.8.0 */
27+
#ifdef __GNUC__
28+
#if (__GNUC__ > 4) || (__GNUC__ == 4 && (__GNUC_MINOR__ > 7 ))
29+
#define _NOEXCEPT_OP(x) noexcept(x)
30+
#else
31+
#define _NOEXCEPT_OP(x)
32+
#endif
33+
#endif
34+
#endif
3535

3636
#elif _MSC_VER
3737

38-
#if (_MSC_VER > 1800)
39-
#define _NOEXCEPT_OP(x) noexcept(x)
40-
#else
41-
#define _NOEXCEPT_OP(x)
42-
#endif
38+
#if (_MSC_VER > 1800)
39+
#define _NOEXCEPT_OP(x) noexcept(x)
40+
#else
41+
#define _NOEXCEPT_OP(x)
42+
#endif
4343

4444
#endif
4545

0 commit comments

Comments
 (0)