Skip to contentSkip to conversation

arm/gn: fix build with GCC <13

PATCH Applied [email protected] 2 participants 2 messages Jun 20, 2023 – Jun 21, 2023

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 arm/gn: fix build with GCC <13

From: Ross Burton <[email protected]>

The previous commit fixed the build of GN with GCC 13, but broke it for any other version.

Remove the patch and simply disable the fatal warning that causes the breakage. Interestingly, this warning is already disabled for Windows builds.

---
 ...Remove-redundant-move-in-return-stat.patch | 43 -------------------
 meta-arm/recipes-devtools/gn/gn_git.bb        |  7 ++-
 2 files changed, 6 insertions(+), 44 deletions(-)
 delete mode 100644 meta-arm/recipes-devtools/gn/gn/0001-desc_builder.cc-Remove-redundant-move-in-return-stat.patch
meta-arm/recipes-devtools/gn/gn/0001-desc_builder.cc-Remove-redundant-move-in-return-stat.patch deleted +0 -43
deleted file mode 100644
index f712037a..00000000
@@ -1,43 +0,0 @@
-From 45673f4f62eb063d6d5aa0ad68a6171936ad9347 Mon Sep 17 00:00:00 2001
-From: Khem Raj <[email protected]>
-Date: Tue, 24 Jan 2023 00:13:57 -0800
-Subject: [PATCH] desc_builder.cc: Remove redundant move in return statement
-
-Fixes build with gcc13
-
-../git/src/gn/desc_builder.cc: In member function 'base::Value {anonymous}::BaseDescBuilder::ToBaseValue(const Scope*)':
-../git/src/gn/desc_builder.cc:179:21: error: redundant move in return statement [-Werror=redundant-move]
-  179 |     return std::move(res);
-      |            ~~~~~~~~~^~~~~
-
-Upstream-Status: Submitted [https://gn-review.googlesource.com/c/gn/+/15000]
-Signed-off-by: Khem Raj <[email protected]>
----
- src/gn/desc_builder.cc | 4 ++--
- 1 file changed, 2 insertions(+), 2 deletions(-)
-
-diff --git a/src/gn/desc_builder.cc b/src/gn/desc_builder.cc
-index 444a5e02..3ef170c3 100644
---- a/src/gn/desc_builder.cc
-+++ b/src/gn/desc_builder.cc
-@@ -167,7 +167,7 @@ class BaseDescBuilder {
-     base::ListValue res;
-     for (const auto& v : vector)
-       res.GetList().emplace_back(ToBaseValue(v));
--    return std::move(res);
-+    return res;
-   }
- 
-   base::Value ToBaseValue(const Scope* scope) {
-@@ -176,7 +176,7 @@ class BaseDescBuilder {
-     scope->GetCurrentScopeValues(&map);
-     for (const auto& v : map)
-       res.SetKey(v.first, ToBaseValue(v.second));
--    return std::move(res);
-+    return res;
-   }
- 
-   base::Value ToBaseValue(const Value& val) {
--- 
-2.39.1
-
meta-arm/recipes-devtools/gn/gn_git.bb +6 -1
index 44a7f3a6..3713787a 100644
@@ -5,7 +5,6 @@ LICENSE = "BSD-3-Clause"
 LIC_FILES_CHKSUM = "file://LICENSE;md5=0fca02217a5d49a14dfe2d11837bb34d"
 
 SRC_URI = "git://gn.googlesource.com/gn;protocol=https;branch=main \
-           file://0001-desc_builder.cc-Remove-redundant-move-in-return-stat.patch \
            file://0001-Replace-lstat64-stat64-functions-on-linux.patch"
 SRCREV = "4bd1a77e67958fb7f6739bd4542641646f264e5d"
 PV = "0+git${SRCPV}"
@@ -13,6 +12,12 @@ PV = "0+git${SRCPV}"
 S = "${WORKDIR}/git"
 B = "${WORKDIR}/build"
 
+# Work around this fatal warning:
+# ../git/src/gn/desc_builder.cc: In member function 'base::Value {anonymous}::BaseDescBuilder::ToBaseValue(const Scope*)':
+# ../git/src/gn/desc_builder.cc:179:21: error: redundant move in return statement [-Werror=redundant-move]
+#   179 |     return std::move(res);
+CFLAGS:append = " -Wno-redundant-move"
+
 # Map from our _OS strings to the GN's platform values.
 def gn_platform(variable, d):
     os = d.getVar(variable)
Signature · 1 line
2.34.1
Applied
#1 lore raw
Quoted 6 lines · On Tue, 20 Jun 2023 15:01:37 +0100, [email protected] wrote:

The previous commit fixed the build of GN with GCC 13, but broke it for any other version.

Remove the patch and simply disable the fatal warning that causes the breakage. Interestingly, this warning is already disabled for Windows builds.

Applied, thanks!

[1/1] arm/gn: fix build with GCC <13

      commit: 533cbfd10b56cf4ed53c8fefc60095434544d450

Best regards,

Signature · 1 line
Jon Mason <[email protected]>