13 #ifndef JABBERWERX_BASICS_H
14 #define JABBERWERX_BASICS_H
25 #if defined(_WIN32) || defined(_WIN64)
26 # ifdef jabberwerx_EXPORTS
27 # define JABBERWERX_API __declspec(dllexport)
29 # define JABBERWERX_API __declspec(dllimport)
32 # define JABBERWERX_API
41 # define UNUSED_PARAM(p) ((void)&(p))
42 #endif // UNUSED_PARAM
46 # define __attribute__(x)
55 #define PRAGMA(x) _Pragma(#x)
65 #if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
66 # define GCC_BEGIN_IGNORED_WARNING(x) \
67 _Pragma("GCC diagnostic push"); \
68 PRAGMA(GCC diagnostic ignored #x)
69 # define GCC_END_IGNORED_WARNING(x) \
70 _Pragma("GCC diagnostic pop")
73 # define GCC_BEGIN_IGNORED_WARNING(x)
75 # define GCC_END_IGNORED_WARNING(x)
76 #endif // __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)
88 #define BASE10_WIDTH2(s) sizeof(#s)
90 #define BASE10_WIDTH(s) BASE10_WIDTH2(s)
93 #define UINT64_MAX_WIDTH BASE10_WIDTH(UINT64_MAX)
96 #define UINT32_MAX_WIDTH BASE10_WIDTH(UINT32_MAX)
106 #define JABBERWERX_ERROR(err, errcode) \
107 GCC_BEGIN_IGNORED_WARNING(-Waddress) \
110 (err)->code = (errcode); \
111 (err)->message = jw_err_message((errcode)); \
112 (err)->function = __func__; \
113 (err)->file = __FILE__; \
114 (err)->line = __LINE__; \
116 GCC_END_IGNORED_WARNING(-Waddress)
165 const char *
function;
JABBERWERX_API const char * jw_err_message(jw_errcode code)
JABBERWERX_API void jw_global_cleanup()
#define JABBERWERX_API
Definition: basics.h:32
jw_errcode
Definition: basics.h:122
JABBERWERX_API const char * jw_version(bool full)
const char * message
Definition: basics.h:162
const char * file
Definition: basics.h:167
JABBERWERX_API bool jw_global_init(jw_err *err)
jw_errcode code
Definition: basics.h:160
unsigned long line
Definition: basics.h:169