libhasha 2.2.2
Loading...
Searching...
No Matches
error.h
Go to the documentation of this file.
1
2#ifndef __HASHA_INTERNAL_ERROR_H
3#define __HASHA_INTERNAL_ERROR_H
4
5#include "./internal.h"
6
7#if ha_has_feature(IO)
8
10void ha_throw(int noabort, int notime, const char *func, size_t line,
11 char *level, char *fmt, ...);
13void ha_throwd(int debug, int noabort, int notime, const char *func,
14 size_t line, char *level, char *fmt, ...);
15
17void ha_throw_fatal(int notime, const char *func, size_t line, char *fmt,
18 ...);
19
21void ha_throw_error(int notime, const char *func, size_t line, char *fmt,
22 ...);
23
25void ha_throw_warn(int notime, const char *func, size_t line, char *fmt,
26 ...);
27
28#if defined(NDEBUG)
29#define ha_throw_debug(...)
30#else
32void ha_throw_debug(int notime, const char *func, size_t line, char *fmt,
33 ...);
34#endif
35
36#define ha_curpos __func__, __LINE__
37#define ha_assert(cond, message, ...) \
38 if (!(cond)) \
39 { \
40 ha_throw_error(0, ha_curpos, "assertion " #cond " failed: " message, \
41 #__VA_ARGS__); \
42 }
43
44#else
45
46#define ha_throw(...)
47#define ha_throwd(...)
48#define ha_throw_fatal(...)
49#define ha_throw_error(func, line, fmt, ...)
50#define ha_throw_warn(...)
51#define ha_throw_debug(...)
52#define ha_curpos
53
54/* bug fix */
55#define ha_assert(cond, message, ...) (void)cond
56
57#endif
58
59#endif
HA_PUBFUN void ha_throw_fatal(int notime, const char *func, size_t line, char *fmt,...)
HA_PUBFUN void ha_throw(int noabort, int notime, const char *func, size_t line, char *level, char *fmt,...)
HA_PUBFUN void ha_throwd(int debug, int noabort, int notime, const char *func, size_t line, char *level, char *fmt,...)
HA_PUBFUN void ha_throw_warn(int notime, const char *func, size_t line, char *fmt,...)
HA_PUBFUN void ha_throw_debug(int notime, const char *func, size_t line, char *fmt,...)
HA_PUBFUN void ha_throw_error(int notime, const char *func, size_t line, char *fmt,...)
#define HA_PUBFUN
Definition hadefs.h:34