From patchwork Sun Mar 8 12:18:12 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Martin Jansa X-Patchwork-Id: 82799 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7D1AAEF5866 for ; Sun, 8 Mar 2026 12:18:22 +0000 (UTC) Received: from mail-wr1-f48.google.com (mail-wr1-f48.google.com [209.85.221.48]) by mx.groups.io with SMTP id smtpd.msgproc02-g2.36265.1772972297955044627 for ; Sun, 08 Mar 2026 05:18:18 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20230601 header.b=kOXgzs8m; spf=pass (domain: gmail.com, ip: 209.85.221.48, mailfrom: martin.jansa@gmail.com) Received: by mail-wr1-f48.google.com with SMTP id ffacd0b85a97d-439c4bde55cso3361876f8f.1 for ; Sun, 08 Mar 2026 05:18:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1772972296; x=1773577096; darn=lists.openembedded.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=fzcWPM3Toebi5C15wiTVsCXvptMvipVcqKCKSwRDVuc=; b=kOXgzs8mTRblE7UmUTNf+96GRGQEtA5Q/uVLCcqNQBS9nby5WnXOqpKTQNRkLSMP8s pkI3mX+CXe2wMymcp8DlY23ZkdKPbpbK4aLzMcZNkfiqgjEM8KRp5uy47jwfNinby/bB 3fiYXOlLtakGZ0ay2uHR5B6VJsiLW7VZQmt8dTKZSxqiuB9OrAsf2xve8s93xBnAZrtG pAkzWUAKAPAaG9zfT2qvMerhpDLZQOxQqEXyO94jnlXCc6SBSASQfD3zDKmpdplFnt8P f0pfpMZolyy5yqBzGXDJVVpoIZSFPUUx5IA6W7sco8eclFqv5G4qAg7t/8Kn4DYDWxdV 23Ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1772972296; x=1773577096; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=fzcWPM3Toebi5C15wiTVsCXvptMvipVcqKCKSwRDVuc=; b=xOtAYswSbPQyWPF8Papcy5+3z0+GyPwcvMMkmnezzFHBjJUsit0I7fztoesBAwT/UH bSk3VFUUgQPEDzpHp+ByhK2Go5cGT8eMqMyvZaJpY35g6CB2VQsPtDP/h1gqmzmZHzSL w/+35obnPIsX5n7Gk7p8qaInr1nyjuYKKFWUp6B4lcwrO2HPGIsKeQjPbv9vgcsII7hT 1OlRpFb7neJ7fYtd3G8YTScHQQ+UtQeaer0+4UXjN3vsowaa10QkM5vF0zK6xI4qZHOT kHf0RUiOgsWfKykeWL4FhW/01Nia90dxvo097Be+8/cn6LIWO2V0zuB74wICm/kjQBgb z0bA== X-Gm-Message-State: AOJu0YymHn0iucSZHMoLZkRp3mDCiwrPr7YS7mSiHo1wJ+Ml18+Z0ARc MykuBVI6tw9BkK7SU5+3R38mDt7UUqk8IssBWZ0yfCli3OtI2PxyEgne5NiRkDiy X-Gm-Gg: ATEYQzxSvGj7iogQuoP74J2aOdvc8KrrLu9HtJ7DYgd6wW2aj7H0VAC2pjfvYt+pHul aEkDeI67viou1kAs7GOsPL9h5Vt2YfaeZxDIhSqANqkh1LPI5vUabhfroJtaqFkjif6TRQs3kJV +81WrNl/V1h1jn6pc8ZqgxLKwyeGsk2XH+cYBuJA42eY+DwCzSPlt0ZuO/VhC6YhWy4UJLYP2Vd 26Z60oejeZQ0Z08R8z7ki5wnDXl4iu/AoBk9x1pdK93PH6oLcekVzlaYsrU1ZlljOQoB+/1Jsor k7+9Y6Skj1oHKv/MkOv6FwI3MHJ9qj+mWEkcDFH2O7HNqaq3rIFfjv19HPIAbaJKGJLnq8/dbrg 7IyrOdG3vqJPHo3Q2ha+KLvqcm4ny/QL+oe1vcDoGp+erVcRDcMwFyXUKklSalw9cFu91U3RGXV EllbB5TeCZjHmxugnGWSihJEgzDQ== X-Received: by 2002:a05:6000:2905:b0:439:8eef:11f8 with SMTP id ffacd0b85a97d-439da35fb3bmr13267910f8f.36.1772972295952; Sun, 08 Mar 2026 05:18:15 -0700 (PDT) Received: from localhost ([109.238.218.228]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-439dae2b9ccsm17133130f8f.19.2026.03.08.05.18.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 Mar 2026 05:18:15 -0700 (PDT) From: martin.jansa@gmail.com To: openembedded-core@lists.openembedded.org Cc: Martin Jansa Subject: [PATCH] gcc: backport a fix for building with gcc-16 Date: Sun, 8 Mar 2026 13:18:12 +0100 Message-ID: <20260308121812.2364685-1-martin.jansa@gmail.com> X-Mailer: git-send-email 2.53.0 MIME-Version: 1.0 List-Id: X-Webhook-Received: from 45-33-107-173.ip.linodeusercontent.com [45.33.107.173] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Sun, 08 Mar 2026 12:18:22 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/232642 From: Martin Jansa Fixes: https://errors.yoctoproject.org/Errors/Details/905192/ when building on host with gcc-16 Signed-off-by: Martin Jansa --- meta/recipes-devtools/gcc/gcc-15.2.inc | 1 + ...dy-Make-it-buildable-by-C-11-to-C-26.patch | 257 ++++++++++++++++++ 2 files changed, 258 insertions(+) create mode 100644 meta/recipes-devtools/gcc/gcc/0028-libcody-Make-it-buildable-by-C-11-to-C-26.patch diff --git a/meta/recipes-devtools/gcc/gcc-15.2.inc b/meta/recipes-devtools/gcc/gcc-15.2.inc index b02cc4fcb9..d04d404cc5 100644 --- a/meta/recipes-devtools/gcc/gcc-15.2.inc +++ b/meta/recipes-devtools/gcc/gcc-15.2.inc @@ -74,6 +74,7 @@ SRC_URI = "${BASEURI} \ file://0025-gcc-testsuite-tweaks-for-mips-OE.patch \ file://0026-fix-pr90579-testcases.patch \ file://0027-gcc15-pr122394.patch \ + file://0028-libcody-Make-it-buildable-by-C-11-to-C-26.patch \ file://0001-mapper-localhost-might-not-be-known.patch \ " diff --git a/meta/recipes-devtools/gcc/gcc/0028-libcody-Make-it-buildable-by-C-11-to-C-26.patch b/meta/recipes-devtools/gcc/gcc/0028-libcody-Make-it-buildable-by-C-11-to-C-26.patch new file mode 100644 index 0000000000..431facb011 --- /dev/null +++ b/meta/recipes-devtools/gcc/gcc/0028-libcody-Make-it-buildable-by-C-11-to-C-26.patch @@ -0,0 +1,257 @@ +From 0ffe3c9af4e5d5468df742512b6e930fe7039230 Mon Sep 17 00:00:00 2001 +From: Jakub Jelinek +Date: Fri, 21 Nov 2025 16:25:58 +0100 +Subject: [PATCH] libcody: Make it buildable by C++11 to C++26 + +The following builds with -std=c++11 and c++14 and c++17 and c++20 and c++23 +and c++26. + +I see the u8 string literals are mixed e.g. with strerror, so in +-fexec-charset=IBM1047 there will still be garbage, so am not 100% sure if +the u8 literals everywhere are worth it either. + +2025-11-21 Jakub Jelinek + + * cody.hh (S2C): For __cpp_char8_t >= 201811 use char8_t instead of + char in argument type. + (MessageBuffer::Space): Revert 2025-11-15 change. + (MessageBuffer::Append): For __cpp_char8_t >= 201811 add overload + with char8_t const * type of first argument. + (Packet::Packet): Similarly for first argument. + * client.cc (CommunicationError, Client::ProcessResponse, + Client::Connect, ConnectResponse, PathnameResponse, OKResponse, + IncludeTranslateResponse): Cast u8 string literals to (const char *) + where needed. + * server.cc (Server::ProcessRequests, ConnectRequest): Likewise. + +Signed-off-by: Martin Jansa +Upstream-Status: Backport [07a767c7a50d1daae8ef7d4aba73fe53ad40c0b7] +--- + libcody/client.cc | 36 +++++++++++++++++++----------------- + libcody/cody.hh | 22 ++++++++++++++++++++++ + libcody/server.cc | 28 ++++++++++++++-------------- + 3 files changed, 55 insertions(+), 31 deletions(-) + +diff --git a/libcody/client.cc b/libcody/client.cc +index ae69d190cb77..147fecdbe500 100644 +--- a/libcody/client.cc ++++ b/libcody/client.cc +@@ -97,7 +97,7 @@ int Client::CommunicateWithServer () + + static Packet CommunicationError (int err) + { +- std::string e {u8"communication error:"}; ++ std::string e {(const char *) u8"communication error:"}; + e.append (strerror (err)); + + return Packet (Client::PC_ERROR, std::move (e)); +@@ -110,33 +110,34 @@ Packet Client::ProcessResponse (std::vector &words, + { + if (e == EINVAL) + { +- std::string msg (u8"malformed string '"); ++ std::string msg ((const char *) u8"malformed string '"); + msg.append (words[0]); +- msg.append (u8"'"); ++ msg.append ((const char *) u8"'"); + return Packet (Client::PC_ERROR, std::move (msg)); + } + else +- return Packet (Client::PC_ERROR, u8"missing response"); ++ return Packet (Client::PC_ERROR, (const char *) u8"missing response"); + } + + Assert (!words.empty ()); +- if (words[0] == u8"ERROR") ++ if (words[0] == (const char *) u8"ERROR") + return Packet (Client::PC_ERROR, +- words.size () == 2 ? words[1]: u8"malformed error response"); ++ words.size () == 2 ? words[1] ++ : (const char *) u8"malformed error response"); + + if (isLast && !read.IsAtEnd ()) + return Packet (Client::PC_ERROR, +- std::string (u8"unexpected extra response")); ++ std::string ((const char *) u8"unexpected extra response")); + + Assert (code < Detail::RC_HWM); + Packet result (responseTable[code] (words)); + result.SetRequest (code); + if (result.GetCode () == Client::PC_ERROR && result.GetString ().empty ()) + { +- std::string msg {u8"malformed response '"}; ++ std::string msg {(const char *) u8"malformed response '"}; + + read.LexedLine (msg); +- msg.append (u8"'"); ++ msg.append ((const char *) u8"'"); + result.GetString () = std::move (msg); + } + else if (result.GetCode () == Client::PC_CONNECT) +@@ -199,7 +200,7 @@ Packet Client::Connect (char const *agent, char const *ident, + size_t alen, size_t ilen) + { + write.BeginLine (); +- write.AppendWord (u8"HELLO"); ++ write.AppendWord ((const char *) u8"HELLO"); + write.AppendInteger (Version); + write.AppendWord (agent, true, alen); + write.AppendWord (ident, true, ilen); +@@ -211,7 +212,8 @@ Packet Client::Connect (char const *agent, char const *ident, + // HELLO $version $agent [$flags] + Packet ConnectResponse (std::vector &words) + { +- if (words[0] == u8"HELLO" && (words.size () == 3 || words.size () == 4)) ++ if (words[0] == (const char *) u8"HELLO" ++ && (words.size () == 3 || words.size () == 4)) + { + char *eptr; + unsigned long val = strtoul (words[1].c_str (), &eptr, 10); +@@ -247,7 +249,7 @@ Packet Client::ModuleRepo () + // PATHNAME $dir | ERROR + Packet PathnameResponse (std::vector &words) + { +- if (words[0] == u8"PATHNAME" && words.size () == 2) ++ if (words[0] == (const char *) u8"PATHNAME" && words.size () == 2) + return Packet (Client::PC_PATHNAME, std::move (words[1])); + + return Packet (Client::PC_ERROR, u8""); +@@ -256,7 +258,7 @@ Packet PathnameResponse (std::vector &words) + // OK or ERROR + Packet OKResponse (std::vector &words) + { +- if (words[0] == u8"OK") ++ if (words[0] == (const char *) u8"OK") + return Packet (Client::PC_OK); + else + return Packet (Client::PC_ERROR, +@@ -319,11 +321,11 @@ Packet Client::IncludeTranslate (char const *include, Flags flags, size_t ilen) + // PATHNAME $cmifile + Packet IncludeTranslateResponse (std::vector &words) + { +- if (words[0] == u8"BOOL" && words.size () == 2) ++ if (words[0] == (const char *) u8"BOOL" && words.size () == 2) + { +- if (words[1] == u8"FALSE") +- return Packet (Client::PC_BOOL, 0); +- else if (words[1] == u8"TRUE") ++ if (words[1] == (const char *) u8"FALSE") ++ return Packet (Client::PC_BOOL); ++ else if (words[1] == (const char *) u8"TRUE") + return Packet (Client::PC_BOOL, 1); + else + return Packet (Client::PC_ERROR, u8""); +diff --git a/libcody/cody.hh b/libcody/cody.hh +index 789ce9e70b75..93bce93aa94d 100644 +--- a/libcody/cody.hh ++++ b/libcody/cody.hh +@@ -47,12 +47,21 @@ namespace Detail { + + // C++11 doesn't have utf8 character literals :( + ++#if __cpp_char8_t >= 201811 ++template ++constexpr char S2C (char8_t const (&s)[I]) ++{ ++ static_assert (I == 2, "only single octet strings may be converted"); ++ return s[0]; ++} ++#else + template + constexpr char S2C (char const (&s)[I]) + { + static_assert (I == 2, "only single octet strings may be converted"); + return s[0]; + } ++#endif + + /// Internal buffering class. Used to concatenate outgoing messages + /// and Lex incoming ones. +@@ -123,6 +132,13 @@ public: + Space (); + Append (str, maybe_quote, len); + } ++#if __cpp_char8_t >= 201811 ++ void AppendWord (char8_t const *str, bool maybe_quote = false, ++ size_t len = ~size_t (0)) ++ { ++ AppendWord ((const char *) str, maybe_quote, len); ++ } ++#endif + /// Add a word as with AppendWord + /// @param str the string to append + /// @param maybe_quote string might need quoting, as for Append +@@ -264,6 +280,12 @@ public: + : string (s), cat (STRING), code (c) + { + } ++#if __cpp_char8_t >= 201811 ++ Packet (unsigned c, const char8_t *s) ++ : string ((const char *) s), cat (STRING), code (c) ++ { ++ } ++#endif + Packet (unsigned c, std::vector &&v) + : vector (std::move (v)), cat (VECTOR), code (c) + { +diff --git a/libcody/server.cc b/libcody/server.cc +index e2fa069bb933..c18469fae843 100644 +--- a/libcody/server.cc ++++ b/libcody/server.cc +@@ -36,12 +36,12 @@ static RequestPair + const requestTable[Detail::RC_HWM] = + { + // Same order as enum RequestCode +- RequestPair {u8"HELLO", nullptr}, +- RequestPair {u8"MODULE-REPO", ModuleRepoRequest}, +- RequestPair {u8"MODULE-EXPORT", ModuleExportRequest}, +- RequestPair {u8"MODULE-IMPORT", ModuleImportRequest}, +- RequestPair {u8"MODULE-COMPILED", ModuleCompiledRequest}, +- RequestPair {u8"INCLUDE-TRANSLATE", IncludeTranslateRequest}, ++ RequestPair {(const char *) u8"HELLO", nullptr}, ++ RequestPair {(const char *) u8"MODULE-REPO", ModuleRepoRequest}, ++ RequestPair {(const char *) u8"MODULE-EXPORT", ModuleExportRequest}, ++ RequestPair {(const char *) u8"MODULE-IMPORT", ModuleImportRequest}, ++ RequestPair {(const char *) u8"MODULE-COMPILED", ModuleCompiledRequest}, ++ RequestPair {(const char *) u8"INCLUDE-TRANSLATE", IncludeTranslateRequest}, + }; + } + +@@ -135,21 +135,21 @@ void Server::ProcessRequests (void) + std::string msg; + + if (err > 0) +- msg = u8"error processing '"; ++ msg = (const char *) u8"error processing '"; + else if (ix >= Detail::RC_HWM) +- msg = u8"unrecognized '"; ++ msg = (const char *) u8"unrecognized '"; + else if (IsConnected () && ix == Detail::RC_CONNECT) +- msg = u8"already connected '"; ++ msg = (const char *) u8"already connected '"; + else if (!IsConnected () && ix != Detail::RC_CONNECT) +- msg = u8"not connected '"; ++ msg = (const char *) u8"not connected '"; + else +- msg = u8"malformed '"; ++ msg = (const char *) u8"malformed '"; + + read.LexedLine (msg); +- msg.append (u8"'"); ++ msg.append ((const char *) u8"'"); + if (err > 0) + { +- msg.append (u8" "); ++ msg.append ((const char *) u8" "); + msg.append (strerror (err)); + } + resolver->ErrorResponse (this, std::move (msg)); +@@ -176,7 +176,7 @@ Resolver *ConnectRequest (Server *s, Resolver *r, + return nullptr; + + if (words.size () == 3) +- words.emplace_back (u8""); ++ words.emplace_back ((const char *) u8""); + unsigned version = ParseUnsigned (words[1]); + if (version == ~0u) + return nullptr;