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.

86 lines
1.4 KiB

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