On 11/29/11 13:18, Jim Meyering wrote: > Have you found code that triggers a -Wformat-zero-length warning > yet that doesn't seem worth adjusting?
I haven't run into it one way or another, but all my instincts are against that diagnostic. I suspect that the most-common way that it would happen would be something like this admittedly-contrived example: #if FEATURE_ENABLED #define FEATURE_FORMAT "feature" #else #define FEATURE_FORMAT "" #endif ... printf (buf, FEATURE_FORMAT); where the printf can be optimized away if FEATURE_ENABLED is zero, and the compiler is warning us about that. This reminds me too much about bogus warnings that some compilers give for this: enum { N = FEATURE_ENABLED ? 1000 : 0 }; ... for (i = 0; i < N; i++) foo (i); where the compiler proudly warns that it has optimized the loop away entirely, and did I really mean that? (Yes I did! and I don't want to be warned about it! :-)