summaryrefslogtreecommitdiff
path: root/mfbt/double-conversion/use-static_assert.patch
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /mfbt/double-conversion/use-static_assert.patch
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloaduxp-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
Add m-esr52 at 52.6.0
Diffstat (limited to 'mfbt/double-conversion/use-static_assert.patch')
-rw-r--r--mfbt/double-conversion/use-static_assert.patch25
1 files changed, 25 insertions, 0 deletions
diff --git a/mfbt/double-conversion/use-static_assert.patch b/mfbt/double-conversion/use-static_assert.patch
new file mode 100644
index 0000000000..4143782599
--- /dev/null
+++ b/mfbt/double-conversion/use-static_assert.patch
@@ -0,0 +1,25 @@
+diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h
+--- a/mfbt/double-conversion/utils.h
++++ b/mfbt/double-conversion/utils.h
+@@ -275,19 +275,18 @@ class StringBuilder {
+ // There is an additional use for BitCast.
+ // Recent gccs will warn when they see casts that may result in breakage due to
+ // the type-based aliasing rule. If you have checked that there is no breakage
+ // you can use BitCast to cast one pointer type to another. This confuses gcc
+ // enough that it can no longer see that you have cast one pointer type to
+ // another thus avoiding the warning.
+ template <class Dest, class Source>
+ inline Dest BitCast(const Source& source) {
+- // Compile time assertion: sizeof(Dest) == sizeof(Source)
+- // A compile error here means your Dest and Source have different sizes.
+- typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1];
++ static_assert(sizeof(Dest) == sizeof(Source),
++ "BitCast's source and destination types must be the same size");
+
+ Dest dest;
+ memmove(&dest, &source, sizeof(dest));
+ return dest;
+ }
+
+ template <class Dest, class Source>
+ inline Dest BitCast(Source* source) {