]>
Commit | Line | Data |
---|---|---|
f3c0d7a5 A |
1 | // © 2016 and later: Unicode, Inc. and others. |
2 | // License & terms of use: http://www.unicode.org/copyright.html | |
b75a7d8f A |
3 | /* |
4 | ****************************************************************************** | |
5 | * | |
4388f060 | 6 | * Copyright (C) 2002-2011, International Business Machines |
b75a7d8f A |
7 | * Corporation and others. All Rights Reserved. |
8 | * | |
9 | ****************************************************************************** | |
10 | * | |
11 | * File uassert.h | |
12 | * | |
3d1f044b | 13 | * Contains the U_ASSERT and UPRV_UNREACHABLE macros |
b75a7d8f A |
14 | * |
15 | ****************************************************************************** | |
16 | */ | |
b75a7d8f A |
17 | #ifndef U_ASSERT_H |
18 | #define U_ASSERT_H | |
3d1f044b | 19 | |
b75a7d8f A |
20 | /* utypes.h is included to get the proper define for uint8_t */ |
21 | #include "unicode/utypes.h" | |
3d1f044b A |
22 | /* for abort */ |
23 | #include <stdlib.h> | |
24 | ||
25 | /** | |
26 | * \def U_ASSERT | |
27 | * By default, U_ASSERT just wraps the C library assert macro. | |
28 | * By changing the definition here, the assert behavior for ICU can be changed | |
29 | * without affecting other non - ICU uses of the C library assert(). | |
30 | */ | |
4388f060 A |
31 | #if U_DEBUG |
32 | # include <assert.h> | |
33 | # define U_ASSERT(exp) assert(exp) | |
374ca955 | 34 | #else |
4388f060 | 35 | # define U_ASSERT(exp) |
b75a7d8f A |
36 | #endif |
37 | ||
3d1f044b A |
38 | /** |
39 | * \def UPRV_UNREACHABLE | |
40 | * This macro is used to unconditionally abort if unreachable code is ever executed. | |
41 | * @internal | |
42 | */ | |
43 | #if defined(UPRV_UNREACHABLE) | |
44 | // Use the predefined value. | |
45 | #else | |
46 | # define UPRV_UNREACHABLE abort() | |
47 | #endif | |
b75a7d8f | 48 | |
3d1f044b | 49 | #endif |