Skip to content

Commit c9535d7

Browse files
[libc++][test] Silence MSVC warnings (#79791)
* `libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find.pass.cpp` emits a bunch of warnings, all caused by what appears to be intentional code: + Silence MSVC warning C4245: conversion from `'int'` to `'wchar_t'`, signed/unsigned mismatch - Caused by: `test<U>(0, -1);` + Silence MSVC warning C4305: 'argument': truncation from `'int'` to `'bool'` - Caused by: `test<U>(0, -1);` + Silence MSVC warning C4310: cast truncates constant value - Caused by: `test<U>(T(-129), U(-129));` + Silence MSVC warning C4805: `'=='`: unsafe mix of type `'char'` and type `'bool'` in operation - Caused by: `bool expect_match = val == to_find;` * `libcxx/test/std/algorithms/alg.nonmodifying/alg.fold/left_folds.pass.cpp` + Silence MSVC warning C4244: 'argument': conversion from `'double'` to `'const int'`, possible loss of data - Caused by `[](int const x, double const y) { return x + y; }` deliberately being given `double`s to truncate. * `libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.pointer.pass.cpp` + Silence MSVC warnings about C++20 deprecated `volatile`. - Caused by: `runtime_test< volatile T>();`
1 parent ba5d92e commit c9535d7

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

libcxx/test/std/algorithms/alg.nonmodifying/alg.find/find.pass.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,12 @@
88

99
// ADDITIONAL_COMPILE_FLAGS(gcc): -Wno-bool-compare
1010
// ADDITIONAL_COMPILE_FLAGS(gcc-style-warnings): -Wno-sign-compare
11+
// MSVC warning C4245: conversion from 'int' to 'wchar_t', signed/unsigned mismatch
12+
// MSVC warning C4305: truncation from 'int' to 'bool'
13+
// MSVC warning C4310: cast truncates constant value
1114
// MSVC warning C4389: '==': signed/unsigned mismatch
12-
// ADDITIONAL_COMPILE_FLAGS(cl-style-warnings): /wd4389
15+
// MSVC warning C4805: '==': unsafe mix of type 'char' and type 'bool' in operation
16+
// ADDITIONAL_COMPILE_FLAGS(cl-style-warnings): /wd4245 /wd4305 /wd4310 /wd4389 /wd4805
1317

1418
// <algorithm>
1519

libcxx/test/std/algorithms/alg.nonmodifying/alg.fold/left_folds.pass.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010

1111
// UNSUPPORTED: c++03, c++11, c++14, c++17, c++20
1212

13+
// MSVC warning C4244: 'argument': conversion from 'double' to 'const int', possible loss of data
14+
// ADDITIONAL_COMPILE_FLAGS(cl-style-warnings): /wd4244
15+
1316
// template<input_iterator I, sentinel_for<I> S, class T,
1417
// indirectly-binary-left-foldable<T, I> F>
1518
// constexpr see below ranges::fold_left_with_iter(I first, S last, T init, F f);

libcxx/test/std/numerics/numeric.ops/numeric.ops.midpoint/midpoint.pointer.pass.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
//===----------------------------------------------------------------------===//
88
//
99
// UNSUPPORTED: c++03, c++11, c++14, c++17
10+
11+
// MSVC warning C5215: a function parameter with a volatile qualified type is deprecated in C++20
12+
// MSVC warning C5216: a volatile qualified return type is deprecated in C++20
13+
// ADDITIONAL_COMPILE_FLAGS(cl-style-warnings): /wd5215 /wd5216
14+
1015
// <numeric>
1116

1217
// template <class _Tp>

0 commit comments

Comments
 (0)