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