[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Removing -Wunsuffixed-float-constants, -Wdouble-promotion, -Wformat-
From: |
Paul Eggert |
Subject: |
Re: Removing -Wunsuffixed-float-constants, -Wdouble-promotion, -Wformat-zero-length |
Date: |
Tue, 29 Nov 2011 13:27:42 -0800 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:8.0) Gecko/20111115 Thunderbird/8.0 |
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! :-)
- Removing -Wunsuffixed-float-constants, -Wdouble-promotion, -Wformat-zero-length, Paul Eggert, 2011/11/29
- Re: Removing -Wunsuffixed-float-constants, -Wdouble-promotion, -Wformat-zero-length, Eric Blake, 2011/11/29
- Re: Removing -Wunsuffixed-float-constants, -Wdouble-promotion, -Wformat-zero-length, Jim Meyering, 2011/11/29
- Re: Removing -Wunsuffixed-float-constants, -Wdouble-promotion, -Wformat-zero-length, Eric Blake, 2011/11/29
- Re: Removing -Wunsuffixed-float-constants, -Wdouble-promotion, -Wformat-zero-length, Eric Blake, 2011/11/29
- Re: Removing -Wunsuffixed-float-constants, -Wdouble-promotion, -Wformat-zero-length, Simon Josefsson, 2011/11/30
- Re: Removing -Wunsuffixed-float-constants, -Wdouble-promotion, -Wformat-zero-length, Jim Meyering, 2011/11/30
- Re: Removing -Wunsuffixed-float-constants, -Wdouble-promotion, -Wformat-zero-length, Jim Meyering, 2011/11/30
- Re: Removing -Wunsuffixed-float-constants, -Wdouble-promotion, -Wformat-zero-length, Paul Eggert, 2011/11/30