Check.h 545 B

123456789101112131415161718192021
  1. #ifndef CORE_CHECK_H
  2. #define CORE_CHECK_H
  3. #if defined(__STDC_VERSION__) && __STDC_VERSION__ > 202300L
  4. #define check_return [[nodiscard]]
  5. #elif defined(__GNUC__)
  6. #define check_return __attribute__((warn_unused_result))
  7. #else
  8. #error "please add a 'check_return' option"
  9. #endif
  10. #if defined(__GNUC__)
  11. #define check_format(format_index, arg_start_index) \
  12. __attribute__((format(printf, format_index, arg_start_index)))
  13. #else
  14. #error "please add a 'check_format' option"
  15. #endif
  16. #define cbool check_return bool
  17. #endif