[oe] [meta-browser][PATCH v2 3/5] cef3: fix gcc5 compile issues

Max Krummenacher max.oss.09 at gmail.com
Sat Nov 7 12:20:27 UTC 2015


A cef3 build with gcc5 fails with warnings treated as errors.

bignum.cc, image_util.cc: strict-overflow warning
gtest-typed-test.h: unused-variable warning
SaturatedArithmetic.h: parentheses warning

Compiles for qemux86 with gcc 5.2.0 and still compiles on
armv7a with gcc linaro-4.9.4.
Note that the resulting binary has not been tested on a target.

Signed-off-by: Max Krummenacher <max.oss.09 at gmail.com>
---
 ...0001-bignum.cc-disable-warning-from-gcc-5.patch | 39 ++++++++++++++++++++
 ...-image_util.cc-disable-warning-from-gcc-5.patch | 40 ++++++++++++++++++++
 ...-test.h-disable-warning-unused-definition.patch | 43 ++++++++++++++++++++++
 ...ithmetic.h-put-parentheses-to-silence-war.patch | 39 ++++++++++++++++++++
 recipes-browser/chromium/cef3_280796.bb            |  4 ++
 5 files changed, 165 insertions(+)
 create mode 100644 recipes-browser/chromium/cef3/0001-bignum.cc-disable-warning-from-gcc-5.patch
 create mode 100644 recipes-browser/chromium/cef3/0002-image_util.cc-disable-warning-from-gcc-5.patch
 create mode 100644 recipes-browser/chromium/cef3/0003-gtest-typed-test.h-disable-warning-unused-definition.patch
 create mode 100644 recipes-browser/chromium/cef3/0004-SaturatedArithmetic.h-put-parentheses-to-silence-war.patch

