On Sat, Nov 21, 2009 at 10:19 AM, Evan Martin <[email protected]> wrote:
> I have been particularly frustrated with gcc warning bugs that have
> been fixed in newer versions of gcc. In older gccs, the following
> code produces a "variable may be used uninitialized" warning depending
> on your optimization settings.
> int x;
> { x = 3; }
> printf("%d\n", x);
> The fix is to put in a redundant initialization of x, but people
> (reasonably) will remove them when working on the code.
There is another fix, which is to disable to warning within the file or
globally for GCC versions less than X. GCC exposes a number of different
macros and switches that let you determine the version precisely either from
script or in the preprocessor, and we already have a file that holds
compiler-specific magic.
The reason this would be nice compared to the whitelist proposal is that it
wouldn't produce false negatives. The assumption is that there are only a
small number of these kinds of cases, so enumerating them is not going to do
awful things to our code.
Random side note: In the final build fix you linked, you used a C-style
"(void)" cast. Can we use a C++-style cast? The style guide frowns on
C-style casts. (This assumes we don't disable the warning via your or my
above methods.)
PK
--
Chromium Developers mailing list: [email protected]
View archives, change email options, or unsubscribe:
http://groups.google.com/group/chromium-dev