Commit 7b4c2ff5 authored by Clemens Backes's avatar Clemens Backes Committed by V8 LUCI CQ

[build] Enable -Wctad-maybe-unsupported

Enable a clang warning that embedders might enable, and fix issues
found by it.

R=ahaas@chromium.org, nicohartmann@chromium.org, mlippautz@chromium.org

Bug: v8:13069
Change-Id: I935f18872178f4421b441f33ef8ab1d8f030dfc6
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3760443Reviewed-by: 's avatarMichael Achenbach <machenbach@chromium.org>
Reviewed-by: 's avatarNico Hartmann <nicohartmann@chromium.org>
Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Clemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/main@{#81853}
parent 06383fa1
......@@ -1318,6 +1318,11 @@ config("toolchain") {
cflags += [
"-Wmissing-field-initializers",
# Google3 enables this warning, so we should also enable it to find issue
# earlier. See https://reviews.llvm.org/D56731 for details about this
# warning.
"-Wctad-maybe-unsupported",
# TODO(v8:12245): Fix shadowing instances and remove.
"-Wno-shadow",
]
......
......@@ -100,11 +100,11 @@ class SmallVector {
T* end() { return end_; }
const T* end() const { return end_; }
auto rbegin() { return std::reverse_iterator{end_}; }
auto rbegin() const { return std::reverse_iterator{end_}; }
auto rbegin() { return std::make_reverse_iterator(end_); }
auto rbegin() const { return std::make_reverse_iterator(end_); }
auto rend() { return std::reverse_iterator{begin_}; }
auto rend() const { return std::reverse_iterator{begin_}; }
auto rend() { return std::make_reverse_iterator(begin_); }
auto rend() const { return std::make_reverse_iterator(begin_); }
size_t size() const { return end_ - begin_; }
bool empty() const { return end_ == begin_; }
......
......@@ -171,6 +171,11 @@ class FormattedString {
std::tuple<Part<Ts>...> parts_;
};
// Add an explicit deduction guide for empty template parameters (fixes
// clang's -Wctad-maybe-unsupported warning). Non-empty formatted strings
// explicitly declare template parameters anyway.
FormattedString()->FormattedString<>;
} // namespace v8::base
#endif // V8_BASE_STRING_FORMAT_H_
......@@ -551,9 +551,9 @@ class Graph {
}
base::iterator_range<base::DerefPtrIterator<Block>> blocks() {
return {
base::DerefPtrIterator(bound_blocks_.data()),
base::DerefPtrIterator(bound_blocks_.data() + bound_blocks_.size())};
return {base::DerefPtrIterator<Block>(bound_blocks_.data()),
base::DerefPtrIterator<Block>(bound_blocks_.data() +
bound_blocks_.size())};
}
base::iterator_range<base::DerefPtrIterator<const Block>> blocks() const {
return {base::DerefPtrIterator<const Block>(bound_blocks_.data()),
......
......@@ -215,7 +215,7 @@ YoungGenerationEnabler& YoungGenerationEnabler::Instance() {
void YoungGenerationEnabler::Enable() {
auto& instance = Instance();
v8::base::LockGuard _(&instance.mutex_);
v8::base::MutexGuard _(&instance.mutex_);
if (++instance.is_enabled_ == 1) {
// Enter the flag so that the check in the write barrier will always trigger
// when young generation is enabled.
......@@ -225,7 +225,7 @@ void YoungGenerationEnabler::Enable() {
void YoungGenerationEnabler::Disable() {
auto& instance = Instance();
v8::base::LockGuard _(&instance.mutex_);
v8::base::MutexGuard _(&instance.mutex_);
DCHECK_LT(0, instance.is_enabled_);
if (--instance.is_enabled_ == 0) {
WriteBarrier::FlagUpdater::Exit();
......@@ -234,7 +234,7 @@ void YoungGenerationEnabler::Disable() {
bool YoungGenerationEnabler::IsEnabled() {
auto& instance = Instance();
v8::base::LockGuard _(&instance.mutex_);
v8::base::MutexGuard _(&instance.mutex_);
return instance.is_enabled_;
}
......
......@@ -282,7 +282,7 @@ class V8_EXPORT_PRIVATE BitVector : public ZoneObject {
return data_.inline_ == 0;
} else {
return std::all_of(data_.ptr_, data_.ptr_ + data_length_,
std::logical_not{});
std::logical_not<uintptr_t>{});
}
}
......
......@@ -297,6 +297,10 @@ class WasmSectionIterator {
}
};
// Add an explicit template deduction guide for {WasmSectionIterator}.
template <class T>
WasmSectionIterator(Decoder*, T) -> WasmSectionIterator<T>;
// The main logic for decoding the bytes of a module.
template <class Tracer>
class ModuleDecoderTemplate : public Decoder {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment