Check.h 448 B

12345678910111213141516171819
  1. #ifndef CORE_CHECK_H
  2. #define CORE_CHECK_H
  3. #if defined(__GNUC__)
  4. #define check_format(format_index, arg_start_index) \
  5. __attribute__((format(printf, format_index, arg_start_index)))
  6. #else
  7. #error "please add a 'check_format' option"
  8. #endif
  9. #if defined(__GNUC__)
  10. #define likely(x) __builtin_expect(!!(x), 1)
  11. #define unlikely(x) __builtin_expect(!!(x), 0)
  12. #else
  13. #define likely(x) x
  14. #define unlikely(x) x
  15. #endif
  16. #endif