Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
michael@0 | 1 | diff --git a/mfbt/double-conversion/utils.h b/mfbt/double-conversion/utils.h |
michael@0 | 2 | --- a/mfbt/double-conversion/utils.h |
michael@0 | 3 | +++ b/mfbt/double-conversion/utils.h |
michael@0 | 4 | @@ -275,19 +275,18 @@ class StringBuilder { |
michael@0 | 5 | // There is an additional use for BitCast. |
michael@0 | 6 | // Recent gccs will warn when they see casts that may result in breakage due to |
michael@0 | 7 | // the type-based aliasing rule. If you have checked that there is no breakage |
michael@0 | 8 | // you can use BitCast to cast one pointer type to another. This confuses gcc |
michael@0 | 9 | // enough that it can no longer see that you have cast one pointer type to |
michael@0 | 10 | // another thus avoiding the warning. |
michael@0 | 11 | template <class Dest, class Source> |
michael@0 | 12 | inline Dest BitCast(const Source& source) { |
michael@0 | 13 | - // Compile time assertion: sizeof(Dest) == sizeof(Source) |
michael@0 | 14 | - // A compile error here means your Dest and Source have different sizes. |
michael@0 | 15 | - typedef char VerifySizesAreEqual[sizeof(Dest) == sizeof(Source) ? 1 : -1]; |
michael@0 | 16 | + static_assert(sizeof(Dest) == sizeof(Source), |
michael@0 | 17 | + "BitCast's source and destination types must be the same size"); |
michael@0 | 18 | |
michael@0 | 19 | Dest dest; |
michael@0 | 20 | memmove(&dest, &source, sizeof(dest)); |
michael@0 | 21 | return dest; |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | template <class Dest, class Source> |
michael@0 | 25 | inline Dest BitCast(Source* source) { |