diff --git a/BUILD.gn b/BUILD.gn index 88b5352ce7..949c9dd362 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -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", ] diff --git a/src/base/small-vector.h b/src/base/small-vector.h index dc24af3286..eb65f8c930 100644 --- a/src/base/small-vector.h +++ b/src/base/small-vector.h @@ -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_; } diff --git a/src/base/string-format.h b/src/base/string-format.h index 8602597915..37096e3d7b 100644 --- a/src/base/string-format.h +++ b/src/base/string-format.h @@ -171,6 +171,11 @@ class FormattedString { std::tuple...> 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_ diff --git a/src/compiler/turboshaft/graph.h b/src/compiler/turboshaft/graph.h index 9bf83a1889..1740c980b7 100644 --- a/src/compiler/turboshaft/graph.h +++ b/src/compiler/turboshaft/graph.h @@ -551,9 +551,9 @@ class Graph { } base::iterator_range> blocks() { - return { - base::DerefPtrIterator(bound_blocks_.data()), - base::DerefPtrIterator(bound_blocks_.data() + bound_blocks_.size())}; + return {base::DerefPtrIterator(bound_blocks_.data()), + base::DerefPtrIterator(bound_blocks_.data() + + bound_blocks_.size())}; } base::iterator_range> blocks() const { return {base::DerefPtrIterator(bound_blocks_.data()), diff --git a/src/heap/cppgc/write-barrier.cc b/src/heap/cppgc/write-barrier.cc index de586dac38..098f950d2a 100644 --- a/src/heap/cppgc/write-barrier.cc +++ b/src/heap/cppgc/write-barrier.cc @@ -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_; } diff --git a/src/utils/bit-vector.h b/src/utils/bit-vector.h index a5c41676b7..42905ffdaa 100644 --- a/src/utils/bit-vector.h +++ b/src/utils/bit-vector.h @@ -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{}); } } diff --git a/src/wasm/module-decoder-impl.h b/src/wasm/module-decoder-impl.h index 6b95e1cd4b..ace9d63708 100644 --- a/src/wasm/module-decoder-impl.h +++ b/src/wasm/module-decoder-impl.h @@ -297,6 +297,10 @@ class WasmSectionIterator { } }; +// Add an explicit template deduction guide for {WasmSectionIterator}. +template +WasmSectionIterator(Decoder*, T) -> WasmSectionIterator; + // The main logic for decoding the bytes of a module. template class ModuleDecoderTemplate : public Decoder {