All of lore.kernel.org
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Suppress warning: zero-length gnu_printf format string
@ 2010-10-11 12:52 Markus Armbruster
  2010-10-11 13:09 ` [Qemu-devel] " Paolo Bonzini
  2010-10-12 17:35 ` Blue Swirl
  0 siblings, 2 replies; 17+ messages in thread
From: Markus Armbruster @ 2010-10-11 12:52 UTC (permalink / raw)
  To: qemu-devel; +Cc: Blue Swirl

Warns about this line in check-qjson.c:
    QObject *obj = qobject_from_json("");

The obvious fix (add -Wno-format-zero-length to gcc_flags) doesn't
work, because -Wall switches it on again.  Fix by putting configured
flags last.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 configure |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index d303061..3a12f92 100755
--- a/configure
+++ b/configure
@@ -146,7 +146,8 @@ QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
 LDFLAGS="-g $LDFLAGS"
 
 gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
-gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
+gcc_flags="-Wformat-security -Wformat-y2k -Wno-format-zero-length $gcc_flags"
+gcc_flags="-Winit-self -Wignored-qualifiers $gcc_flags"
 gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
 gcc_flags="-fstack-protector-all $gcc_flags"
 cat > $TMPC << EOF
@@ -154,7 +155,7 @@ int main(void) { return 0; }
 EOF
 for flag in $gcc_flags; do
     if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
-	QEMU_CFLAGS="$flag $QEMU_CFLAGS"
+	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
     fi
 done
 
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string
  2010-10-11 12:52 [Qemu-devel] [PATCH] Suppress warning: zero-length gnu_printf format string Markus Armbruster
@ 2010-10-11 13:09 ` Paolo Bonzini
  2010-10-12 17:35 ` Blue Swirl
  1 sibling, 0 replies; 17+ messages in thread
From: Paolo Bonzini @ 2010-10-11 13:09 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: Blue Swirl, qemu-devel

On 10/11/2010 02:52 PM, Markus Armbruster wrote:
> Warns about this line in check-qjson.c:
>      QObject *obj = qobject_from_json("");
>
> The obvious fix (add -Wno-format-zero-length to gcc_flags) doesn't
> work, because -Wall switches it on again.  Fix by putting configured
> flags last.
>
> Signed-off-by: Markus Armbruster<armbru@redhat.com>
> ---
>   configure |    5 +++--
>   1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index d303061..3a12f92 100755
> --- a/configure
> +++ b/configure
> @@ -146,7 +146,8 @@ QEMU_CFLAGS="-I. -I\$(SRC_PATH) $QEMU_CFLAGS"
>   LDFLAGS="-g $LDFLAGS"
>
>   gcc_flags="-Wold-style-declaration -Wold-style-definition -Wtype-limits"
> -gcc_flags="-Wformat-security -Wformat-y2k -Winit-self -Wignored-qualifiers $gcc_flags"
> +gcc_flags="-Wformat-security -Wformat-y2k -Wno-format-zero-length $gcc_flags"
> +gcc_flags="-Winit-self -Wignored-qualifiers $gcc_flags"
>   gcc_flags="-Wmissing-include-dirs -Wempty-body -Wnested-externs $gcc_flags"
>   gcc_flags="-fstack-protector-all $gcc_flags"
>   cat>  $TMPC<<  EOF
> @@ -154,7 +155,7 @@ int main(void) { return 0; }
>   EOF
>   for flag in $gcc_flags; do
>       if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
> -	QEMU_CFLAGS="$flag $QEMU_CFLAGS"
> +	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
>       fi
>   done
>

Acked-By: Paolo Bonzini <pbonzini@redhat.com>

Paolo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string
  2010-10-11 12:52 [Qemu-devel] [PATCH] Suppress warning: zero-length gnu_printf format string Markus Armbruster
  2010-10-11 13:09 ` [Qemu-devel] " Paolo Bonzini
@ 2010-10-12 17:35 ` Blue Swirl
  2010-10-13  7:19   ` Markus Armbruster
  1 sibling, 1 reply; 17+ messages in thread
From: Blue Swirl @ 2010-10-12 17:35 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

On Mon, Oct 11, 2010 at 12:52 PM, Markus Armbruster <armbru@redhat.com> wrote:
> Warns about this line in check-qjson.c:
>    QObject *obj = qobject_from_json("");
>
> The obvious fix (add -Wno-format-zero-length to gcc_flags) doesn't
> work, because -Wall switches it on again.  Fix by putting configured
> flags last.

This would disable the flag globally. I'd rather disable the flag only
for check-qjson.o or more generically, remove -Werror for checks. For
example, there could be a check for how we handle invalid formats and
then the sources would contain format strings that annoy GCC, but we
wouldn't want warnings from that to stop the build.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string
  2010-10-12 17:35 ` Blue Swirl
