1
0

bfc_assert.h 944 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #ifndef _ASSERT_H
  2. #define _ASSERT_H
  3. #include <bfc/wasabi_std.h>
  4. #ifdef CPLUSPLUS
  5. extern "C" {
  6. #endif
  7. COMEXP void _assert_handler(const char *reason, const char *file, int line);
  8. COMEXP void _assert_handler_str(const char *string, const char *reason, const char *file, int line);
  9. #ifdef CPLUSPLUS
  10. }
  11. #endif
  12. #ifdef ASSERT
  13. #undef ASSERT
  14. #endif
  15. // benski> added june 7 2007.. somewhat of a hack - don't want to enable assert's for final builds
  16. #include "../../Winamp/buildtype.h"
  17. #if defined(_DEBUG) /*|| defined(INTERNAL) */|| defined(BETA)
  18. #define ASSERTS_ENABLED
  19. #endif
  20. #ifdef ASSERTS_ENABLED
  21. #define ASSERT(x) ((x) ? void() : _assert_handler(#x, __FILE__, __LINE__))
  22. #define ASSERTPR(x, str) ((x) ? void() : _assert_handler_str((str), #x, __FILE__, __LINE__))
  23. #define ASSERTALWAYS(str) _assert_handler_str((str), 0, __FILE__, __LINE__)
  24. #else
  25. #define ASSERT(x) ;
  26. #define ASSERTPR(x,y) ;
  27. #define ASSERTALWAYS ;
  28. #endif
  29. #endif