Branch libreoffice-24-8-3
[LibreOffice.git] / external / cppunit / help-msvc-analyzer.patch
blob26d7fe6e89e65363e5867c5c0f2411d2a94b4ad3
1 --- misc/cppunit-1.14.0/include/cppunit/TestAssert.h
2 +++ misc/build/cppunit-1.14.0/include/cppunit/TestAssert.h
3 @@ -261,6 +261,13 @@
4 message );
8 +#ifdef _MSC_VER
9 +# define ANALYSIS_ASSUME(condition) __analysis_assume(condition)
10 +#else
11 +# define ANALYSIS_ASSUME(condition) static_cast<void>(0)
12 +#endif
14 /* A set of macros which allow us to get the line number
15 * and file name at the point of an error.
16 * Just goes to show that preprocessors do have some
17 @@ -271,15 +278,17 @@
18 * \ingroup Assertions
20 #define CPPUNIT_ASSERT(condition) \
21 - ( CPPUNIT_NS::Asserter::failIf( !(condition), \
22 + do { ( CPPUNIT_NS::Asserter::failIf( !(condition), \
23 CPPUNIT_NS::Message( "assertion failed", \
24 "Expression: " #condition), \
25 - CPPUNIT_SOURCELINE() ) )
26 + CPPUNIT_SOURCELINE() ) ); \
27 + ANALYSIS_ASSUME(condition); } while(0)
28 #else
29 #define CPPUNIT_ASSERT(condition) \
30 - ( CPPUNIT_NS::Asserter::failIf( !(condition), \
31 + do { ( CPPUNIT_NS::Asserter::failIf( !(condition), \
32 CPPUNIT_NS::Message( "assertion failed" ), \
33 - CPPUNIT_SOURCELINE() ) )
34 + CPPUNIT_SOURCELINE() ) ); \
35 + ANALYSIS_ASSUME(condition); } while(0)
36 #endif
38 /** Assertion with a user specified message.
39 @@ -289,13 +298,14 @@
40 * \param condition If this condition evaluates to \c false then the
41 * test failed.
43 -#define CPPUNIT_ASSERT_MESSAGE(message,condition) \
44 - ( CPPUNIT_NS::Asserter::failIf( !(condition), \
45 - CPPUNIT_NS::Message( "assertion failed", \
46 - "Expression: " \
47 - #condition, \
48 - CPPUNIT_NS::message_to_string(message) ), \
49 - CPPUNIT_SOURCELINE() ) )
50 +#define CPPUNIT_ASSERT_MESSAGE(message,condition) \
51 + do { ( CPPUNIT_NS::Asserter::failIf( !(condition), \
52 + CPPUNIT_NS::Message( "assertion failed", \
53 + "Expression: " \
54 + #condition, \
55 + CPPUNIT_NS::message_to_string(message) ), \
56 + CPPUNIT_SOURCELINE() ) ); \
57 + ANALYSIS_ASSUME(condition); } while(0)
59 /** Fails with the specified message.
60 * \ingroup Assertions