[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 5/5] CODING_STYLE: add rules for printf-like functio
From: |
Blue Swirl |
Subject: |
[Qemu-devel] [PATCH 5/5] CODING_STYLE: add rules for printf-like functions |
Date: |
Thu, 12 Aug 2010 17:51:10 +0000 |
Add rules for printf-like functions, based on libvirt HACKING.
Signed-off-by: Blue Swirl <address@hidden>
---
CODING_STYLE | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/CODING_STYLE b/CODING_STYLE
index b230a01..f190960 100644
--- a/CODING_STYLE
+++ b/CODING_STYLE
@@ -180,3 +180,13 @@ 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.
+
+9. 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.
--
1.6.2.4
- [Qemu-devel] [PATCH 5/5] CODING_STYLE: add rules for printf-like functions,
Blue Swirl <=