qemu-devel
[Top][All Lists]
Advanced

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

[Qemu-devel] Re: [PATCH 5/5] CODING_STYLE: add rules for printf-like fun


From: Blue Swirl
Subject: [Qemu-devel] Re: [PATCH 5/5] CODING_STYLE: add rules for printf-like functions
Date: Fri, 13 Aug 2010 19:47:08 +0000

On Thu, Aug 12, 2010 at 5:51 PM, Blue Swirl <address@hidden> wrote:
> 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.

This rule would be new, printf attribute is used in very few places,
about 100 cases don't use the attribute.

I think the rule still makes sense and we should convert the codebase
eventually. A note about current status etc. should be added.



reply via email to

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