qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH 5/5] HACKING: add rules for printf-like functions


From: Blue Swirl
Subject: [Qemu-devel] [PATCH 5/5] HACKING: add rules for printf-like functions
Date: Sun, 15 Aug 2010 17:51:06 +0000

Add rules for printf-like functions, based on libvirt HACKING.

Signed-off-by: Blue Swirl <address@hidden>
---
 HACKING |   13 +++++++++++++
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/HACKING b/HACKING
index 54bd2fd..8e2a298 100644
--- a/HACKING
+++ b/HACKING
@@ -103,3 +103,16 @@ so instead of e.g. isalnum you should use qemu_isalnum.

 Because of the memory management rules, you must use qemu_strdup/qemu_strndup
 instead of plain strdup/strndup.
+
+5. Printf-style functions
+
+Whenever you add a new printf-style function, i.e., one with a format
+string argument and following "..." in its prototype, be sure to use
+gcc's printf attribute directive in the prototype.
+
+This makes it so gcc's -Wformat and -Wformat-security options can do
+their jobs and cross-check format strings with the number and types
+of arguments.
+
+Currently many functions in QEMU are not following this rule but
+patches to add the attribute would be very much appreciated.
-- 
1.6.2.4



reply via email to

[Prev in Thread] Current Thread [Next in Thread]