16#if defined (__cplusplus)
34# define ERR_STATIC static __attribute__((unused))
35#elif defined (__cplusplus) || (defined (__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) )
36# define ERR_STATIC static inline
37#elif defined(_MSC_VER)
38# define ERR_STATIC static __inline
40# define ERR_STATIC static
48#define PREFIX(name) ZSTD_error_##name
55#define ERROR(name) ZSTD_ERROR(name)
56#define ZSTD_ERROR(name) ((size_t)-PREFIX(name))
63#define CHECK_V_F(e, f) size_t const e = f; if (ERR_isError(e)) return e
64#define CHECK_F(f) { CHECK_V_F(_var_err__, f); }
88void _force_has_format_string(
const char *format, ...) {
98#define _FORCE_HAS_FORMAT_STRING(...) \
100 _force_has_format_string(__VA_ARGS__); \
103#define ERR_QUOTE(str) #str
112#define RETURN_ERROR_IF(cond, err, ...) \
114 RAWLOG(3, "%s:%d: ERROR!: check %s failed, returning %s", \
115 __FILE__, __LINE__, ERR_QUOTE(cond), ERR_QUOTE(ERROR(err))); \
116 _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \
117 RAWLOG(3, ": " __VA_ARGS__); \
127#define RETURN_ERROR(err, ...) \
129 RAWLOG(3, "%s:%d: ERROR!: unconditional check failed, returning %s", \
130 __FILE__, __LINE__, ERR_QUOTE(ERROR(err))); \
131 _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \
132 RAWLOG(3, ": " __VA_ARGS__); \
142#define FORWARD_IF_ERROR(err, ...) \
144 size_t const err_code = (err); \
145 if (ERR_isError(err_code)) { \
146 RAWLOG(3, "%s:%d: ERROR!: forwarding error in %s: %s", \
147 __FILE__, __LINE__, ERR_QUOTE(err), ERR_getErrorName(err_code)); \
148 _FORCE_HAS_FORMAT_STRING(__VA_ARGS__); \
149 RAWLOG(3, ": " __VA_ARGS__); \
155#if defined (__cplusplus)
#define UNUSED_ATTR
Definition compiler.h:81
#define INLINE_KEYWORD
Definition compiler.h:25
const char * ERR_getErrorString(ERR_enum code)
Definition error_private.c:15
#define ERR_STATIC
Definition error_private.h:40
ZSTD_ErrorCode ERR_enum
Definition error_private.h:47
#define ERROR(name)
Definition error_private.h:55
ERR_STATIC ERR_enum ERR_getErrorCode(size_t code)
Definition error_private.h:60
ERR_STATIC unsigned ERR_isError(size_t code)
Definition error_private.h:58
ERR_STATIC const char * ERR_getErrorName(size_t code)
Definition error_private.h:73
ZSTD_ErrorCode
Definition zstd_errors.h:52