#ifndef CEDILLA_HEADER_H
#define CEDILLA_HEADER_H

#define promise(x) if (!(x)) __builtin_unreachable()

#define HIDDEN __attribute__((visibility("hidden")))

#define NONNULL __attribute__((nonnull))
#define NONNULL_AT(...) __attribute__((nonnull(__VA_ARGS__)))
#define SENTINEL(...) __attribute__((sentinel))
#define SENTINEL_AT(...) __attribute__((sentinel(__VA_ARGS__)))

#define CONST __attribute__((const, warn_unused_result))
#define MALLOC __attribute__((malloc, warn_unused_result))
#define PURE __attribute__((pure, warn_unused_result))
#define WARN_UNUSED_RESULT __attribute__((warn_unused_result))

#define READONLY_(...) __attribute__((access(read_only, __VA_ARGS__)))
#define WRITEONLY(...) __attribute__((access(read_only, __VA_ARGS__)))

#define UNUSED __attribute__((unused))

#define ENTER_NONISO \
  _Pragma("GCC diagnostic push"); \
  _Pragma("GCC diagnostic ignored \"-Wpedantic\"")
#define LEAVE_NONISO \
  _Pragma("GCC diagnostic pop")

#endif /* CEDILLA_HEADER_H */
