Welcome to mirror list, hosted at ThFree Co, Russian Federation.

rhassert.h « Runtime « Native « src - github.com/mono/corert.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9863822fc421c46b2627aa59e01e0b984657fa3d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#ifdef _MSC_VER
#define ASSUME(expr) __assume(expr)
#else  // _MSC_VER
#define ASSUME(expr) do { if (!(expr)) __builtin_unreachable(); } while (0) 
#endif // _MSC_VER

#if defined(_DEBUG) && !defined(DACCESS_COMPILE)

#define ASSERT(expr) \
    { \
    if (!(expr)) { Assert(#expr, __FILE__, __LINE__, NULL); } \
    } \

#define ASSERT_MSG(expr, msg) \
    { \
    if (!(expr)) { Assert(#expr, __FILE__, __LINE__, msg); } \
    } \

#define VERIFY(expr) ASSERT((expr))

#define ASSERT_UNCONDITIONALLY(message) \
    Assert("ASSERT_UNCONDITIONALLY", __FILE__, __LINE__, message); \

void Assert(const char * expr, const char * file, unsigned int line_num, const char * message);

#else

#define ASSERT(expr)

#define ASSERT_MSG(expr, msg)

#define VERIFY(expr) (expr)

#define ASSERT_UNCONDITIONALLY(message)

#endif

#if defined(_DEBUG)

void NYI_ASSERT();

#endif

#define PORTABILITY_ASSERT(message) \
    ASSERT_UNCONDITIONALLY(message); \
    ASSUME(0); \

#define UNREACHABLE() \
    ASSERT_UNCONDITIONALLY("UNREACHABLE"); \
    ASSUME(0); \

#define UNREACHABLE_MSG(message) \
    ASSERT_UNCONDITIONALLY(message); \
    ASSUME(0);  \

#define FAIL_FAST_GENERATE_EXCEPTION_ADDRESS 0x1

#define RhFailFast() PalRaiseFailFastException(NULL, NULL, FAIL_FAST_GENERATE_EXCEPTION_ADDRESS)