diff options
Diffstat (limited to 'src/util.hpp')
-rw-r--r-- | src/util.hpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/util.hpp b/src/util.hpp new file mode 100644 index 0000000..2fe6e84 --- /dev/null +++ b/src/util.hpp @@ -0,0 +1,29 @@ +#ifndef WM_UTIL_H +#define WM_UTIL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef __GNUC__ +#define ATTR_FORMAT(stringindex, firsttocheck) __attribute__((format(printf, stringindex, firsttocheck))) +#else +#define ATTR_FORMAT(stringindex, firsttocheck) +#endif + +void lognotice(char const *fmt, ...) ATTR_FORMAT(1,2); +void logerror(char const *fmt, ...) ATTR_FORMAT(1,2); +void fatal(char const *fmt, ...) ATTR_FORMAT(1,2); + +#ifdef DEBUG_OUTPUT +void logdebug(char const *fmt, ...) ATTR_FORMAT(1,2); +#else +static inline void logdebug(char const * fmt, ...) ATTR_FORMAT(1,2); +static inline void logdebug(char const * fmt, ...) {} +#endif + +#ifdef __cplusplus +} +#endif + +#endif // !WM_UTIL_H |