From b60823d4092727753a09bac1cb8e1e5f942decbd Mon Sep 17 00:00:00 2001 From: Chris Peterson Date: Sat, 15 Mar 2014 23:23:28 -0700 Subject: [PATCH] Bug 984073 - Fix warning in double-conversion and suppress warnings in lz4. r=Waldo --- mfbt/double-conversion/fix-gcc-warnings.patch | 24 +++++++++++++++++++ mfbt/double-conversion/strtod.cc | 2 ++ mfbt/double-conversion/update.sh | 1 + mfbt/moz.build | 5 ++++ 4 files changed, 32 insertions(+) create mode 100644 mfbt/double-conversion/fix-gcc-warnings.patch diff --git a/mfbt/double-conversion/fix-gcc-warnings.patch b/mfbt/double-conversion/fix-gcc-warnings.patch new file mode 100644 index 00000000000..4e13dd0b085 --- /dev/null +++ b/mfbt/double-conversion/fix-gcc-warnings.patch @@ -0,0 +1,24 @@ +diff --git a/a/mfbt/double-conversion/strtod.cc b/inbound/mfbt/double-conversion/strtod.cc +index 9758989..97fa4a5 100644 +--- a/a/mfbt/double-conversion/strtod.cc ++++ b/inbound/mfbt/double-conversion/strtod.cc +@@ -501,17 +501,19 @@ float Strtof(Vector buffer, int exponent) { + // if they would round to the same float. If the guess is not correct we have + // to look at four values (since two different doubles could be the correct + // double). + + double double_next = Double(double_guess).NextDouble(); + double double_previous = Double(double_guess).PreviousDouble(); + + float f1 = static_cast(double_previous); ++#if defined(DEBUG) + float f2 = float_guess; ++#endif + float f3 = static_cast(double_next); + float f4; + if (is_correct) { + f4 = f3; + } else { + double double_next2 = Double(double_next).NextDouble(); + f4 = static_cast(double_next2); + } diff --git a/mfbt/double-conversion/strtod.cc b/mfbt/double-conversion/strtod.cc index 9758989f71d..97fa4a58a9a 100644 --- a/mfbt/double-conversion/strtod.cc +++ b/mfbt/double-conversion/strtod.cc @@ -506,7 +506,9 @@ float Strtof(Vector buffer, int exponent) { double double_previous = Double(double_guess).PreviousDouble(); float f1 = static_cast(double_previous); +#if defined(DEBUG) float f2 = float_guess; +#endif float f3 = static_cast(double_next); float f4; if (is_correct) { diff --git a/mfbt/double-conversion/update.sh b/mfbt/double-conversion/update.sh index 0606d38697e..8bdd655e00f 100755 --- a/mfbt/double-conversion/update.sh +++ b/mfbt/double-conversion/update.sh @@ -21,6 +21,7 @@ patch -p3 < use-StandardInteger.patch patch -p3 < use-mozilla-assertions.patch patch -p3 < use-static_assert.patch patch -p3 < ToPrecision-exponential.patch +patch -p3 < fix-gcc-warnings.patch # Merged upstream, part of 2.0.1 version patch -p3 < fix-aarch64-macro.patch diff --git a/mfbt/moz.build b/mfbt/moz.build index 6fbe29cf611..b0cade3f28e 100644 --- a/mfbt/moz.build +++ b/mfbt/moz.build @@ -93,3 +93,8 @@ SOURCES += [ ] DISABLE_STL_WRAPPING = True + +# Suppress warnings in third-party code. +if CONFIG['GNU_CXX']: + # TODO: Remove this LZ4 warning suppression after bug 993267 is fixed. + SOURCES['Compression.cpp'].flags += ['-Wno-unused-function']