@ 2010-10-13  7:19   ` Markus Armbruster
  2010-10-13 18:57     ` Blue Swirl
  0 siblings, 1 reply; 17+ messages in thread
From: Markus Armbruster @ 2010-10-13  7:19 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

Blue Swirl <blauwirbel@gmail.com> writes:

> On Mon, Oct 11, 2010 at 12:52 PM, Markus Armbruster <armbru@redhat.com> wrote:
>> Warns about this line in check-qjson.c:
>>    QObject *obj = qobject_from_json("");
>>
>> The obvious fix (add -Wno-format-zero-length to gcc_flags) doesn't
>> work, because -Wall switches it on again.  Fix by putting configured
>> flags last.
>
> This would disable the flag globally. I'd rather disable the flag only
> for check-qjson.o

Is this warning worth the hassle?  What's the problem with empty format
strings?

>                   or more generically, remove -Werror for checks. For
> example, there could be a check for how we handle invalid formats and
> then the sources would contain format strings that annoy GCC, but we
> wouldn't want warnings from that to stop the build.

If you want to go that extra mile, feel free.  For me, --disable-werror
has been good enough.

Regardless, I think we need the second patch hunk, to prevent -Wall from
trampling over $gcc_flags.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string
  2010-10-13  7:19   ` Markus Armbruster
@ 2010-10-13 18:57     ` Blue Swirl
  2010-10-14  9:19       ` [Qemu-devel] [PATCH] configure: Support disabling warnings in $gcc_flags Markus Armbruster
  2010-10-14  9:20       ` [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string Markus Armbruster
  0 siblings, 2 replies; 17+ messages in thread
From: Blue Swirl @ 2010-10-13 18:57 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

On Wed, Oct 13, 2010 at 7:19 AM, Markus Armbruster <armbru@redhat.com> wrote:
> Blue Swirl <blauwirbel@gmail.com> writes:
>
>> On Mon, Oct 11, 2010 at 12:52 PM, Markus Armbruster <armbru@redhat.com> wrote:
>>> Warns about this line in check-qjson.c:
>>>    QObject *obj = qobject_from_json("");
>>>
>>> The obvious fix (add -Wno-format-zero-length to gcc_flags) doesn't
>>> work, because -Wall switches it on again.  Fix by putting configured
>>> flags last.
>>
>> This would disable the flag globally. I'd rather disable the flag only
>> for check-qjson.o
>
> Is this warning worth the hassle?  What's the problem with empty format
> strings?

Your fix solves this specific case, but it also degrades the gcc
checks of the mainstream code (slightly). I think the test suite need
not follow the level of checking that should be applied to mainstream,
or at least the warnings there should not be fatal.

>>                   or more generically, remove -Werror for checks. For
>> example, there could be a check for how we handle invalid formats and
>> then the sources would contain format strings that annoy GCC, but we
>> wouldn't want warnings from that to stop the build.
>
> If you want to go that extra mile, feel free.  For me, --disable-werror
> has been good enough.

In that case, we could ignore the warning, since the only reporter is
able to use a workaround ;-).

> Regardless, I think we need the second patch hunk, to prevent -Wall from
> trampling over $gcc_flags.

