Leaked source code of windows server 2003
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.

66 lines
1.3 KiB

  1. #ifndef DEBUG_H
  2. #define DEBUG_H
  3. #ifdef __cplusplus
  4. extern "C" {
  5. #endif
  6. #include <windows.h>
  7. //
  8. // Macros for debugging support.
  9. //
  10. // ASSERT(exp) Popup a dialogbox, if exp is FALSE
  11. // ASSERTMSG(exp, msg) Similar to ASSERT. Except the msg is displayed instead of the expression
  12. //
  13. // USE VERIFY for expressions executed for both debug and release version
  14. //
  15. #undef ASSERT
  16. #undef ASSERTMSG
  17. /*
  18. //
  19. // Used by atl
  20. //
  21. #ifdef _ATL_NO_DEBUG_CRT
  22. #define _ASSERTE ASSERT
  23. #define _ASSERT ASSERT
  24. #endif
  25. */
  26. #ifdef DBG
  27. #define DEBUG
  28. #endif
  29. #if ( defined(DEBUG) || defined(_DEBUG))
  30. #ifdef UNICODE
  31. #define AssertMessage AssertMessageW
  32. #endif
  33. void AssertMessage(const TCHAR *pszFile, unsigned nLine, const TCHAR *pszMsg);
  34. #define ASSERT(x) (void)((x) || (AssertMessage(TEXT(__FILE__),__LINE__,TEXT(#x)),0))
  35. #define ASSERTMSG(exp, msg) (void)((exp) || (AssertMessage(TEXT(__FILE__),__LINE__,msg),0))
  36. #define VERIFY(x) ASSERT(x)
  37. #define ASSERT_VALID(pObj) ((ASSERT(pObj),1) && ((pObj)->AssertValid(),1))
  38. #else // DEBUG
  39. #define ASSERT_VALID(pObj)
  40. #define ASSERT(x) ((void)0)
  41. #define ASSERTMSG(exp, msg) ((void)0)
  42. #define VERIFY(x) (x)
  43. #endif
  44. #ifdef __cplusplus
  45. }
  46. #endif
  47. #endif