Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

84 lines
1.3 KiB

  1. /***
  2. *assert.h - define the assert macro
  3. *
  4. * Copyright (c) 1985-1994, Microsoft Corporation. All rights reserved.
  5. *
  6. *Purpose:
  7. * Defines the assert(exp) macro.
  8. * [ANSI/System V]
  9. *
  10. ****/
  11. #ifndef _INC_ASSERT
  12. #define _INC_ASSERT
  13. /* Define _CRTAPI1 (for compatibility with the NT SDK) */
  14. #ifndef _CRTAPI1
  15. #if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
  16. #define _CRTAPI1 __cdecl
  17. #else
  18. #define _CRTAPI1
  19. #endif
  20. #endif
  21. /* Define _CRTAPI2 (for compatibility with the NT SDK) */
  22. #ifndef _CRTAPI2
  23. #if ( (_MSC_VER >= 800) && (_M_IX86 >= 300) )
  24. #define _CRTAPI2 __cdecl
  25. #else
  26. #define _CRTAPI2
  27. #endif
  28. #endif
  29. /* Define _CRTIMP */
  30. #ifndef _CRTIMP
  31. #ifdef _NTSDK
  32. /* definition compatible with NT SDK */
  33. #define _CRTIMP
  34. #else /* ndef _NTSDK */
  35. /* current definition */
  36. #ifdef _DLL
  37. #define _CRTIMP __declspec(dllimport)
  38. #else /* ndef _DLL */
  39. #define _CRTIMP
  40. #endif /* _DLL */
  41. #endif /* _NTSDK */
  42. #endif /* _CRTIMP */
  43. /* Define __cdecl for non-Microsoft compilers */
  44. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  45. #define __cdecl
  46. #endif
  47. #undef assert
  48. #ifdef NDEBUG
  49. #define assert(exp) ((void)0)
  50. #else
  51. #ifdef __cplusplus
  52. extern "C" {
  53. #endif
  54. _CRTIMP void __cdecl _assert(void *, void *, unsigned);
  55. #ifdef __cplusplus
  56. }
  57. #endif
  58. #define assert(exp) (void)( (exp) || (_assert(#exp, __FILE__, __LINE__), 0) )
  59. #endif /* NDEBUG */
  60. #endif /* _INC_ASSERT */