summaryrefslogtreecommitdiffstats
path: root/src/util.hpp
diff options
context:
space:
mode:
authorMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-07-03 11:01:28 +0200
committerMarcus Fritzsch <marcus_fritzsch@mentor.com>2017-08-08 17:24:00 +0200
commitcb5568e11bbe2d499d4d43dc30a779a5869b12ea (patch)
treec19eba624790091bd425118f696f95ccafdf2ad0 /src/util.hpp
parent1f3e4103df53cc0d0946cd712165877bae8a2c2d (diff)
util.h and its impl are now c++
Signed-off-by: Marcus Fritzsch <marcus_fritzsch@mentor.com>
Diffstat (limited to 'src/util.hpp')
-rw-r--r--src/util.hpp29
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