summary refs log tree commit diff
path: root/pkgs/applications/networking/browsers/chromium/patches/constexpr-fix.patch
blob: 9f187752ea675096bae8b5f52892f0682010f52c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
From aab2cc3a20af9ebe9ddb8dfd15089f131f95817f Mon Sep 17 00:00:00 2001
From: Tomas Popela <tomas.popela@gmail.com>
Date: Fri, 20 Oct 2017 14:06:42 +0200
Subject: [PATCH] Fix the build of base/numerics with GCC

Initialize the uninitialized variables where the build is failing.

BUG=776705

Change-Id: I5782e18086a752b3676f8738930bf0553f3f97ad
---
 base/numerics/checked_math_impl.h |  6 +++---
 base/numerics/clamped_math_impl.h | 10 +++++-----
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/base/numerics/checked_math_impl.h b/base/numerics/checked_math_impl.h
index 2926b37b5e..e083389ebf 100644
--- a/base/numerics/checked_math_impl.h
+++ b/base/numerics/checked_math_impl.h
@@ -67,7 +67,7 @@ struct CheckedAddOp<T,
       return false;
     }
 
-    Promotion presult;
+    Promotion presult = {};
     bool is_valid = true;
     if (IsIntegerArithmeticSafe<Promotion, T, U>::value) {
       presult = static_cast<Promotion>(x) + static_cast<Promotion>(y);
@@ -127,7 +127,7 @@ struct CheckedSubOp<T,
       return false;
     }
 
-    Promotion presult;
+    Promotion presult = {};
     bool is_valid = true;
     if (IsIntegerArithmeticSafe<Promotion, T, U>::value) {
       presult = static_cast<Promotion>(x) - static_cast<Promotion>(y);
@@ -183,7 +183,7 @@ struct CheckedMulOp<T,
       return false;
     }
 
-    Promotion presult;
+    Promotion presult = {};
     bool is_valid = true;
     if (CheckedMulFastOp<Promotion, Promotion>::is_supported) {
       // The fast op may be available with the promoted type.
diff --git a/base/numerics/clamped_math_impl.h b/base/numerics/clamped_math_impl.h
index 7b5e4346f2..303a7e945a 100644
--- a/base/numerics/clamped_math_impl.h
+++ b/base/numerics/clamped_math_impl.h
@@ -87,7 +87,7 @@ struct ClampedAddOp<T,
                   "The saturation result cannot be determined from the "
                   "provided types.");
     const V saturated = CommonMaxOrMin<V>(IsValueNegative(y));
-    V result;
+    V result = {};
     return BASE_NUMERICS_LIKELY((CheckedAddOp<T, U>::Do(x, y, &result)))
                ? result
                : saturated;
@@ -114,7 +114,7 @@ struct ClampedSubOp<T,
                   "The saturation result cannot be determined from the "
                   "provided types.");
     const V saturated = CommonMaxOrMin<V>(!IsValueNegative(y));
-    V result;
+    V result = {};
     return BASE_NUMERICS_LIKELY((CheckedSubOp<T, U>::Do(x, y, &result)))
                ? result
                : saturated;
@@ -136,7 +136,7 @@ struct ClampedMulOp<T,
     if (ClampedMulFastOp<T, U>::is_supported)
       return ClampedMulFastOp<T, U>::template Do<V>(x, y);
 
-    V result;
+    V result = {};
     const V saturated =
         CommonMaxOrMin<V>(IsValueNegative(x) ^ IsValueNegative(y));
     return BASE_NUMERICS_LIKELY((CheckedMulOp<T, U>::Do(x, y, &result)))
@@ -156,7 +156,7 @@ struct ClampedDivOp<T,
   using result_type = typename MaxExponentPromotion<T, U>::type;
   template <typename V = result_type>
   static constexpr V Do(T x, U y) {
-    V result;
+    V result = {};
     if (BASE_NUMERICS_LIKELY((CheckedDivOp<T, U>::Do(x, y, &result))))
       return result;
     // Saturation goes to max, min, or NaN (if x is zero).
@@ -176,7 +176,7 @@ struct ClampedModOp<T,
   using result_type = typename MaxExponentPromotion<T, U>::type;
   template <typename V = result_type>
   static constexpr V Do(T x, U y) {
-    V result;
+    V result = {};
     return BASE_NUMERICS_LIKELY((CheckedModOp<T, U>::Do(x, y, &result)))
                ? result
                : x;
-- 
2.14.2