|
From: | Paolo Bonzini |
Subject: | [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string |
Date: | Fri, 15 Oct 2010 03:33:35 +0200 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.9) Gecko/20100907 Fedora/3.1.3-1.fc13 Lightning/1.0b3pre Mnenhy/0.8.3 Thunderbird/3.1.3 |
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
[Prev in Thread] | Current Thread | [Next in Thread] |