I'm fine with that part.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH] configure: Support disabling warnings in $gcc_flags
  2010-10-13 18:57     ` Blue Swirl
@ 2010-10-14  9:19       ` Markus Armbruster
  2010-10-20 20:55         ` [Qemu-devel] " Blue Swirl
  2010-10-14  9:20       ` [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string Markus Armbruster
  1 sibling, 1 reply; 17+ messages in thread
From: Markus Armbruster @ 2010-10-14  9:19 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

-Wall enables a bunch of warnings at once.  configure puts it after
$gcc_flags.  This makes it impossible to disable warnings enabled by
-Wall there.  Fix by putting configured flags last.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
---
 configure |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/configure b/configure
index d303061..3a12f92 100755
--- a/configure
+++ b/configure
@@ -154,7 +155,7 @@ int main(void) { return 0; }
 EOF
 for flag in $gcc_flags; do
     if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
-	QEMU_CFLAGS="$flag $QEMU_CFLAGS"
+	QEMU_CFLAGS="$QEMU_CFLAGS $flag"
     fi
 done
 
-- 
1.7.2.3

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string
  2010-10-13 18:57     ` Blue Swirl
  2010-10-14  9:19       ` [Qemu-devel] [PATCH] configure: Support disabling warnings in $gcc_flags Markus Armbruster
@ 2010-10-14  9:20       ` Markus Armbruster
  2010-10-14 16:38         ` Blue Swirl
  1 sibling, 1 reply; 17+ messages in thread
From: Markus Armbruster @ 2010-10-14  9:20 UTC (permalink / raw)
  To: Blue Swirl; +Cc: qemu-devel

Blue Swirl <blauwirbel@gmail.com> writes:

> On Wed, Oct 13, 2010 at 7:19 AM, Markus Armbruster <armbru@redhat.com> wrote:
>> Blue Swirl <blauwirbel@gmail.com> writes:
>>
>>> On Mon, Oct 11, 2010 at 12:52 PM, Markus Armbruster <armbru@redhat.com> wrote:
>>>> Warns about this line in check-qjson.c:
>>>>    QObject *obj = qobject_from_json("");
>>>>
>>>> The obvious fix (add -Wno-format-zero-length to gcc_flags) doesn't
>>>> work, because -Wall switches it on again.  Fix by putting configured
>>>> flags last.
>>>
>>> This would disable the flag globally. I'd rather disable the flag only
>>> for check-qjson.o
>>
>> Is this warning worth the hassle?  What's the problem with empty format
>> strings?
>
> Your fix solves this specific case, but it also degrades the gcc
> checks of the mainstream code (slightly). I think the test suite need
> not follow the level of checking that should be applied to mainstream,
> or at least the warnings there should not be fatal.

"Degrade" implies we miss something that's "wrong" enough to be worth
avoiding.  What's wrong with empty format strings?

>>>                   or more generically, remove -Werror for checks. For
>>> example, there could be a check for how we handle invalid formats and
>>> then the sources would contain format strings that annoy GCC, but we
>>> wouldn't want warnings from that to stop the build.
>>
>> If you want to go that extra mile, feel free.  For me, --disable-werror
>> has been good enough.
>
> In that case, we could ignore the warning, since the only reporter is
> able to use a workaround ;-).
>
>> Regardless, I think we need the second patch hunk, to prevent -Wall from
>> trampling over $gcc_flags.
>
> I'm fine with that part.

Reposted separately.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string
  2010-10-14  9:20       ` [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string Markus Armbruster
@ 2010-10-14 16:38         ` Blue Swirl
  2010-10-14 17:52           ` Paolo Bonzini
  0 siblings, 1 reply; 17+ messages in thread
From: Blue Swirl @ 2010-10-14 16:38 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

On Thu, Oct 14, 2010 at 9:20 AM, Markus Armbruster <armbru@redhat.com> wrote:
> Blue Swirl <blauwirbel@gmail.com> writes:
>
>> On Wed, Oct 13, 2010 at 7:19 AM, Markus Armbruster <armbru@redhat.com> wrote:
>>> Blue Swirl <blauwirbel@gmail.com> writes:
>>>
>>>> On Mon, Oct 11, 2010 at 12:52 PM, Markus Armbruster <armbru@redhat.com> wrote:
>>>>> Warns about this line in check-qjson.c:
>>>>>    QObject *obj = qobject_from_json("");
>>>>>
>>>>> The obvious fix (add -Wno-format-zero-length to gcc_flags) doesn't
>>>>> work, because -Wall switches it on again.  Fix by putting configured
>>>>> flags last.
>>>>
>>>> This would disable the flag globally. I'd rather disable the flag only
>>>> for check-qjson.o
>>>
>>> Is this warning worth the hassle?  What's the problem with empty format
>>> strings?
>>
>> Your fix solves this specific case, but it also degrades the gcc
>> checks of the mainstream code (slightly). I think the test suite need
>> not follow the level of checking that should be applied to mainstream,
>> or at least the warnings there should not be fatal.
>
> "Degrade" implies we miss something that's "wrong" enough to be worth
> avoiding.  What's wrong with empty format strings?

They generate useless calls to the formatting function, wasting
performance (slightly). Since there are no calls currently, this is of
course hypothetical.

We don't want those to appear in QEMU, but for test suite they may be
acceptable (for example, to test empty format string handling) because
test suite is not performance critical.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string
  2010-10-14 16:38         ` Blue Swirl
