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

Reply via email to