From: Blue Swirl Date: Fri, 10 Sep 2010 18:53:11 +0000 (+0000) Subject: HACKING: add rules for printf-like functions X-Git-Tag: TizenStudio_2.0_p2.3.2~208^2~7186 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=876f256bde4ff5263b435412d698ed15cad584d9;p=sdk%2Femulator%2Fqemu.git HACKING: add rules for printf-like functions Add rules for printf-like functions, based on libvirt HACKING. Signed-off-by: Blue Swirl --- diff --git a/HACKING b/HACKING index 3ad87aa..6ba9d7e 100644 --- a/HACKING +++ b/HACKING @@ -110,3 +110,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.