[PATCH libinput 1/3] Mark some internal log functions as printf-style function

Peter Hutterer peter.hutterer at who-t.net
Mon Oct 24 01:45:17 UTC 2016


Fixes the respective clang warnings

Signed-off-by: Peter Hutterer <peter.hutterer at who-t.net>
---
 src/libinput.c    |  6 ++++++
 test/litest.c     | 16 ++++++++++++++++
 test/misc.c       |  7 +++++++
 tools/event-gui.c |  8 ++++++++
 tools/shared.c    |  7 +++++++
 5 files changed, 44 insertions(+)

diff --git a/src/libinput.c b/src/libinput.c
index 6958042..ec1c72a 100644
--- a/src/libinput.c
+++ b/src/libinput.c
@@ -163,6 +163,12 @@ static void
 libinput_default_log_func(struct libinput *libinput,
 			  enum libinput_log_priority priority,
 			  const char *format, va_list args)
+	LIBINPUT_ATTRIBUTE_PRINTF(3, 0);
+
+static void
+libinput_default_log_func(struct libinput *libinput,
+			  enum libinput_log_priority priority,
+			  const char *format, va_list args)
 {
 	const char *prefix;
 
diff --git a/test/litest.c b/test/litest.c
index 4c301b5..940cf79 100644
--- a/test/litest.c
+++ b/test/litest.c
@@ -270,6 +270,15 @@ litest_fail_condition(const char *file,
 		      const char *condition,
 		      const char *message,
 		      ...)
+	LIBINPUT_ATTRIBUTE_PRINTF(5, 6);
+
+void
+litest_fail_condition(const char *file,
+		      int line,
+		      const char *func,
+		      const char *condition,
+		      const char *message,
+		      ...)
 {
 	litest_log("FAILED: %s\n", condition);
 
@@ -761,6 +770,13 @@ litest_log_handler(struct libinput *libinput,
 		   enum libinput_log_priority pri,
 		   const char *format,
 		   va_list args)
+		   LIBINPUT_ATTRIBUTE_PRINTF(3, 0);
+
+static void
+litest_log_handler(struct libinput *libinput,
+		   enum libinput_log_priority pri,
+		   const char *format,
+		   va_list args)
 {
 	const char *priority = NULL;
 
diff --git a/test/misc.c b/test/misc.c
index 791ebc3..44c4502 100644
--- a/test/misc.c
+++ b/test/misc.c
@@ -852,6 +852,13 @@ simple_log_handler(struct libinput *libinput,
 		   enum libinput_log_priority priority,
 		   const char *format,
 		   va_list args)
+		   LIBINPUT_ATTRIBUTE_PRINTF(3, 0);
+
+static void
+simple_log_handler(struct libinput *libinput,
+		   enum libinput_log_priority priority,
+		   const char *format,
+		   va_list args)
 {
 	vfprintf(stderr, format, args);
 }
diff --git a/tools/event-gui.c b/tools/event-gui.c
index b67ca45..e5fb26a 100644
--- a/tools/event-gui.c
+++ b/tools/event-gui.c
@@ -110,6 +110,10 @@ struct window {
 
 static int
 error(const char *fmt, ...)
+	LIBINPUT_ATTRIBUTE_PRINTF(1, 2);
+
+static int
+error(const char *fmt, ...)
 {
 	va_list args;
 	fprintf(stderr, "error: ");
@@ -123,6 +127,10 @@ error(const char *fmt, ...)
 
 static void
 msg(const char *fmt, ...)
+	LIBINPUT_ATTRIBUTE_PRINTF(1, 2);
+
+static void
+msg(const char *fmt, ...)
 {
 	va_list args;
 	printf("info: ");
diff --git a/tools/shared.c b/tools/shared.c
index 95655ba..f539957 100644
--- a/tools/shared.c
+++ b/tools/shared.c
@@ -70,6 +70,13 @@ log_handler(struct libinput *li,
 	    enum libinput_log_priority priority,
 	    const char *format,
 	    va_list args)
+	LIBINPUT_ATTRIBUTE_PRINTF(3, 0);
+
+static void
+log_handler(struct libinput *li,
+	    enum libinput_log_priority priority,
+	    const char *format,
+	    va_list args)
 {
 	vprintf(format, args);
 }
-- 
2.9.3



More information about the wayland-devel mailing list