diff mbox

configure: Add compiler option -Wmissing-format-attribute

Message ID 1289852574-21577-1-git-send-email-weil@mail.berlios.de
State Superseded
Headers show

Commit Message

Stefan Weil Nov. 15, 2010, 8:22 p.m. UTC
With the previous patches, hopefully all functions with
printf like arguments use gcc's format checking.

This was tested with default build configuration on linux
and windows hosts (including some cross compilations),
so chances are good that there remain few (if any) functions
without format checking.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: Stefan Weil <weil@mail.berlios.de>
---
 HACKING   |    3 ---
 configure |    1 +
 2 files changed, 1 insertions(+), 3 deletions(-)

Comments

Anthony Liguori Nov. 21, 2010, 2:51 p.m. UTC | #1
On 11/15/2010 02:22 PM, Stefan Weil wrote:
> With the previous patches, hopefully all functions with
> printf like arguments use gcc's format checking.
>
> This was tested with default build configuration on linux
> and windows hosts (including some cross compilations),
> so chances are good that there remain few (if any) functions
> without format checking.
>
> Cc: Blue Swirl<blauwirbel@gmail.com>
> Signed-off-by: Stefan Weil<weil@mail.berlios.de>
>    

This breaks the build for me.  disas.c doesn't build.

Regards,

Anthony Liguori

> ---
>   HACKING   |    3 ---
>   configure |    1 +
>   2 files changed, 1 insertions(+), 3 deletions(-)
>
> diff --git a/HACKING b/HACKING
> index 6ba9d7e..3af53fd 100644
> --- a/HACKING
> +++ b/HACKING
> @@ -120,6 +120,3 @@ 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.
> diff --git a/configure b/configure
> index 7025d2b..d4c983a 100755
> --- a/configure
> +++ b/configure
> @@ -140,6 +140,7 @@ windres="${cross_prefix}${windres}"
>   QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
>   CFLAGS="-g $CFLAGS"
>   QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
> +QEMU_CFLAGS="-Wmissing-format-attribute $QEMU_CFLAGS"
>   QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
>   QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
>   QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
>
Stefan Weil Nov. 21, 2010, 3:06 p.m. UTC | #2
Am 21.11.2010 15:51, schrieb Anthony Liguori:
> On 11/15/2010 02:22 PM, Stefan Weil wrote:
>> With the previous patches, hopefully all functions with
>> printf like arguments use gcc's format checking.
>>
>> This was tested with default build configuration on linux
>> and windows hosts (including some cross compilations),
>> so chances are good that there remain few (if any) functions
>> without format checking.
>>
>> Cc: Blue Swirl<blauwirbel@gmail.com>
>> Signed-off-by: Stefan Weil<weil@mail.berlios.de>
>
> This breaks the build for me.  disas.c doesn't build.
>
> Regards,
>
> Anthony Liguori


Did you apply the "previous patches"? You can pull them here:

git://git.weilnetz.de/git/qemu for-blueswirl

If you did apply them: could you please tell me your build
environment and add the build error messages?

Thanks,

Stefan Weil
diff mbox

Patch

diff --git a/HACKING b/HACKING
index 6ba9d7e..3af53fd 100644
--- a/HACKING
+++ b/HACKING
@@ -120,6 +120,3 @@  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.
diff --git a/configure b/configure
index 7025d2b..d4c983a 100755
--- a/configure
+++ b/configure
@@ -140,6 +140,7 @@  windres="${cross_prefix}${windres}"
 QEMU_CFLAGS="-fno-strict-aliasing $QEMU_CFLAGS"
 CFLAGS="-g $CFLAGS"
 QEMU_CFLAGS="-Wall -Wundef -Wendif-labels -Wwrite-strings -Wmissing-prototypes $QEMU_CFLAGS"
+QEMU_CFLAGS="-Wmissing-format-attribute $QEMU_CFLAGS"
 QEMU_CFLAGS="-Wstrict-prototypes -Wredundant-decls $QEMU_CFLAGS"
 QEMU_CFLAGS="-D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE $QEMU_CFLAGS"
 QEMU_CFLAGS="-D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"