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

Stephan T. Lavavej via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jan 17 17:53:01 PST 2017


STL_MSFT created this revision.

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

MSVC has compiler warnings C4127 "conditional expression is constant" (enabled
by /https://reviews.llvm.org/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.


https://reviews.llvm.org/D28837

Files:
  test/std/containers/sequences/vector.bool/emplace.pass.cpp
  test/std/input.output/iostream.format/output.streams/ostream.formatted/ostream.inserters.arithmetic/minus1.pass.cpp
  test/std/utilities/function.objects/unord.hash/enum.pass.cpp
  test/std/utilities/function.objects/unord.hash/integral.pass.cpp
  test/std/utilities/template.bitset/bitset.members/all.pass.cpp
  test/std/utilities/template.bitset/bitset.members/any.pass.cpp
  test/std/utilities/template.bitset/bitset.members/index.pass.cpp
  test/std/utilities/template.bitset/bitset.members/index_const.pass.cpp
  test/std/utilities/template.bitset/bitset.members/none.pass.cpp
  test/std/utilities/template.bitset/bitset.members/op_eq_eq.pass.cpp
  test/std/utilities/template.bitset/bitset.members/to_ullong.pass.cpp
  test/std/utilities/template.bitset/bitset.members/to_ulong.pass.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D28837.84785.patch
Type: text/x-patch
Size: 11684 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170118/01ed6059/attachment-0001.bin>


More information about the cfe-commits mailing list