From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=52220 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P6ZAy-00025N-TV for qemu-devel@nongnu.org; Thu, 14 Oct 2010 21:33:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P6ZAy-0005f6-1f for qemu-devel@nongnu.org; Thu, 14 Oct 2010 21:33:40 -0400 Received: from mail-bw0-f45.google.com ([209.85.214.45]:61031) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P6ZAx-0005ew-TB for qemu-devel@nongnu.org; Thu, 14 Oct 2010 21:33:40 -0400 Received: by bwz6 with SMTP id 6so1029239bwz.4 for ; Thu, 14 Oct 2010 18:33:39 -0700 (PDT) Sender: Paolo Bonzini Message-ID: <4CB7AF6F.4010104@redhat.com> Date: Fri, 15 Oct 2010 03:33:35 +0200 From: Paolo Bonzini MIME-Version: 1.0 References: <4CB74350.80201@redhat.com> In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] Re: [PATCH] Suppress warning: zero-length gnu_printf format string List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Blue Swirl Cc: Markus Armbruster , qemu-devel@nongnu.org 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 >> 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