@ 2010-10-14 17:52           ` Paolo Bonzini
  2010-10-14 17:59             ` Blue Swirl
  0 siblings, 1 reply; 17+ messages in thread
From: Paolo Bonzini @ 2010-10-14 17:52 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Markus Armbruster, qemu-devel

On 10/14/2010 06:38 PM, Blue Swirl wrote:
> On Thu, Oct 14, 2010 at 9:20 AM, Markus Armbruster<armbru@redhat.com>  wrote:
>> Blue Swirl<blauwirbel@gmail.com>  writes:
>>
>>> On Wed, Oct 13, 2010 at 7:19 AM, Markus Armbruster<armbru@redhat.com>  wrote:
>>>> Blue Swirl<blauwirbel@gmail.com>  writes:
>>>>
>>>>> On Mon, Oct 11, 2010 at 12:52 PM, Markus Armbruster<armbru@redhat.com>  wrote:
>>>>>> Warns about this line in check-qjson.c:
>>>>>>     QObject *obj = qobject_from_json("");
>>>>>>
>>>>>> The obvious fix (add -Wno-format-zero-length to gcc_flags) doesn't
>>>>>> work, because -Wall switches it on again.  Fix by putting configured
>>>>>> flags last.
>>>>>
>>>>> This would disable the flag globally. I'd rather disable the flag only
>>>>> for check-qjson.o
>>>>
>>>> Is this warning worth the hassle?  What's the problem with empty format
>>>> strings?
>>>
>>> Your fix solves this specific case, but it also degrades the gcc
>>> checks of the mainstream code (slightly). I think the test suite need
>>> not follow the level of checking that should be applied to mainstream,
>>> or at least the warnings there should not be fatal.
>>
>> "Degrade" implies we miss something that's "wrong" enough to be worth
>> avoiding.  What's wrong with empty format strings?
>
> They generate useless calls to the formatting function, wasting
> performance (slightly). Since there are no calls currently, this is of
> course hypothetical.

It is even more hypothetical when empty-format printfs are optimized 
away by GCC:

$ gcc -x c - -O2 -S -o -
#include <stdio.h>
main() { printf (""); }

	.file	""
	.text
	.p2align 4,,15
.globl main
	.type	main, @function
main:
.LFB11:
	.cfi_startproc
	rep
	ret
	.cfi_endproc

and other attribute-printf-marked functions are probably not noop when 
the format argument is empty.

