From nobody Sun Nov 17 18:46:22 2024 X-Original-To: dev-commits-ports-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Xs08b05LWz5dG5G; Sun, 17 Nov 2024 18:46:23 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Xs08Z6dHHz4rr4; Sun, 17 Nov 2024 18:46:22 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731869182; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=31h3ypMhvNHnwkKxn/QrOm91PbA7V4KRwiigdWjFf2g=; b=uPta/YDz8TtltOamiyI+1WQ+GuxCUYyMqW1SCVXFdTHH891bwoguF80h/f8TOB3Y2B3r1z KTftPYnRnzKdudk8jrHcRalq5cezOOFZy7nkK6/3aXSQmnIIJSDvZfm6YNkfK3z5q/S4zV r8JU5nDgJYQHrtX0DmkpnZ5+Cc5CVSwEp2zTXpUzuMR/57Nk7cmrwMWFhilIxE0O6XpoYP oNopSXxX+uw3UzKGR4agOr+yxE/IL7/NfWAp/ePU6LMYp4uHfrMk/+4CrPMesVPZJaR6dm cwCBwvCaq/zUXPs7WAqoLadWr3m3mu7IQY6XrQ6FKw73A6KJbQBxnK7a5hcnYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1731869182; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=31h3ypMhvNHnwkKxn/QrOm91PbA7V4KRwiigdWjFf2g=; b=s3E5iMRkH1NfiplJAloaYJ6BtWMFyynopqXAkpD7o7VY2mEehjyIKXXYOuDiNnkjXWRXQX J6SMPWLMTxFKzs3hlefFYPsYiM4J0LSw79Ndy3fhONXl0CR5/wW7pKnSiv3OeJoZpGXQLW dHJ0ybsU2HnclsptsdBJfUD/AK8C/R150APji3q5fD2b6nbvHspl0fwlYsSMpocIUqhCFX /2R+PvWGV5at7GA6lAQ6ImP30Kt9k4S+umhbtg7mLn5TMCaxzTVaJcNTOa2kb8FOG5Aks8 jr8zx/fVF0fpStl8GSneTgDqlFHyTkB/0fX3QLeHVakgRTFXNPL2RM+gxeYwnw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1731869182; a=rsa-sha256; cv=none; b=RDYw869WbDnu1mEvxy45NhLyrMOeUc2TvgugQ98s8J+Nod/QgiESkhhri+e4N4K/4ARHis yNkctE+07pETvaw9fas+lE2+fr7iC4KvJTSY05BcOQQoIJaevB3+uGYZ/aZnsmNqtcgb/f DRmjsLsE5Y1MrZouMMY9uJ6yKnmu26jiIoAf/0ki0uoNXDaeFV2zPWJuRa+4oefjpGl2Bg QNYXSt1o+j3OQCC9aCLVb++gkpJUIE/0JAHgSp4cdujT3mDIHlt3WYZImQ9G1LQvvPBcEQ dwj52gFGGMVIOxKLygRS1wTz4socom6ohA7jG2Kz6sS0gZOzlzXv58ek3phY3w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Xs08Z6DkPz13jX; Sun, 17 Nov 2024 18:46:22 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4AHIkMxC054134; Sun, 17 Nov 2024 18:46:22 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4AHIkMmj054131; Sun, 17 Nov 2024 18:46:22 GMT (envelope-from git) Date: Sun, 17 Nov 2024 18:46:22 GMT Message-Id: <202411171846.4AHIkMmj054131@gitrepo.freebsd.org> To: ports-committers@FreeBSD.org, dev-commits-ports-all@FreeBSD.org, dev-commits-ports-branches@FreeBSD.org From: Dimitry Andric Subject: git: e821fb45708a - 2024Q4 - cad/kicad-devel: fix build with libc++ 19 List-Id: Commits to the quarterly branches of the FreeBSD ports repository List-Archive: https://lists.freebsd.org/archives/dev-commits-ports-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-ports-branches@freebsd.org Sender: owner-dev-commits-ports-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: ports X-Git-Refname: refs/heads/2024Q4 X-Git-Reftype: branch X-Git-Commit: e821fb45708aa81597a11a5b8ccc744ae55168de Auto-Submitted: auto-generated The branch 2024Q4 has been updated by dim: URL: https://cgit.FreeBSD.org/ports/commit/?id=e821fb45708aa81597a11a5b8ccc744ae55168de commit e821fb45708aa81597a11a5b8ccc744ae55168de Author: Dimitry Andric AuthorDate: 2024-11-03 10:57:05 +0000 Commit: Dimitry Andric CommitDate: 2024-11-17 18:46:11 +0000 cad/kicad-devel: fix build with libc++ 19 As noted in the libc++ 19 release notes [1], std::char_traits<> is now only provided for char, char8_t, char16_t, char32_t and wchar_t, and any instantiation for other types will fail. This causes cad/kicad-devel to fail to compile with clang 19 and libc++ 19, resulting in errors similar to: /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:261:25: error: implicit instantiation of undefined template 'std::char_traits' 261 | auto const n = std::char_traits::length(array); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3576:52: error: implicit instantiation of undefined template 'std::char_traits' 3576 | dsn.name = string(&name[0], &name[std::char_traits::length(name)]); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3578:49: error: implicit instantiation of undefined template 'std::char_traits' 3578 | string(&driver[0], &driver[std::char_traits::length(driver)]); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3629:54: error: implicit instantiation of undefined template 'std::char_traits' 3629 | drv.name = string(&descr[0], &descr[std::char_traits::length(descr)]); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ and: /usr/include/c++/v1/string:820:42: error: implicit instantiation of undefined template 'std::char_traits' 820 | static_assert(is_same<_CharT, typename traits_type::char_type>::value, | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/compoundfilereader/compoundfilereader.h:226:21: note: in instantiation of template class 'std::basic_string' requested here 226 | utf16string dir; | ^ /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here 23 | struct _LIBCPP_TEMPLATE_VIS char_traits; | ^ and: /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:3604:22: error: implicit instantiation of undefined template 'std::char_traits' 3604 | struct char_traits : std::char_traits | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:6289:14: note: in instantiation of template class 'nlohmann::detail::char_traits' requested here 6289 | typename char_traits::int_type get_character() | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:6465:22: note: in instantiation of template class 'nlohmann::detail::iterator_input_adapter' requested here 6465 | BaseInputAdapter base_adapter; | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/thirdparty/nlohmann_json/nlohmann/json.hpp:23323:16: note: in instantiation of template class 'nlohmann::detail::wide_string_input_adapter, wxUniChar>' requested here 23323 | parser(detail::input_adapter(std::forward(i)), cb, allow_exceptions, ignore_comments).parse(true, result); | ^ /wrkdirs/usr/ports/cad/kicad-devel/work/kicad-6ebd8f46fe24533214b9ed43f1f7e5a4b80dcc71/eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp:209:53: note: in instantiation of function template specialization 'nlohmann::basic_json<>::parse' requested here 209 | nlohmann::json js = nlohmann::json::parse( txt.ReadLine() ); | ^ /usr/include/c++/v1/__string/char_traits.h:45:8: note: template is declared here 45 | struct char_traits; | ^ The first batch of errors can be fixed by providing a simple `length()` function for the `NANODBC_SQLCHAR const*` type. The second batch can be fixed by using `std::basic_string` for `utf16string`, and adjusting the call to `std::basic_string::append`. The third batch can be fixed by adding a `char_traits` definition specifically for the `wxUniChar` type. [1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals PR: 282512 Approved by: maintainer timeout (2 weeks) MFH: 2024Q4 (cherry picked from commit 1b22fed46cec0d16c24ead535ebfe329981f9a20) --- ...hema_sch__io_easyedapro_sch__io__easyedapro.cpp | 34 +++++++++++++++++ ...rdparty_compoundfilereader_compoundfilereader.h | 20 ++++++++++ .../patch-thirdparty_nanodbc_nanodbc_nanodbc.cpp | 44 ++++++++++++++++++++++ 3 files changed, 98 insertions(+) diff --git a/cad/kicad-devel/files/patch-eeschema_sch__io_easyedapro_sch__io__easyedapro.cpp b/cad/kicad-devel/files/patch-eeschema_sch__io_easyedapro_sch__io__easyedapro.cpp new file mode 100644 index 000000000000..02c96710df87 --- /dev/null +++ b/cad/kicad-devel/files/patch-eeschema_sch__io_easyedapro_sch__io__easyedapro.cpp @@ -0,0 +1,34 @@ +--- eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp.orig 2024-10-11 09:03:05 UTC ++++ eeschema/sch_io/easyedapro/sch_io_easyedapro.cpp +@@ -105,6 +105,31 @@ int SCH_IO_EASYEDAPRO::GetModifyHash() const + } + + ++// Explicitly define char traits for wxUniChar since it is not standard ++template<> ++struct nlohmann::detail::char_traits : std::char_traits ++{ ++ using char_type = wxUniChar; ++ using int_type = uint32_t; ++ ++ // Redefine to_int_type function ++ static int_type to_int_type(char_type c) noexcept ++ { ++ return static_cast(c); ++ } ++ ++ static char_type to_char_type(int_type i) noexcept ++ { ++ return static_cast(i); ++ } ++ ++ static constexpr int_type eof() noexcept ++ { ++ return ~0U; ++ } ++}; ++ ++ + static LIB_SYMBOL* loadSymbol( nlohmann::json project, const wxString& aLibraryPath, + const wxString& aAliasName, const std::map* aProperties ) + { diff --git a/cad/kicad-devel/files/patch-thirdparty_compoundfilereader_compoundfilereader.h b/cad/kicad-devel/files/patch-thirdparty_compoundfilereader_compoundfilereader.h new file mode 100644 index 000000000000..be30bfbdd7da --- /dev/null +++ b/cad/kicad-devel/files/patch-thirdparty_compoundfilereader_compoundfilereader.h @@ -0,0 +1,20 @@ +--- thirdparty/compoundfilereader/compoundfilereader.h.orig 2024-10-11 09:03:05 UTC ++++ thirdparty/compoundfilereader/compoundfilereader.h +@@ -131,7 +131,7 @@ struct helper + } + }; + +-typedef std::basic_string utf16string; ++typedef std::basic_string utf16string; + typedef std::function + EnumFilesCallback; + +@@ -249,7 +249,7 @@ class CompoundFileReader (private) + utf16string newDir = dir; + if (dir.length() != 0) + newDir.append(1, '\n'); +- newDir.append(entry->name, entry->nameLen / 2); ++ newDir.append(reinterpret_cast(entry->name), entry->nameLen / 2); + EnumNodes(GetEntry(entry->childID), currentLevel + 1, maxLevel, newDir, callback); + } + diff --git a/cad/kicad-devel/files/patch-thirdparty_nanodbc_nanodbc_nanodbc.cpp b/cad/kicad-devel/files/patch-thirdparty_nanodbc_nanodbc_nanodbc.cpp new file mode 100644 index 000000000000..6cfdd8b1abbc --- /dev/null +++ b/cad/kicad-devel/files/patch-thirdparty_nanodbc_nanodbc_nanodbc.cpp @@ -0,0 +1,44 @@ +--- thirdparty/nanodbc/nanodbc/nanodbc.cpp.orig 2024-10-11 09:03:05 UTC ++++ thirdparty/nanodbc/nanodbc/nanodbc.cpp +@@ -255,10 +255,19 @@ constexpr std::size_t size(const T (&array)[N]) noexce + } + #endif + ++inline std::size_t length(NANODBC_SQLCHAR const* s) ++{ ++ std::size_t len = 0; ++ for (; *s != 0; ++s) ++ ++len; ++ return len; ++ ++} ++ + template + inline std::size_t size(NANODBC_SQLCHAR const (&array)[N]) noexcept + { +- auto const n = std::char_traits::length(array); ++ auto const n = length(array); + NANODBC_ASSERT(n < N); + return n < N ? n : N - 1; + } +@@ -3589,9 +3598,9 @@ std::list list_datasources() + "incompatible SQLCHAR and string::value_type"); + + datasource dsn; +- dsn.name = string(&name[0], &name[std::char_traits::length(name)]); ++ dsn.name = string(&name[0], &name[length(name)]); + dsn.driver = +- string(&driver[0], &driver[std::char_traits::length(driver)]); ++ string(&driver[0], &driver[length(driver)]); + + dsns.push_back(std::move(dsn)); + direction = SQL_FETCH_NEXT; +@@ -3642,7 +3651,7 @@ std::list list_drivers() + "incompatible SQLCHAR and string::value_type"); + + driver drv; +- drv.name = string(&descr[0], &descr[std::char_traits::length(descr)]); ++ drv.name = string(&descr[0], &descr[length(descr)]); + + // Split "Key1=Value1\0Key2=Value2\0\0" into list of key-value pairs + auto beg = &attrs[0];