mfbt/double-conversion/use-static_assert.patch

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial