[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf fo
From: |
Blue Swirl |
Subject: |
Re: [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string |
Date: |
Fri, 15 Oct 2010 17:41:30 +0000 |
On Fri, Oct 15, 2010 at 1:33 AM, Paolo Bonzini <address@hidden> 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.
- [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string, (continued)
- [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string, Blue Swirl, 2010/10/12
- [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string, Markus Armbruster, 2010/10/13
- [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string, Markus Armbruster, 2010/10/14
- [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string, Blue Swirl, 2010/10/14
- [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string, Paolo Bonzini, 2010/10/14
- [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string, Blue Swirl, 2010/10/14
- [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string, Paolo Bonzini, 2010/10/14
- Re: [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string,
Blue Swirl <=
- [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string, Paolo Bonzini, 2010/10/16
- Re: [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string, Blue Swirl, 2010/10/16
- [Qemu-devel] [PATCH] Silence compiler warning in json test case, Jan Kiszka, 2010/10/16
- Re: [Qemu-devel] [PATCH] Silence compiler warning in json test case, Luiz Capitulino, 2010/10/18