diff --git a/recipes-browser/chromium/cef3/0001-bignum.cc-disable-warning-from-gcc-5.patch b/recipes-browser/chromium/cef3/0001-bignum.cc-disable-warning-from-gcc-5.patch
new file mode 100644
index 0000000..4a28bda
--- /dev/null
+++ b/recipes-browser/chromium/cef3/0001-bignum.cc-disable-warning-from-gcc-5.patch
@@ -0,0 +1,39 @@
+From 5b8c53a6bb11c8aa9b575b5a8155c25c5085f349 Mon Sep 17 00:00:00 2001
+From: Max Krummenacher <max.oss.09 at gmail.com>
+Date: Fri, 6 Nov 2015 12:22:35 +0100
+Subject: [PATCH] bignum.cc: disable warning from gcc 5
+
+addresses:
+  ../../third_party/WebKit/Source/wtf/dtoa/bignum.cc:105:10: error: assuming
+  signed overflow does not occur when assuming that (X + c) < X is always
+  false [-Werror=strict-overflow]
+      void Bignum::AssignDecimalString(Vector<const char> value) {
+           ^
+
+Signed-off-by: Max Krummenacher <max.oss.09 at gmail.com>
+
+Upstream-Status: Pending
+See the discussion on the issue in Chromium upstream:
+https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/3uwBwunIa7g
+---
+ third_party/WebKit/Source/wtf/dtoa/bignum.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/third_party/WebKit/Source/wtf/dtoa/bignum.cc b/third_party/WebKit/Source/wtf/dtoa/bignum.cc
+index a000b46..6c6d336 100644
+--- a/third_party/WebKit/Source/wtf/dtoa/bignum.cc
++++ b/third_party/WebKit/Source/wtf/dtoa/bignum.cc
+@@ -109,7 +109,10 @@ namespace double_conversion {
+         int length = value.length();
+         int pos = 0;
+         // Let's just say that each digit needs 4 bits.
++#pragma GCC diagnostic push
++#pragma GCC diagnostic warning "-Wstrict-overflow"
+         while (length >= kMaxUint64DecimalDigits) {
++#pragma GCC diagnostic pop
+             uint64_t digits = ReadUInt64(value, pos, kMaxUint64DecimalDigits);
+             pos += kMaxUint64DecimalDigits;
+             length -= kMaxUint64DecimalDigits;
+-- 
+1.8.4.5
+
diff --git a/recipes-browser/chromium/cef3/0002-image_util.cc-disable-warning-from-gcc-5.patch b/recipes-browser/chromium/cef3/0002-image_util.cc-disable-warning-from-gcc-5.patch
new file mode 100644
index 0000000..7023233
--- /dev/null
+++ b/recipes-browser/chromium/cef3/0002-image_util.cc-disable-warning-from-gcc-5.patch
@@ -0,0 +1,40 @@
+From 2f674d980a116075dc7123a3e243b1451e4a732d Mon Sep 17 00:00:00 2001
+From: Max Krummenacher <max.oss.09 at gmail.com>
+Date: Tue, 3 Nov 2015 22:13:40 +0100
+Subject: [PATCH] image_util.cc: disable warning from gcc 5
+
+addresses:
+  ../../ui/gfx/image/image_util.cc:50:6: error: assuming signed overflow does
+  not occur when assuming that (X - c) <= X is always true
+  [-Werror=strict-overflow]
+  bool VisibleMargins(const ImageSkia& image, int* leading, int* trailing) {
+       ^
+
+Signed-off-by: Max Krummenacher <max.oss.09 at gmail.com>
+
+Upstream-Status: Pending
+See the discussion on the issue in Chromium upstream:
+https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/3uwBwunIa7g
+
+---
+ ui/gfx/image/image_util.cc | 3 +++
+ 1 file changed, 3 insertions(+)
+
+diff --git a/ui/gfx/image/image_util.cc b/ui/gfx/image/image_util.cc
+index 89a3f8c..d595da3 100644
+--- a/ui/gfx/image/image_util.cc
++++ b/ui/gfx/image/image_util.cc
+@@ -68,7 +68,10 @@ bool VisibleMargins(const ImageSkia& image, int* leading, int* trailing) {
+   int inner_min = bitmap.width();
+   for (int x = 0; x < bitmap.width(); ++x) {
+     for (int y = 0; y < bitmap.height(); ++y) {
++#pragma GCC diagnostic push
++#pragma GCC diagnostic warning "-Wstrict-overflow"
+       if (SkColorGetA(bitmap.getColor(x, y)) > kMinimumVisibleOpacity) {
++#pragma GCC diagnostic pop
+         inner_min = x;
+         break;
+       }
+-- 
+1.8.4.5
+
diff --git a/recipes-browser/chromium/cef3/0003-gtest-typed-test.h-disable-warning-unused-definition.patch b/recipes-browser/chromium/cef3/0003-gtest-typed-test.h-disable-warning-unused-definition.patch
new file mode 100644
index 0000000..97a6116
--- /dev/null
+++ b/recipes-browser/chromium/cef3/0003-gtest-typed-test.h-disable-warning-unused-definition.patch
@@ -0,0 +1,43 @@
+From 1dac3072a62d1bb40db8c2f63f2729e658307761 Mon Sep 17 00:00:00 2001
+From: Max Krummenacher <max.oss.09 at gmail.com>
+Date: Sat, 7 Nov 2015 00:45:46 +0100
+Subject: [PATCH] gtest-typed-test.h: disable warning unused definitions
+
+In file included from ../../testing/gtest/include/gtest/gtest.h:66:0,
+                 from ../../base/test/task_runner_test_template.h:62,
+                 from ../../base/test/task_runner_test_template.cc:5:
+../../testing/gtest/include/gtest/gtest-typed-test.h:214:3: error: 'base::gtest_registered_test_names_TaskRunnerTest_' defined but not used [-Werror=unused-variable]
+   gtest_registered_test_names_##TestCaseName##_
+
+Signed-off-by: Max Krummenacher <max.oss.09 at gmail.com>
+
+Upstream-Status: Pending
+Seems to be fixed in current chromium sources.
+---
+ testing/gtest/include/gtest/gtest-typed-test.h | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+diff --git a/testing/gtest/include/gtest/gtest-typed-test.h b/testing/gtest/include/gtest/gtest-typed-test.h
+index fe1e83b..5053bbe 100644
+--- a/testing/gtest/include/gtest/gtest-typed-test.h
++++ b/testing/gtest/include/gtest/gtest-typed-test.h
+@@ -32,6 +32,9 @@
+ #ifndef GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
+ #define GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
+ 
++#pragma GCC diagnostic push
++#pragma GCC diagnostic warning "-Wunused"
++
+ // This header implements typed tests and type-parameterized tests.
+ 
+ // Typed (aka type-driven) tests repeat the same test for types in a
+@@ -256,4 +259,6 @@ INSTANTIATE_TYPED_TEST_CASE_P(My, FooTest, MyTypes);
+ 
+ #endif  // GTEST_HAS_TYPED_TEST_P
+ 
++#pragma GCC diagnostic pop
++
+ #endif  // GTEST_INCLUDE_GTEST_GTEST_TYPED_TEST_H_
+-- 
+1.8.4.5
+
diff --git a/recipes-browser/chromium/cef3/0004-SaturatedArithmetic.h-put-parentheses-to-silence-war.patch b/recipes-browser/chromium/cef3/0004-SaturatedArithmetic.h-put-parentheses-to-silence-war.patch
new file mode 100644
index 0000000..82fc58f
--- /dev/null
+++ b/recipes-browser/chromium/cef3/0004-SaturatedArithmetic.h-put-parentheses-to-silence-war.patch
@@ -0,0 +1,39 @@
+From 947380c31305163b3cea2c7352c6a9f38922749c Mon Sep 17 00:00:00 2001
+From: Max Krummenacher <max.oss.09 at gmail.com>
+Date: Sat, 7 Nov 2015 00:52:23 +0100
+Subject: [PATCH] SaturatedArithmetic.h: put parentheses to silence warning
+
+In file included from ../../third_party/WebKit/Source/platform/LayoutUnit.h:36:0,
+                 from ../../third_party/WebKit/Source/platform/animation/AnimationUtilities.h:29,
+                 from ../../third_party/WebKit/Source/platform/graphics/Color.h:29,
+                 from ../../third_party/WebKit/Source/platform/ColorSuggestion.h:34,
+                 from ../../third_party/WebKit/Source/platform/ColorChooserClient.h:34,
+                 from ../../third_party/WebKit/Source/platform/ColorChooserClient.cpp:32:
+../../third_party/WebKit/Source/wtf/SaturatedArithmetic.h: In function 'int32_t saturatedAddition(int32_t, int32_t)':
+../../third_party/WebKit/Source/wtf/SaturatedArithmetic.h:45:26: error: suggest parentheses around operand of '!' or change '&' to '&&' or '!' to '~' [-Werror=parentheses]
+     if (!((ua ^ ub) >> 31) & (result ^ ua) >> 31)
+
+Signed-off-by: Max Krummenacher <max.oss.09 at gmail.com>
+
+Upstream-Status: Pending
+Seems to be fixed in current chromium sources.
+---
+ third_party/WebKit/Source/wtf/SaturatedArithmetic.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/third_party/WebKit/Source/wtf/SaturatedArithmetic.h b/third_party/WebKit/Source/wtf/SaturatedArithmetic.h
+index 981276f..19c6157 100644
+--- a/third_party/WebKit/Source/wtf/SaturatedArithmetic.h
++++ b/third_party/WebKit/Source/wtf/SaturatedArithmetic.h
+@@ -42,7 +42,7 @@ ALWAYS_INLINE int32_t saturatedAddition(int32_t a, int32_t b)
+ 
+     // Can only overflow if the signed bit of the two values match. If the signed
+     // bit of the result and one of the values differ it did overflow.
+-    if (!((ua ^ ub) >> 31) & (result ^ ua) >> 31)
++    if ((!((ua ^ ub) >> 31)) & (result ^ ua) >> 31)
+         result = std::numeric_limits<int>::max() + (ua >> 31);
+ 
+     return result;
+-- 
+1.8.4.5
+
diff --git a/recipes-browser/chromium/cef3_280796.bb b/recipes-browser/chromium/cef3_280796.bb
index 939602b..c141b94 100644
--- a/recipes-browser/chromium/cef3_280796.bb
+++ b/recipes-browser/chromium/cef3_280796.bb
@@ -15,6 +15,10 @@ SRC_URI = "http://people.linaro.org/~zoltan.kuscsik/chromium-browser/chromium_re
            git://chromium.googlesource.com/chromium/tools/depot_tools.git;protocol=https;destsuffix=depot_tools;branch=master;name=tools \
            file://01_get_svn_version_from_LASTCHANGE.patch \
 	   file://cef-simple \
+	   file://0001-bignum.cc-disable-warning-from-gcc-5.patch \
+	   file://0002-image_util.cc-disable-warning-from-gcc-5.patch \
+	   file://0003-gtest-typed-test.h-disable-warning-unused-definition.patch \
+	   file://0004-SaturatedArithmetic.h-put-parentheses-to-silence-war.patch \
 	  "
 SRC_URI[md5sum] = "9efbb50283b731042e62b9bd5e312b2f"
 SRC_URI[sha256sum] = "f608e97dadf6ea4d885b24fd876896d46840fa39bf743ea2025075aee9fb348d"
-- 
1.8.4.5




More information about the Openembedded-devel mailing list