This is an archive of the discontinued LLVM Phabricator instance.

[libcxx] [test] Fix MSVC warnings C4127 and C6326 about constants.
ClosedPublic

Authored by STL_MSFT on Jan 17 2017, 5:52 PM.

Details

Summary

[libcxx] [test] Fix MSVC warnings C4127 and C6326 about constants.

MSVC has compiler warnings C4127 "conditional expression is constant" (enabled
by /W4) and C6326 "Potential comparison of a constant with another constant"
(enabled by /analyze). They're potentially useful, although they're slightly
annoying to library devs who know what they're doing. In the latest version of
the compiler, C4127 is suppressed when the compiler sees simple tests like
"if (name_of_thing)", so extracting comparison expressions into named
constants is a workaround. At the same time, using std::integral_constant
avoids C6326, which doesn't look at template arguments.

test/std/containers/sequences/vector.bool/emplace.pass.cpp
Replace 1 == 1 with true, which is the same as far as the library is concerned.

Diff Detail

Event Timeline

STL_MSFT created this revision.Jan 17 2017, 5:52 PM
EricWF accepted this revision.Jan 17 2017, 6:06 PM

The changes sure look funny but I have no issue with them.

This revision is now accepted and ready to land.Jan 17 2017, 6:06 PM
STL_MSFT closed this revision.Jan 18 2017, 12:24 PM