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.

62 lines
1.2 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. #define AssertMessage AssertMessageW
  31. void AssertMessage(const TCHAR *pszFile, unsigned nLine, const TCHAR *pszMsg);
  32. #define ASSERT(x) (void)((x) || (AssertMessage(TEXT(__FILE__),__LINE__,TEXT(#x)),0))
  33. #define ASSERTMSG(exp, msg) (void)((exp) || (AssertMessage(TEXT(__FILE__),__LINE__,msg),0))
  34. #define VERIFY(x) ASSERT(x)
  35. #define ASSERT_VALID(pObj) ((ASSERT(pObj),1) && ((pObj)->AssertValid(),1))
  36. #else // DEBUG
  37. #define ASSERT_VALID(pObj)
  38. #define ASSERT(x) ((void)0)
  39. #define ASSERTMSG(exp, msg) ((void)0)
  40. #define VERIFY(x) (x)
  41. #endif
  42. #ifdef __cplusplus
  43. }
  44. #endif
  45. #endif