From 7114e2fba18abd42f9ef52bee5e59546f6878d6b Mon Sep 17 00:00:00 2001 From: Martin Jansa Date: Thu, 11 Jul 2024 13:03:59 +0200 Subject: [PATCH] flatbuffers: fix native build with gcc-14 on host In C++ we cannot have both assignment operator and const member. Since span::operator= is defined, span::count_ constness must be removed. Fixes: FAILED: CMakeFiles/flatc.dir/src/util.cpp.o ccache flatbuffers/2.0.0/recipe-sysroot-native/usr/bin/aarch64-webos-linux/aarch64-webos-linux-g++ --sysroot=flatbuffers/2.0.0/recipe-sysroot -DFLATBUFFERS_LOCALE_INDEPENDENT=1 -Iflatbuffers/2.0.0/git/include -Iflatbuffers/2.0.0/git/grpc -mbranch-protection=standard -fstack-protector-strong -O2 -D_FORTIFY_SOURCE=2 -Wformat -Wformat-security -Werror=format-security -Werror=return-type -funwind-tables --sysroot=flatbuffers/2.0.0/recipe-sysroot -O2 -pipe -g -feliminate-unused-debug-types -fcanon-prefix-map -fmacro-prefix-map=flatbuffers/2.0.0/git=/usr/src/debug/flatbuffers/2.0.0 -fdebug-prefix-map=flatbuffers/2.0.0/git=/usr/src/debug/flatbuffers/2.0.0 -fmacro-prefix-map=flatbuffers/2.0.0/build=/usr/src/debug/flatbuffers/2.0.0 -fdebug-prefix-map=flatbuffers/2.0.0/build=/usr/src/debug/flatbuffers/2.0.0 -fdebug-prefix-map=flatbuffers/2.0.0/recipe-sysroot= -fmacro-prefix-map=flatbuffers/2.0.0/recipe-sysroot= -fdebug-prefix-map=flatbuffers/2.0.0/recipe-sysroot-native= -fvisibility-inlines-hidden -fPIC -DNDEBUG -MD -MT CMakeFiles/flatc.dir/src/util.cpp.o -MF CMakeFiles/flatc.dir/src/util.cpp.o.d -o CMakeFiles/flatc.dir/src/util.cpp.o -c flatbuffers/2.0.0/git/src/util.cpp In file included from ../git/include/flatbuffers/util.h:23, from ../git/src/util.cpp:44: ../git/include/flatbuffers/stl_emulation.h: In member function 'constexpr flatbuffers::span& flatbuffers::span::operator=(const flatbuffers::span&)': ../git/include/flatbuffers/stl_emulation.h:549:12: error: assignment of read-only member 'flatbuffers::span::count_' 549 | count_ = other.count_; | ~~~~~~~^~~~~~~~~~~~~~ Signed-off-by: Martin Jansa Signed-off-by: Armin Kuster --- ...span-count_-is-not-const-anymore-722.patch | 27 +++++++++++++++++++ .../flatbuffers/flatbuffers_2.0.0.bb | 4 ++- 2 files changed, 30 insertions(+), 1 deletion(-) create mode 100644 meta-oe/recipes-devtools/flatbuffers/flatbuffers/0001-C-stl_emulation-span-count_-is-not-const-anymore-722.patch diff --git a/meta-oe/recipes-devtools/flatbuffers/flatbuffers/0001-C-stl_emulation-span-count_-is-not-const-anymore-722.patch b/meta-oe/recipes-devtools/flatbuffers/flatbuffers/0001-C-stl_emulation-span-count_-is-not-const-anymore-722.patch new file mode 100644 index 0000000000..0a48c665b5 --- /dev/null +++ b/meta-oe/recipes-devtools/flatbuffers/flatbuffers/0001-C-stl_emulation-span-count_-is-not-const-anymore-722.patch @@ -0,0 +1,27 @@ +From 659def02b6432b62220ed41d7c137dcfd9dfe024 Mon Sep 17 00:00:00 2001 +From: avaliente-bc <56400759+avaliente-bc@users.noreply.github.com> +Date: Wed, 6 Apr 2022 21:27:37 +0200 +Subject: [PATCH] [C++] stl_emulation span::count_ is not const anymore (#7226) + (#7227) + +In C++ we cannot have both assignment operator and const member. Since +span::operator= is defined, span::count_ constness must be removed. +--- +Upstream-Status: Backport [https://github.com/google/flatbuffers/commit/20aad0c41e1252b04c72111c3eb221280a9c2009] + + include/flatbuffers/stl_emulation.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/include/flatbuffers/stl_emulation.h b/include/flatbuffers/stl_emulation.h +index 44e9ccbfa..cac87db65 100644 +--- a/include/flatbuffers/stl_emulation.h ++++ b/include/flatbuffers/stl_emulation.h +@@ -629,7 +629,7 @@ class span FLATBUFFERS_FINAL_CLASS { + private: + // This is a naive implementation with 'count_' member even if (Extent != dynamic_extent). + pointer const data_; +- const size_type count_; ++ size_type count_; + }; + + #if !defined(FLATBUFFERS_SPAN_MINIMAL) diff --git a/meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb b/meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb index 44478ea0b2..1ffb28a198 100644 --- a/meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb +++ b/meta-oe/recipes-devtools/flatbuffers/flatbuffers_2.0.0.bb @@ -14,7 +14,9 @@ RDEPENDS:${PN}-dev += "${PN}-compiler" LIC_FILES_CHKSUM = "file://LICENSE.txt;md5=3b83ef96387f14655fc854ddc3c6bd57" SRCREV = "a9a295fecf3fbd5a4f571f53b01f63202a3e2113" -SRC_URI = "git://github.com/google/flatbuffers.git;branch=master;protocol=https" +SRC_URI = "git://github.com/google/flatbuffers.git;branch=master;protocol=https \ + file://0001-C-stl_emulation-span-count_-is-not-const-anymore-722.patch \ +" S = "${WORKDIR}/git" CVE_CHECK_IGNORE += "CVE-2020-35864"