1234567891011121314151617181920212223242526272829 |
- #ifndef CORE_CHECK_H
- #define CORE_CHECK_H
- #if defined(__STDC_VERSION__) && __STDC_VERSION__ > 202300L
- #define check_return [[nodiscard]]
- #elif defined(__GNUC__)
- #define check_return __attribute__((warn_unused_result))
- #else
- #error "please add a 'check_return' option"
- #endif
- #if defined(__GNUC__)
- #define check_format(format_index, arg_start_index) \
- __attribute__((format(printf, format_index, arg_start_index)))
- #else
- #error "please add a 'check_format' option"
- #endif
- #if defined(__GNUC__)
- #define likely(x) __builtin_expect(!!(x), 1)
- #define unlikely(x) __builtin_expect(!!(x), 0)
- #else
- #define likely(x) x
- #define unlikely(x) x
- #endif
- #define cbool check_return bool
- #endif
|