FreeBSD Bugzilla – Attachment 254038 Details for
Bug 281886
cad/kicad: fix build with libc++ 19
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
cad/kicad: fix build with libc++ 19
cad__kicad-fix-libcxx19-build-1.diff (text/plain), 6.65 KB, created by
Dimitry Andric
on 2024-10-06 08:59:10 UTC
(
hide
)
Description:
cad/kicad: fix build with libc++ 19
Filename:
MIME Type:
Creator:
Dimitry Andric
Created:
2024-10-06 08:59:10 UTC
Size:
6.65 KB
patch
obsolete
>commit 73a2ea82b2337ffb30a8ab769a8985fb663211d7 >Author: Dimitry Andric <dim@FreeBSD.org> >Date: 2024-10-06T10:58:28+02:00 > > cad/kicad: 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 to fail to compile with clang 19 and libc++ 19, > resulting in errors similar to: > > /wrkdirs/usr/ports/cad/kicad/work/kicad-7.0.2/thirdparty/nanodbc/nanodbc/nanodbc.cpp:261:25: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' > 261 | auto const n = std::char_traits<NANODBC_SQLCHAR>::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/work/kicad-7.0.2/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3576:52: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' > 3576 | dsn.name = string(&name[0], &name[std::char_traits<NANODBC_SQLCHAR>::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/work/kicad-7.0.2/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3578:49: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' > 3578 | string(&driver[0], &driver[std::char_traits<NANODBC_SQLCHAR>::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/work/kicad-7.0.2/thirdparty/nanodbc/nanodbc/nanodbc.cpp:3629:54: error: implicit instantiation of undefined template 'std::char_traits<unsigned short>' > 3629 | drv.name = string(&descr[0], &descr[std::char_traits<NANODBC_SQLCHAR>::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<unsigned short>' > 820 | static_assert(is_same<_CharT, typename traits_type::char_type>::value, > | ^ > /wrkdirs/usr/ports/cad/kicad/work/kicad-7.0.2/thirdparty/compoundfilereader/compoundfilereader.h:226:21: note: in instantiation of template class 'std::basic_string<unsigned short>' 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; > | ^ > > 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<char16_t>` for `utf16string`, and > adjusting the call to `std::basic_string<char16_t>::append`. > > [1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals > > PR: 281886 > MFH: 2024Q3 > >diff --git a/cad/kicad/files/patch-thirdparty_compoundfilereader_compoundfilereader.h b/cad/kicad/files/patch-thirdparty_compoundfilereader_compoundfilereader.h >new file mode 100644 >index 000000000000..e076a7d505d2 >--- /dev/null >+++ b/cad/kicad/files/patch-thirdparty_compoundfilereader_compoundfilereader.h >@@ -0,0 +1,20 @@ >+--- thirdparty/compoundfilereader/compoundfilereader.h.orig 2023-04-13 20:27:39 UTC >++++ thirdparty/compoundfilereader/compoundfilereader.h >+@@ -129,7 +129,7 @@ struct helper >+ } >+ }; >+ >+-typedef std::basic_string<uint16_t> utf16string; >++typedef std::basic_string<char16_t> utf16string; >+ typedef std::function<void(const COMPOUND_FILE_ENTRY*, const utf16string& dir, int level)> >+ EnumFilesCallback; >+ >+@@ -246,7 +246,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<const char16_t*>(entry->name), entry->nameLen / 2); >+ EnumNodes(GetEntry(entry->childID), currentLevel + 1, maxLevel, newDir, callback); >+ } >+ >diff --git a/cad/kicad/files/patch-thirdparty_nanodbc_nanodbc_nanodbc.cpp b/cad/kicad/files/patch-thirdparty_nanodbc_nanodbc_nanodbc.cpp >new file mode 100644 >index 000000000000..685a94fc55c7 >--- /dev/null >+++ b/cad/kicad/files/patch-thirdparty_nanodbc_nanodbc_nanodbc.cpp >@@ -0,0 +1,44 @@ >+--- thirdparty/nanodbc/nanodbc/nanodbc.cpp.orig 2023-04-13 20:27:39 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 <std::size_t N> >+ inline std::size_t size(NANODBC_SQLCHAR const (&array)[N]) noexcept >+ { >+- auto const n = std::char_traits<NANODBC_SQLCHAR>::length(array); >++ auto const n = length(array); >+ NANODBC_ASSERT(n < N); >+ return n < N ? n : N - 1; >+ } >+@@ -3573,9 +3582,9 @@ std::list<datasource> list_datasources() >+ "incompatible SQLCHAR and string::value_type"); >+ >+ datasource dsn; >+- dsn.name = string(&name[0], &name[std::char_traits<NANODBC_SQLCHAR>::length(name)]); >++ dsn.name = string(&name[0], &name[length(name)]); >+ dsn.driver = >+- string(&driver[0], &driver[std::char_traits<NANODBC_SQLCHAR>::length(driver)]); >++ string(&driver[0], &driver[length(driver)]); >+ >+ dsns.push_back(std::move(dsn)); >+ direction = SQL_FETCH_NEXT; >+@@ -3626,7 +3635,7 @@ std::list<driver> list_drivers() >+ "incompatible SQLCHAR and string::value_type"); >+ >+ driver drv; >+- drv.name = string(&descr[0], &descr[std::char_traits<NANODBC_SQLCHAR>::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];
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 281886
: 254038