8#ifndef ELLIPSIS_ERROR_H
9#define ELLIPSIS_ERROR_H
12# if __is_identifier(constexpr)
13# warning "constexpr keyword is not supported, emulating as static const"
14# define constexpr static const
19# define __STRINGIFY__(...) #__VA_ARGS__
26#if __has_c_attribute(__gnu__::__format__)
27# define GNU_ATTR_FORMAT_PRINTF(...) [[__gnu__::__format__(__printf__, __VA_ARGS__)]]
29# define GNU_ATTR_FORMAT_PRINTF(...)
31#if __has_c_attribute(__gnu__::__returns_nonnull__)
32# define GNU_ATTR_RETURNS_NONNULL [[__gnu__::__returns_nonnull__]]
34# define GNU_ATTR_RETURNS_NONNULL
36#if __has_c_attribute(__gnu__::__used__)
37# define GNU_ATTR_USED [[__gnu__::__used__]]
41#if __has_c_attribute(__gnu__::__malloc__)
42# define GNU_ATTR_MALLOC(...) [[__gnu__::__malloc__ __VA_OPT__((__VA_ARGS__))]]
44# define GNU_ATTR_MALLOC(...)
46#if __has_c_attribute(__gnu__::__access__)
47# define GNU_ATTR_ACCESS(...) [[__gnu__::__access__(__VA_ARGS__)]]
49# define GNU_ATTR_ACCESS(...)
51#if __has_c_attribute(__gnu__::__strict_flex_array__)
52# define GNU_ATTR_STRICT_FLEX_ARRAY(...) [[__gnu__::__strict_flex_array__(__VA_ARGS__)]]
54# define GNU_ATTR_STRICT_FLEX_ARRAY(...)
56#if __has_c_attribute(__gnu__::__counted_by__)
57# define GNU_ATTR_COUNTED_BY(...) [[__gnu__::__counted_by__(__VA_ARGS__)]]
59# define GNU_ATTR_COUNTED_BY(...)
61#if __has_c_attribute(__nodiscard__) >= 202003L
62# define STDC_ATTR_NODISCARD(...) [[__nodiscard__ __VA_OPT__((__VA_ARGS__))]]
63#elif __has_c_attribute(__nodiscard__)
64# define STDC_ATTR_NODISCARD(...) [[__nodiscard__]]
65#elif __has_c_attribute(__gnu__::__warn_unused_result__)
66# define STDC_ATTR_NODISCARD(...) [[__gnu__::__warn_unused_result__]]
68# define STDC_ATTR_NODISCARD(...)
81#define ELLIPSIS_ERROR(FORMAT, ...) ellipsis‿error("error, " FORMAT "\n" __VA_OPT__(,) __VA_ARGS__)
87#define ELLIPSIS_BUG(FORMAT, ...) ellipsis‿error("error, " FORMAT "\n" __VA_OPT__(,) __VA_ARGS__)
98#define ELLIPSIS_WARNING(FORMAT, ...) ellipsis‿error‿warning("warning, " FORMAT "\n" __VA_OPT__(,) __VA_ARGS__)
109#define ELLIPSIS_DIAGNOSTIC(FORMAT, ...) ellipsis‿error‿diagnostic("diagnostic, " FORMAT "\n" __VA_OPT__(,) __VA_ARGS__)
124#define ELLIPSIS_ERROR_CHECK(F, MESSAGE, ...) \
126 auto __LOC_ID_1_1 = F(__VA_ARGS__); \
127 if (!__LOC_ID_1_1) {\
128 ELLIPSIS_ERROR(__FILE__ ":" __STRINGIFY__(__LINE__) ": " MESSAGE); \
143#define _Lengthof(A) \
144_Generic(&(typeof(&((A)[0]))){}, \
145 typeof(A)*: (struct {\
146 static_assert(_Generic(&(typeof(&((A)[0]))){}, typeof(A)*: false, default: true), \
147 "_Lengthof needs an array parameter"); \
150 default: sizeof(A)/sizeof((A)[0]))
void ellipsis‿error‿diagnostic(char const format[],...)
Definition ellipsis-error.c:40
void ellipsis‿error(char const format[],...)
Definition ellipsis-error.c:64
void ellipsis‿error‿deadend(char const format[],...)
Definition ellipsis-error.c:75
void ellipsis‿error‿warning(char const format[],...)
Definition ellipsis-error.c:49
bool ellipsis‿error‿dump
Definition ellipsis-error.c:20
bool ellipsis‿error‿verb
Definition ellipsis-error.c:21
_Atomic bool ellipsis‿error‿finished
Definition ellipsis-error.c:22
#define GNU_ATTR_FORMAT_PRINTF(...)
Definition ellipsis-error.h:29
_Atomic(size_t)
Definition ellipsis-include.c:83