Paolo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string
  2010-10-14 17:52           ` Paolo Bonzini
@ 2010-10-14 17:59             ` Blue Swirl
  2010-10-15  1:33               ` Paolo Bonzini
  0 siblings, 1 reply; 17+ messages in thread
From: Blue Swirl @ 2010-10-14 17:59 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: Markus Armbruster, qemu-devel

On Thu, Oct 14, 2010 at 5:52 PM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 10/14/2010 06:38 PM, Blue Swirl wrote:
>>
>> On Thu, Oct 14, 2010 at 9:20 AM, Markus Armbruster<armbru@redhat.com>
>>  wrote:
>>>
>>> Blue Swirl<blauwirbel@gmail.com>  writes:
>>>
>>>> On Wed, Oct 13, 2010 at 7:19 AM, Markus Armbruster<armbru@redhat.com>
>>>>  wrote:
>>>>>
>>>>> Blue Swirl<blauwirbel@gmail.com>  writes:
>>>>>
>>>>>> On Mon, Oct 11, 2010 at 12:52 PM, Markus Armbruster<armbru@redhat.com>
>>>>>>  wrote:
>>>>>>>
>>>>>>> Warns about this line in check-qjson.c:
>>>>>>>    QObject *obj = qobject_from_json("");
>>>>>>>
>>>>>>> The obvious fix (add -Wno-format-zero-length to gcc_flags) doesn't
>>>>>>> work, because -Wall switches it on again.  Fix by putting configured
>>>>>>> flags last.
>>>>>>
>>>>>> This would disable the flag globally. I'd rather disable the flag only
>>>>>> for check-qjson.o
>>>>>
>>>>> Is this warning worth the hassle?  What's the problem with empty format
>>>>> strings?
>>>>
>>>> Your fix solves this specific case, but it also degrades the gcc
>>>> checks of the mainstream code (slightly). I think the test suite need
>>>> not follow the level of checking that should be applied to mainstream,
>>>> or at least the warnings there should not be fatal.
>>>
>>> "Degrade" implies we miss something that's "wrong" enough to be worth
>>> avoiding.  What's wrong with empty format strings?
>>
>> They generate useless calls to the formatting function, wasting
>> performance (slightly). Since there are no calls currently, this is of
>> course hypothetical.
>
> It is even more hypothetical when empty-format printfs are optimized away by
> GCC:
>
> $ gcc -x c - -O2 -S -o -
> #include <stdio.h>
> main() { printf (""); }
>
>        .file   ""
>        .text
>        .p2align 4,,15
> .globl main
>        .type   main, @function
> main:
> .LFB11:
>        .cfi_startproc
>        rep
>        ret
>        .cfi_endproc
>
> and other attribute-printf-marked functions are probably not noop when the
> format argument is empty.

How is that? Does the warning message from qobject_from_json("") mean
that GCC may optimize that call away?

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string
  2010-10-14 17:59             ` Blue Swirl
@ 2010-10-15  1:33               ` Paolo Bonzini
  2010-10-15 17:41                 ` Blue Swirl
  0 siblings, 1 reply; 17+ messages in thread
From: Paolo Bonzini @ 2010-10-15  1:33 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Markus Armbruster, qemu-devel

On 10/14/2010 07:59 PM, Blue Swirl wrote:
>> It is even more hypothetical when empty-format printfs are optimized away by
>> GCC:
>>
>> $ gcc -x c - -O2 -S -o -
>> #include<stdio.h>
>> main() { printf (""); }
>>
>>         .file   ""
>>         .text
>>         .p2align 4,,15
>> .globl main
>>         .type   main, @function
>> main:
>> .LFB11:
>>         .cfi_startproc
>>         rep
>>         ret
>>         .cfi_endproc
>>
>> and other attribute-printf-marked functions are probably not noop when the
>> format argument is empty.
>
> How is that? Does the warning message from qobject_from_json("") mean
> that GCC may optimize that call away?

I meant, the warning is likely bogus for most functions that do 
"something like printf" but it is not printf (like qobject_from_json, or 
asprintf).  If the only good reason to have the warning is a 
hypothetical performance degradation, let's please turn it off, because 
this performance degradation isn't even there.

Paolo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string
  2010-10-15  1:33               ` Paolo Bonzini
@ 2010-10-15 17:41                 ` Blue Swirl
  2010-10-16  0:37                   ` Paolo Bonzini
  0 siblings, 1 reply; 17+ messages in thread
From: Blue Swirl @ 2010-10-15 17:41 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel, Markus Armbruster

On Fri, Oct 15, 2010 at 1:33 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 10/14/2010 07:59 PM, Blue Swirl wrote:
>>>
>>> It is even more hypothetical when empty-format printfs are optimized away
>>> by
>>> GCC:
>>>
>>> $ gcc -x c - -O2 -S -o -
>>> #include<stdio.h>
>>> main() { printf (""); }
>>>
>>>        .file   ""
>>>        .text
>>>        .p2align 4,,15
>>> .globl main
>>>        .type   main, @function
>>> main:
>>> .LFB11:
>>>        .cfi_startproc
>>>        rep
>>>        ret
>>>        .cfi_endproc
>>>
>>> and other attribute-printf-marked functions are probably not noop when
>>> the
>>> format argument is empty.
>>
>> How is that? Does the warning message from qobject_from_json("") mean
>> that GCC may optimize that call away?
>
> I meant, the warning is likely bogus for most functions that do "something
> like printf" but it is not printf (like qobject_from_json, or asprintf).  If
> the only good reason to have the warning is a hypothetical performance
> degradation, let's please turn it off, because this performance degradation
> isn't even there.

Which functions are optimized away and which aren't? What would happen
to for example monitor_printf("")? There are side effects, so it
wouldn't be correct to remove a call like that, but those calls would
still bring useless performance degradation.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string
  2010-10-15 17:41                 ` Blue Swirl
