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.

74 lines
1.3 KiB

  1. /*++
  2. Copyright (c) Microsoft Corporation. All rights reserved.
  3. Module Name:
  4. debug.h
  5. Abstract:
  6. Private header file for sputils
  7. Debugging (ASSERT/VERIFY) macro's
  8. Author:
  9. Jamie Hunter (JamieHun) Mar-26-2002
  10. Revision History:
  11. --*/
  12. #ifndef ASSERTS_ON
  13. #if DBG
  14. #define ASSERTS_ON 1
  15. #else
  16. #define ASSERTS_ON 0
  17. #endif
  18. #endif
  19. #if DBG
  20. #ifndef MEM_DBG
  21. #define MEM_DBG 1
  22. #endif
  23. #else
  24. #ifndef MEM_DBG
  25. #define MEM_DBG 0
  26. #endif
  27. #endif
  28. #if ASSERTS_ON
  29. //
  30. // MYASSERT is a validity check with block symantics of {} or {if(foo); }
  31. // ie, foo is only executed if ASSERTS_ON is 1 and should return a boolean
  32. //
  33. // MYVERIFY is a validity check with block symantics of ((foo) ? TRUE : FALSE)
  34. // ie, foo is always executed and should return a boolean, with the side effect
  35. // that it may also throw an assert if ASSERTS_ON is 1.
  36. //
  37. VOID
  38. AssertFail(
  39. IN PCSTR FileName,
  40. IN UINT LineNumber,
  41. IN PSTR Condition,
  42. IN BOOL NoUI
  43. );
  44. #define MYASSERT(x) if(!(x)) { AssertFail(__FILE__,__LINE__,#x,FALSE); }
  45. #define MYVERIFY(x) ((x) ? (TRUE) : (AssertFail(__FILE__,__LINE__,#x,FALSE),FALSE) )
  46. #else
  47. #define MYASSERT(x)
  48. #define MYVERIFY(x) ((x) ? TRUE : FALSE)
  49. #endif
  50. //
  51. // in case we accidently pick up ASSERT/VERIFY from elsewhere
  52. //
  53. #undef ASSERT
  54. #undef VERIFY