xref: /reactos/sdk/include/ucrt/assert.h (revision 04e0dc4a)
1*04e0dc4aSTimo Kreuzer //
2*04e0dc4aSTimo Kreuzer // assert.h
3*04e0dc4aSTimo Kreuzer //
4*04e0dc4aSTimo Kreuzer //      Copyright (c) Microsoft Corporation. All rights reserved.
5*04e0dc4aSTimo Kreuzer //
6*04e0dc4aSTimo Kreuzer // Defines the assert macro and related functionality.
7*04e0dc4aSTimo Kreuzer //
8*04e0dc4aSTimo Kreuzer #if defined _VCRT_BUILD && !defined _ASSERT_OK
9*04e0dc4aSTimo Kreuzer     #error assert.h not for CRT internal use
10*04e0dc4aSTimo Kreuzer #endif
11*04e0dc4aSTimo Kreuzer 
12*04e0dc4aSTimo Kreuzer #include <corecrt.h>
13*04e0dc4aSTimo Kreuzer 
14*04e0dc4aSTimo Kreuzer #pragma warning(push)
15*04e0dc4aSTimo Kreuzer #pragma warning(disable: _UCRT_DISABLED_WARNINGS)
16*04e0dc4aSTimo Kreuzer _UCRT_DISABLE_CLANG_WARNINGS
17*04e0dc4aSTimo Kreuzer _CRT_BEGIN_C_HEADER
18*04e0dc4aSTimo Kreuzer 
19*04e0dc4aSTimo Kreuzer #if _CRT_HAS_C11
20*04e0dc4aSTimo Kreuzer 
21*04e0dc4aSTimo Kreuzer #define static_assert _Static_assert
22*04e0dc4aSTimo Kreuzer 
23*04e0dc4aSTimo Kreuzer #endif // _CRT_HAS_C11
24*04e0dc4aSTimo Kreuzer 
25*04e0dc4aSTimo Kreuzer #undef assert
26*04e0dc4aSTimo Kreuzer 
27*04e0dc4aSTimo Kreuzer #ifdef NDEBUG
28*04e0dc4aSTimo Kreuzer 
29*04e0dc4aSTimo Kreuzer     #define assert(expression) ((void)0)
30*04e0dc4aSTimo Kreuzer 
31*04e0dc4aSTimo Kreuzer #else
32*04e0dc4aSTimo Kreuzer 
33*04e0dc4aSTimo Kreuzer     _ACRTIMP void __cdecl _wassert(
34*04e0dc4aSTimo Kreuzer         _In_z_ wchar_t const* _Message,
35*04e0dc4aSTimo Kreuzer         _In_z_ wchar_t const* _File,
36*04e0dc4aSTimo Kreuzer         _In_   unsigned       _Line
37*04e0dc4aSTimo Kreuzer         );
38*04e0dc4aSTimo Kreuzer 
39*04e0dc4aSTimo Kreuzer     #define assert(expression) (void)(                                                       \
40*04e0dc4aSTimo Kreuzer             (!!(expression)) ||                                                              \
41*04e0dc4aSTimo Kreuzer             (_wassert(_CRT_WIDE(#expression), _CRT_WIDE(__FILE__), (unsigned)(__LINE__)), 0) \
42*04e0dc4aSTimo Kreuzer         )
43*04e0dc4aSTimo Kreuzer 
44*04e0dc4aSTimo Kreuzer #endif
45*04e0dc4aSTimo Kreuzer 
46*04e0dc4aSTimo Kreuzer 
47*04e0dc4aSTimo Kreuzer 
48*04e0dc4aSTimo Kreuzer _CRT_END_C_HEADER
49*04e0dc4aSTimo Kreuzer _UCRT_RESTORE_CLANG_WARNINGS
50*04e0dc4aSTimo Kreuzer #pragma warning(pop) // _UCRT_DISABLED_WARNINGS
51