Assert.h 750 B

12345678910111213141516171819202122232425262728293031
  1. // Copyright (C) 2009-2015, Panagiotis Christopoulos Charitos.
  2. // All rights reserved.
  3. // Code licensed under the BSD License.
  4. // http://www.anki3d.org/LICENSE
  5. #ifndef ANKI_UTIL_ASSERT_H
  6. #define ANKI_UTIL_ASSERT_H
  7. #include "anki/Config.h"
  8. /// Assertion. Print an error and stop the debugger (if it runs through a
  9. /// debugger) and then abort
  10. #if !ANKI_ASSERTIONS
  11. # define ANKI_ASSERT(x) ((void)0)
  12. # define ANKI_ASSERTS_ENABLED 0
  13. #else
  14. namespace anki {
  15. /// Its separate so we will not include iostream
  16. extern void akassert(bool expr, const char* exprTxt, const char* file,
  17. int line, const char* func);
  18. } // end namespace
  19. # define ANKI_ASSERT(x) akassert((x), #x, ANKI_FILE, __LINE__, ANKI_FUNC)
  20. # define ANKI_ASSERTS_ENABLED 1
  21. #endif
  22. #endif