X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=src%2Futil.h;h=2fe6e8490420c679190eb1ac575c77384f369263;hb=5968e97fec8fe24398f05c694d6882895671b9f6;hp=7a1545457a330b2c29a58a8cb1dbd02883d5850f;hpb=5194d08da23a315c1405b108889f4c6ae9cb0426;p=staging%2Fwindowmanager.git diff --git a/src/util.h b/src/util.h index 7a15454..2fe6e84 100644 --- a/src/util.h +++ b/src/util.h @@ -1,8 +1,29 @@ #ifndef WM_UTIL_H #define WM_UTIL_H -void lognotice(char const *fmt, ...); -void logerror(char const *fmt, ...); -void fatal(char const *fmt, ...); +#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