electron/patches/chromium/fix_suppress_clang_-wimplic...

33 lines
1.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: John Kleinschmidt <jkleinsc@electronjs.org>
Date: Wed, 24 Jan 2024 11:14:50 -0500
Subject: fix: suppress clang -Wimplicit-const-int-float-conversion in
v8_binding_for_core
fixes the following error on build:
../../third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h:272:38: error: implicit conversion from 'const uint64_t' (aka 'const unsigned long') to 'double' changes value from 18446744073709551615 to 18446744073709551616 [-Werror,-Wimplicit-const-int-float-conversion]
272 | double fmod_value = fmod(trunc(d), kMaxULL + 1.0);
| ^~~~~~~ ~
This error appears to be caused by https://chromium-review.googlesource.com/c/chromium/src/+/5224201
but doesn't appear to be reproducible in chrome.
Given the nature of this code it appears safe to ignore this check.
diff --git a/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h b/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h
index baadef23f61099dfec4a2dcb254ece25a1961433..685b2744b00e819dfda9d9f67979c55745cde4ea 100644
--- a/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h
+++ b/third_party/blink/renderer/bindings/core/v8/v8_binding_for_core.h
@@ -269,7 +269,10 @@ inline uint64_t DoubleToInteger(double d) {
constexpr uint64_t kMaxULL = std::numeric_limits<uint64_t>::max();
// -2^{64} < fmod_value < 2^{64}.
+#pragma clang diagnostic push
+#pragma clang diagnostic ignored "-Wimplicit-const-int-float-conversion"
double fmod_value = fmod(trunc(d), kMaxULL + 1.0);
+#pragma clang diagnostic pop
if (fmod_value >= 0) {
// 0 <= fmod_value < 2^{64}.
// 0 <= value < 2^{64}. This cast causes no loss.