check.h 453 B

1234567891011121314151617181920212223242526
  1. /*
  2. * Copyright (c) 2019 Intel Corporation
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. #ifndef ZEPHYR_INCLUDE_SYS_CHECK_H_
  7. #define ZEPHYR_INCLUDE_SYS_CHECK_H_
  8. #include <sys/__assert.h>
  9. #if defined(CONFIG_ASSERT_ON_ERRORS)
  10. #define CHECKIF(expr) \
  11. __ASSERT_NO_MSG(!(expr)); \
  12. if (0)
  13. #elif defined(CONFIG_NO_RUNTIME_CHECKS)
  14. #define CHECKIF(...) \
  15. if (0)
  16. #else
  17. #define CHECKIF(expr) \
  18. if (expr)
  19. #endif
  20. #endif /* ZEPHYR_INCLUDE_SYS_CHECK_H_ */