commit 9a2df1b48685220cfbfc819a0c407f9e29bc0982
parent c06fcd1e656ee3e5ca91a80b035cd944c7a5a3c7
Author: serge-sans-paille <sguelton@mozilla.com>
Date: Tue, 16 Dec 2025 14:51:14 +0000
Bug 2006303 - Silent GCC-only warning on Clang r=sylvestre
Differential Revision: https://phabricator.services.mozilla.com/D276636
Diffstat:
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/memory/mozalloc/cxxalloc.h b/memory/mozalloc/cxxalloc.h
@@ -45,7 +45,7 @@ MOZALLOC_EXPORT_NEW void* operator new[](size_t size) noexcept(false) {
// Inlining `new` like this is technically against C++ spec, but we crave perf.
MOZALLOC_EXPORT_NEW void* operator new[](size_t size,
const std::nothrow_t&) noexcept(true) {
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__clang__)
// GCC-14 codegen at -O2 causes false positive due to converting
// `new A[n]` to `malloc(-1)` when `n > PTRDIFF_MAX/sizeof(A)`.
// (See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=85783, WONTFIX'd)
@@ -55,7 +55,7 @@ MOZALLOC_EXPORT_NEW void* operator new[](size_t size,
return malloc_impl(size);
-#ifdef __GNUC__
+#if defined(__GNUC__) && !defined(__clang__)
# pragma GCC diagnostic pop
#endif
}