[msvc] Fix debug build due to nodiscard

Adds a USE(...) around a std::accumulate which appears to have nodiscard
on it in MSVC builds. Probably only manifests with debug flags on as
otherwise code is not compiled.

Change-Id: I78f4f2c07161598336fedcdd4a204379c4deb81b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3141579
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/main@{#76671}
This commit is contained in:
Dan Elphick 2021-09-03 20:37:00 +01:00 committed by V8 LUCI CQ
parent 5681a65658
commit 81d7b164d2

View File

@ -667,12 +667,13 @@ class CheckWritableMemoryRegions {
DCHECK(std::none_of(writable_memory_.begin(), writable_memory_.end(),
[](auto region) { return region.is_empty(); }));
// Regions are sorted and disjoint.
std::accumulate(writable_memory_.begin(), writable_memory_.end(),
Address{0}, [](Address previous_end, auto region) {
DCHECK_LT(previous_end, region.begin());
return region.end();
});
// Regions are sorted and disjoint. (std::accumulate has nodiscard on msvc
// so USE is required to prevent build failures in debug builds).
USE(std::accumulate(writable_memory_.begin(), writable_memory_.end(),
Address{0}, [](Address previous_end, auto region) {
DCHECK_LT(previous_end, region.begin());
return region.end();
}));
}
private: