check.h 674 B

12345678910111213141516171819202122232425262728
  1. #pragma once
  2. #ifdef __cplusplus
  3. extern "C" {
  4. #define FURI_NORETURN [[noreturn]]
  5. #else
  6. #include <stdnoreturn.h>
  7. #define FURI_NORETURN noreturn
  8. #endif
  9. /** Check condition and crash if check failed */
  10. #define furi_check(__e) ((__e) ? (void)0 : furi_crash("furi_check failed\r\n"))
  11. /** Only in debug build: Assert condition and crash if assert failed */
  12. #ifdef FURI_DEBUG
  13. #define furi_assert(__e) ((__e) ? (void)0 : furi_crash("furi_assert failed\r\n"))
  14. #else
  15. #define furi_assert(__e) ((void)0)
  16. #endif
  17. /** Crash system */
  18. FURI_NORETURN void furi_crash(const char* message);
  19. /** Halt system */
  20. FURI_NORETURN void furi_halt(const char* message);
  21. #ifdef __cplusplus
  22. }
  23. #endif