Bug 41804 - Disable MSVC warning 4288
Summary: Disable MSVC warning 4288
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P2 Normal
Assignee: Dumitru Daniliuc
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-07 14:51 PDT by Dumitru Daniliuc
Modified: 2010-07-07 15:20 PDT (History)
2 users (show)

See Also:


Attachments
patch (3.28 KB, patch)
2010-07-07 15:05 PDT, Dumitru Daniliuc
aroben: review+
dumi: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dumitru Daniliuc 2010-07-07 14:51:50 PDT
MSVC has a non-standard extension (/Ze /Zc:forScope) that allows variables declared in for-loops to remain in the "outer" scope: http://msdn.microsoft.com/en-us/library/bk5hc10s.aspx. When the same variable is re-declared after the for-loop, the compiler issues warning C4288. There's also a bug in VS2005 that enables this extension even if the /Zc:forScope option wasn't specified: http://connect.microsoft.com/VisualStudio/feedback/details/338010/bogus-compiler-warning-c4288. Looks like we got hit by that bug, so we need to disable that warning.
Comment 1 Dumitru Daniliuc 2010-07-07 15:05:22 PDT
Created attachment 60785 [details]
patch
Comment 2 Adam Roben (:aroben) 2010-07-07 15:08:37 PDT
Comment on attachment 60785 [details]
patch

> +        MSVC has a non-standard extension (/Ze /Zc:forScope-) that allows
> +        variables declared in for-loops to remain visible in the same
> +        scope even after the for-loop
> +        (http://msdn.microsoft.com/en-us/library/bk5hc10s.aspx). When this
> +        extension is enabled, re-declaring the same variable in that scope
> +        results in a C4288 warning.
> +
> +        At the same time, there seems to be a bug in VS2005 that
> +        erroneously enables /Zc:forScope- even when that option is not
> +        specified
> +        (http://connect.microsoft.com/VisualStudio/feedback/details/338010/bogus-compiler-warning-c4288).

This makes it sound like the actual behavior gets enabled, not just the warning. Explaining in the previous paragraph that /Ze turns on the behavior and /Zc:forScope- turns on the warning could clear this up, as could changing the description in this paragraph.

Other than that, r=me
Comment 3 Dumitru Daniliuc 2010-07-07 15:13:49 PDT
(In reply to comment #2)
> (From update of attachment 60785 [details])
> > +        MSVC has a non-standard extension (/Ze /Zc:forScope-) that allows
> > +        variables declared in for-loops to remain visible in the same
> > +        scope even after the for-loop
> > +        (http://msdn.microsoft.com/en-us/library/bk5hc10s.aspx). When this
> > +        extension is enabled, re-declaring the same variable in that scope
> > +        results in a C4288 warning.
> > +
> > +        At the same time, there seems to be a bug in VS2005 that
> > +        erroneously enables /Zc:forScope- even when that option is not
> > +        specified
> > +        (http://connect.microsoft.com/VisualStudio/feedback/details/338010/bogus-compiler-warning-c4288).
> 
> This makes it sound like the actual behavior gets enabled, not just the warning. Explaining in the previous paragraph that /Ze turns on the behavior and /Zc:forScope- turns on the warning could clear this up, as could changing the description in this paragraph.

done. made it more clear that /Ze enables all MSVC extensions and /Zc:forScope- tells the compiler to issue a warning when it sees the same variable declared in a for-loop and then re-declared in the same scope.
Comment 4 Dumitru Daniliuc 2010-07-07 15:20:52 PDT
landed: r62708.