@ 2010-10-16  0:37                   ` Paolo Bonzini
  2010-10-16 16:28                     ` Blue Swirl
  0 siblings, 1 reply; 17+ messages in thread
From: Paolo Bonzini @ 2010-10-16  0:37 UTC (permalink / raw)
  To: qemu-devel

On 10/15/2010 07:41 PM, Blue Swirl wrote:
> Which functions are optimized away and which aren't?

It's builtins only that are optimized away or otherwise inlined (printf, 
sprintf, etc.).  Other calls stay, together with side effects and clock 
cycles.

Paolo

^ permalink raw reply	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string
  2010-10-16  0:37                   ` Paolo Bonzini
@ 2010-10-16 16:28                     ` Blue Swirl
  2010-10-16 17:42                       ` [Qemu-devel] [PATCH] Silence compiler warning in json test case Jan Kiszka
  0 siblings, 1 reply; 17+ messages in thread
From: Blue Swirl @ 2010-10-16 16:28 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

On Sat, Oct 16, 2010 at 12:37 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> On 10/15/2010 07:41 PM, Blue Swirl wrote:
>>
>> Which functions are optimized away and which aren't?
>
> It's builtins only that are optimized away or otherwise inlined (printf,
> sprintf, etc.).  Other calls stay, together with side effects and clock
> cycles.

Then the warning makes sense (slightly) and should remain on main QEMU side.

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] [PATCH] Silence compiler warning in json test case
  2010-10-16 16:28                     ` Blue Swirl
@ 2010-10-16 17:42                       ` Jan Kiszka
  2010-10-18 14:14                         ` Luiz Capitulino
  0 siblings, 1 reply; 17+ messages in thread
From: Jan Kiszka @ 2010-10-16 17:42 UTC (permalink / raw)
  To: Blue Swirl; +Cc: Paolo Bonzini, qemu-devel

Am 16.10.2010 18:28, Blue Swirl wrote:
> On Sat, Oct 16, 2010 at 12:37 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
>> On 10/15/2010 07:41 PM, Blue Swirl wrote:
>>>
>>> Which functions are optimized away and which aren't?
>>
>> It's builtins only that are optimized away or otherwise inlined (printf,
>> sprintf, etc.).  Other calls stay, together with side effects and clock
>> cycles.
> 
> Then the warning makes sense (slightly) and should remain on main QEMU side.
> 

From: Jan Kiszka <jan.kiszka@siemens.com>

This avoids

    error: zero-length gnu_printf format string

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 check-qjson.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/check-qjson.c b/check-qjson.c
index 0b60e45..64fcdcb 100644
--- a/check-qjson.c
+++ b/check-qjson.c
@@ -639,7 +639,9 @@ END_TEST
 
 START_TEST(empty_input)
 {
-    QObject *obj = qobject_from_json("");
+    const char *empty = "";
+
+    QObject *obj = qobject_from_json(empty);
     fail_unless(obj == NULL);
 }
 END_TEST

^ permalink raw reply related	[flat|nested] 17+ messages in thread

* Re: [Qemu-devel] [PATCH] Silence compiler warning in json test case
  2010-10-16 17:42                       ` [Qemu-devel] [PATCH] Silence compiler warning in json test case Jan Kiszka
@ 2010-10-18 14:14                         ` Luiz Capitulino
  0 siblings, 0 replies; 17+ messages in thread
From: Luiz Capitulino @ 2010-10-18 14:14 UTC (permalink / raw)
  To: Jan Kiszka; +Cc: Blue Swirl, Paolo Bonzini, qemu-devel

On Sat, 16 Oct 2010 19:42:43 +0200
Jan Kiszka <jan.kiszka@web.de> wrote:

