Mailinglist Archive: vhostmd (42 mails)

< Previous Next >
Re: [vhostmd] [PATCH 2/7] Allow gcc to check calls to vu_log* printf-like functions.
  • From: Jim Fehlig <jfehlig@xxxxxxxxxx>
  • Date: Thu, 15 Oct 2009 09:25:15 -0600
  • Message-id: <4AD73EDB.8050401@xxxxxxxxxx>
Richard W.M. Jones wrote:
Although using gcc-specific extensions may be suspect, we now also use
them in libguestfs without any problems. Lots of non-gcc compilers
understand __attribute__ because so much code is now compiled for gcc.

Rich.


From ff676595c8736b0463e628fe226ca3cc437703ee Mon Sep 17 00:00:00 2001
From: Richard Jones <rjones@xxxxxxxxxx>
Date: Thu, 15 Oct 2009 12:18:34 +0100
Subject: [PATCH 2/8] Allow gcc to check calls to vu_log* printf-like
functions.

---
include/util.h | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/include/util.h b/include/util.h
index 1eebf45..bd347bf 100644
--- a/include/util.h
+++ b/include/util.h
@@ -62,7 +62,8 @@ void vu_log_close(void);
/*
* Logging function.
*/
-void vu_log(int priority, const char *fmt, ...);
+void vu_log(int priority, const char *fmt, ...)
+ __attribute__((format (printf, 2, 3)));

/*
* Create buffer capable of holding len content.
@@ -82,7 +83,8 @@ void vu_buffer_add(vu_buffer *buf, const char *str, int
len);
/*
* Do a formatted print to buffer.
*/
-void vu_buffer_vsprintf(vu_buffer *buf, const char *format, ...);
+void vu_buffer_vsprintf(vu_buffer *buf, const char *format, ...)
+ __attribute__((format (printf, 2, 3)));

/*
* Erase buffer, setting use to 0 and clearing content.
-- 1.6.5.rc2

ACK

Jim

--
To unsubscribe, e-mail: vhostmd+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: vhostmd+help@xxxxxxxxxxxx

< Previous Next >