[cfe-dev] MSVC /Za considered harmful

Stephan T. Lavavej stl at exchange.microsoft.com
Thu Jun 7 10:15:21 PDT 2012

[Benjamin Kramer]
> The /Za flag was added to the build of clang not to encourage writing portable code but because an extension
> was breaking perfectly valid c++ code for "pre-C++11 move emulation".

> I wasn't aware of that (but it doesn't surprise me - in fact I bet it's the Evil Extension).
> However, I consider breaking real move semantics to be more severe than breaking simulated move semantics.

[Benjamin Kramer]
> I agree, it looks like it's not an issue anymore as /Za was removed from the clang build and everything seems to be fine :)


[Benjamin Kramer]
> A few words to /W4: We experimented with having an automated builder using /W4 in the msvc8-days but it was very noisy and slowed down the build by 2x or so

> Compared to /W3, or compared to no (!!!) warnings at all? That is news to me.

[Benjamin Kramer]
> Compared to a clean /W3 build. But this was years ago and it is likely that there were other factors leading to the slowdown.
> It produced an enormous wall of text that had to be printed to stderr, logged and sent over the network (it was a buildbot instance).
> That alone could have caused the slowdown we observed.

Yep, that certainly sounds like the culprit. For clean builds, I would expect /W3 and /W4 to be equally fast - according to my understanding, the compiler doesn't go out of its way to track more things at higher warning levels, it simply notices things and then determines whether the current warning level says it should warn. (In contrast, /analyze invokes a different and much more expensive FE.)


More information about the cfe-dev mailing list