> Am 16.10.2010 18:28, Blue Swirl wrote:
> > On Sat, Oct 16, 2010 at 12:37 AM, Paolo Bonzini <pbonzini@redhat.com> wrote:
> >> On 10/15/2010 07:41 PM, Blue Swirl wrote:
> >>>
> >>> Which functions are optimized away and which aren't?
> >>
> >> It's builtins only that are optimized away or otherwise inlined (printf,
> >> sprintf, etc.).  Other calls stay, together with side effects and clock
> >> cycles.
> > 
> > Then the warning makes sense (slightly) and should remain on main QEMU side.
> > 
> 
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> This avoids
> 
>     error: zero-length gnu_printf format string
> 
> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>

I've applied this one to the QMP queue, but of course that Blue can
push it if he wants to.

> ---
>  check-qjson.c |    4 +++-
>  1 files changed, 3 insertions(+), 1 deletions(-)
> 
> diff --git a/check-qjson.c b/check-qjson.c
> index 0b60e45..64fcdcb 100644
> --- a/check-qjson.c
> +++ b/check-qjson.c
> @@ -639,7 +639,9 @@ END_TEST
>  
>  START_TEST(empty_input)
>  {
> -    QObject *obj = qobject_from_json("");
> +    const char *empty = "";
> +
> +    QObject *obj = qobject_from_json(empty);
>      fail_unless(obj == NULL);
>  }
>  END_TEST
> 

^ permalink raw reply	[flat|nested] 17+ messages in thread

* [Qemu-devel] Re: [PATCH] configure: Support disabling warnings in $gcc_flags
  2010-10-14  9:19       ` [Qemu-devel] [PATCH] configure: Support disabling warnings in $gcc_flags Markus Armbruster
@ 2010-10-20 20:55         ` Blue Swirl
  0 siblings, 0 replies; 17+ messages in thread
From: Blue Swirl @ 2010-10-20 20:55 UTC (permalink / raw)
  To: Markus Armbruster; +Cc: qemu-devel

Thanks, applied.

On Thu, Oct 14, 2010 at 9:19 AM, Markus Armbruster <armbru@redhat.com> wrote:
> -Wall enables a bunch of warnings at once.  configure puts it after
> $gcc_flags.  This makes it impossible to disable warnings enabled by
> -Wall there.  Fix by putting configured flags last.
>
> Signed-off-by: Markus Armbruster <armbru@redhat.com>
> ---
>  configure |    5 +++--
>  1 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/configure b/configure
> index d303061..3a12f92 100755
> --- a/configure
> +++ b/configure
> @@ -154,7 +155,7 @@ int main(void) { return 0; }
>  EOF
>  for flag in $gcc_flags; do
>     if compile_prog "-Werror $QEMU_CFLAGS" "-Werror $flag" ; then
> -       QEMU_CFLAGS="$flag $QEMU_CFLAGS"
> +       QEMU_CFLAGS="$QEMU_CFLAGS $flag"
>     fi
>  done
>
> --
> 1.7.2.3
>

^ permalink raw reply	[flat|nested] 17+ messages in thread

end of thread, other threads:[~2010-10-20 20:56 UTC | newest]

Thread overview: 17+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-10-11 12:52 [Qemu-devel] [PATCH] Suppress warning: zero-length gnu_printf format string Markus Armbruster
2010-10-11 13:09 ` [Qemu-devel] " Paolo Bonzini
2010-10-12 17:35 ` Blue Swirl
2010-10-13  7:19   ` Markus Armbruster
2010-10-13 18:57     ` Blue Swirl
2010-10-14  9:19       ` [Qemu-devel] [PATCH] configure: Support disabling warnings in $gcc_flags Markus Armbruster
2010-10-20 20:55         ` [Qemu-devel] " Blue Swirl
2010-10-14  9:20       ` [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string Markus Armbruster
2010-10-14 16:38         ` Blue Swirl
2010-10-14 17:52           ` Paolo Bonzini
2010-10-14 17:59             ` Blue Swirl
2010-10-15  1:33               ` Paolo Bonzini
2010-10-15 17:41                 ` Blue Swirl
2010-10-16  0:37                   ` Paolo Bonzini
2010-10-16 16:28                     ` Blue Swirl
2010-10-16 17:42                       ` [Qemu-devel] [PATCH] Silence compiler warning in json test case Jan Kiszka
2010-10-18 14:14                         ` Luiz Capitulino

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.