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.

58 lines
902 B

  1. /***
  2. *assert.h - define the assert macro
  3. *
  4. * Copyright (c) 1985-2001, 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)
  14. #error ERROR: Only Win32 target supported!
  15. #endif
  16. /* Define _CRTIMP */
  17. #ifndef _CRTIMP
  18. #ifdef _DLL
  19. #define _CRTIMP __declspec(dllimport)
  20. #else /* ndef _DLL */
  21. #define _CRTIMP
  22. #endif /* _DLL */
  23. #endif /* _CRTIMP */
  24. /* Define __cdecl for non-Microsoft compilers */
  25. #if ( !defined(_MSC_VER) && !defined(__cdecl) )
  26. #define __cdecl
  27. #endif
  28. #undef assert
  29. #ifdef NDEBUG
  30. #define assert(exp) ((void)0)
  31. #else
  32. #ifdef __cplusplus
  33. extern "C" {
  34. #endif
  35. _CRTIMP void __cdecl _assert(void *, void *, unsigned);
  36. #ifdef __cplusplus
  37. }
  38. #endif
  39. #define assert(exp) (void)( (exp) || (_assert(#exp, __FILE__, __LINE__), 0) )
  40. #endif /* NDEBUG */