85 lines
1.3 KiB
C
85 lines
1.3 KiB
C
|
/***
|
||
|
*assert.h - define the assert macro
|
||
|
*
|
||
|
* Copyright (c) 1985-1994, Microsoft Corporation. All rights reserved.
|
||
|
*
|
||
|
*Purpose:
|
||
|
* Defines the assert(exp) macro.
|
||
|
* [ANSI/System V]
|
||
|
*
|
||
|
****/
|
||
|
|
||
|
#ifndef _INC_ASSERT
|
||
|
#define _INC_ASSERT
|
||
|
|
||
|
|
||
|
/* Define _CRTAPI1 (for compatibility with the NT SDK) */
|
||
|
|
||
|
#ifndef _CRTAPI1
|
||
|
#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
|
||
|
#define _CRTAPI1 __cdecl
|
||
|
#else
|
||
|
#define _CRTAPI1
|
||
|
#endif
|
||
|
#endif
|
||
|
|
||
|
|
||
|
/* Define _CRTAPI2 (for compatibility with the NT SDK) */
|
||
|
|
||
|
#ifndef _CRTAPI2
|
||
|
#if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
|
||
|
#define _CRTAPI2 __cdecl
|
||
|
#else
|
||
|
#define _CRTAPI2
|
||
|
#endif
|
||
|
#endif
|
||
|
|
||
|
|
||
|
/* Define _CRTIMP */
|
||
|
|
||
|
#ifndef _CRTIMP
|
||
|
#ifdef _NTSDK
|
||
|
/* definition compatible with NT SDK */
|
||
|
#define _CRTIMP
|
||
|
#else /* ndef _NTSDK */
|
||
|
/* current definition */
|
||
|
#ifdef _DLL
|
||
|
#define _CRTIMP __declspec(dllimport)
|
||
|
#else /* ndef _DLL */
|
||
|
#define _CRTIMP
|
||
|
#endif /* _DLL */
|
||
|
#endif /* _NTSDK */
|
||
|
#endif /* _CRTIMP */
|
||
|
|
||
|
|
||
|
/* Define __cdecl for non-Microsoft compilers */
|
||
|
|
||
|
#if ( !defined(_MSC_VER) && !defined(__cdecl) )
|
||
|
#define __cdecl
|
||
|
#endif
|
||
|
|
||
|
|
||
|
#undef assert
|
||
|
|
||
|
#ifdef NDEBUG
|
||
|
|
||
|
#define assert(exp) ((void)0)
|
||
|
|
||
|
#else
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
extern "C" {
|
||
|
#endif
|
||
|
|
||
|
_CRTIMP void __cdecl _assert(void *, void *, unsigned);
|
||
|
|
||
|
#ifdef __cplusplus
|
||
|
}
|
||
|
#endif
|
||
|
|
||
|
#define assert(exp) (void)( (exp) || (_assert(#exp, __FILE__, __LINE__), 0) )
|
||
|
|
||
|
#endif /* NDEBUG */
|
||
|
|
||
|
#endif /* _INC_ASSERT */
|