aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/rin/definitions.h2
-rw-r--r--include/rin/diagnostic.h17
2 files changed, 13 insertions, 6 deletions
diff --git a/include/rin/definitions.h b/include/rin/definitions.h
index 9995e0f..75e4da0 100644
--- a/include/rin/definitions.h
+++ b/include/rin/definitions.h
@@ -28,7 +28,7 @@
# define WEAK_SYM __attribute__((weak))
/* allow the compiler to check varargs */
-# define FORMAT_STRING(a, b) __attribute__((format (printf, a, b)))
+# define FORMAT_STRING(a, b) __attribute__((format (gnu_printf, a, b)))
/* optimizing likely / unlikely branches */
# define likely(a) (__builtin_expect(!!(a), 1))
diff --git a/include/rin/diagnostic.h b/include/rin/diagnostic.h
index 09d2fb9..ccec0b8 100644
--- a/include/rin/diagnostic.h
+++ b/include/rin/diagnostic.h
@@ -28,9 +28,11 @@
#define RIN_DIAG_UNSET 0
#define RIN_DIAG_PREFIX (1 << 0)
#define RIN_DIAG_TIME (1 << 1)
-#define RIN_DIAG_THREADNUM (1 << 2)
+#define RIN_DIAG_FUNC (1 << 2)
+#define RIN_DIAG_THREADNUM (1 << 3)
#define RIN_DIAG_ALLFLAGS ( RIN_DIAG_PREFIX | \
RIN_DIAG_TIME | \
+ RIN_DIAG_FUNC | \
RIN_DIAG_THREADNUM)
enum rin_diag_outstream {
@@ -44,9 +46,14 @@ void rin_diag_init(void);
int rin_diag_flags(int flag, int action);
int rin_diag_set_outstream(enum rin_diag_outstream channel, FILE *stream);
-void rin_err(const char *format, ...) FORMAT_STRING(1, 2);
-void rin_fixme(const char *format, ...) FORMAT_STRING(1, 2);
-void rin_warn(const char *format, ...) FORMAT_STRING(1, 2);
-void rin_info(const char *format, ...) FORMAT_STRING(1, 2);
+void __rin_err(const char *func_name, const char *format, ...) FORMAT_STRING(2, 3);
+void __rin_warn(const char *func_name, const char *format, ...) FORMAT_STRING(2, 3);
+void __rin_fixme(const char *func_name, const char *format, ...) FORMAT_STRING(2, 3);
+void __rin_info(const char *func_name, const char *format, ...) FORMAT_STRING(2, 3);
+
+#define rin_err(a,...) do {__rin_err(__func__, a __VA_OPT__(,) __VA_ARGS__); } while (0)
+#define rin_warn(a,...) do {__rin_warn(__func__, a __VA_OPT__(,) __VA_ARGS__); } while (0)
+#define rin_fixme(a,...) do {__rin_fixme(__func__, a __VA_OPT__(,) __VA_ARGS__); } while (0)
+#define rin_info(a,...) do {__rin_info(__func__, a __VA_OPT__(,) __VA_ARGS__); } while (0)
#endif /* LIBRIN_DIAGNOSTIC_INCLUDED */