main: read only once from stdin for status log
[staging/windowmanager.git] / src / util.h
index 27d1015..2fe6e84 100644 (file)
@@ -5,9 +5,22 @@
 extern "C" {
 #endif
 
-void lognotice(char const *fmt, ...);
-void logerror(char const *fmt, ...);
-void fatal(char const *fmt, ...);
+#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
 }