Check.h 501 B

12345678910111213141516171819
  1. #ifndef CHECK_H
  2. #define 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. #endif