FreeBSD Bugzilla – Attachment 254596 Details for
Bug 282386
emulators/dosbox-x: fix build with libc++ 19
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
emulators/dosbox-x: fix build with libc++ 19
emulators__dosbox-x-fix-libcxx19-build-1.diff (text/plain), 5.26 KB, created by
Dimitry Andric
on 2024-10-28 16:15:06 UTC
(
hide
)
Description:
emulators/dosbox-x: fix build with libc++ 19
Filename:
MIME Type:
Creator:
Dimitry Andric
Created:
2024-10-28 16:15:06 UTC
Size:
5.26 KB
patch
obsolete
>commit cc8220b1b14989e3f83c470cae4f5c644a1f14e1 >Author: Dimitry Andric <dim@FreeBSD.org> >Date: 2024-10-28T17:12:15+01:00 > > emulators/dosbox-x: 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 emulators/dosbox-x to fail to compile with clang 19 and > libc++ 19, resulting in errors similar to: > > /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, > | ^ > dos_programs.cpp:7692:17: note: in instantiation of template class 'std::basic_string<unsigned short>' requested here > 7692 | test_string dst; > | ^ > /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here > 23 | struct _LIBCPP_TEMPLATE_VIS char_traits; > | ^ > dos_programs.cpp:8893:14: warning: variable 'open' set but not used [-Wunused-but-set-variable] > 8893 | bool open=false; > | ^ > > This can be fixed by using char16_t for the 'test_char_t` type, and by > adding a few inline wrappers to perform the required casting. > > [1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals > > PR: 282386 > MFH: 2024Q4 > >diff --git a/emulators/dosbox-x/files/patch-src_dos_dos__programs.cpp b/emulators/dosbox-x/files/patch-src_dos_dos__programs.cpp >new file mode 100644 >index 000000000000..384e79ce2264 >--- /dev/null >+++ b/emulators/dosbox-x/files/patch-src_dos_dos__programs.cpp >@@ -0,0 +1,21 @@ >+--- src/dos/dos_programs.cpp.orig 2024-10-02 06:16:36 UTC >++++ src/dos/dos_programs.cpp >+@@ -81,7 +81,7 @@ host_cnv_char_t *CodePageGuestToHost(const char *s); >+ #endif >+ #ifdef C_ICONV >+ #include "iconvpp.hpp" >+-typedef uint16_t test_char_t; >++typedef char16_t test_char_t; >+ typedef std::basic_string<test_char_t> test_string; >+ typedef std::basic_string<char> test_char; >+ #endif >+@@ -102,6 +102,9 @@ bool CodePageHostToGuestUTF8(char *d/*CROSS_LEN*/,cons >+ bool qmount = false; >+ bool nowarn = false; >+ bool CodePageHostToGuestUTF8(char *d/*CROSS_LEN*/,const char *s/*CROSS_LEN*/), CodePageHostToGuestUTF16(char *d/*CROSS_LEN*/,const uint16_t *s/*CROSS_LEN*/); >++inline bool CodePageHostToGuestUTF16(char *d/*CROSS_LEN*/,const char16_t *s/*CROSS_LEN*/) { >++ return CodePageHostToGuestUTF16(d, reinterpret_cast<const uint16_t *>(s)); >++} >+ extern bool systemmessagebox(char const * aTitle, char const * aMessage, char const * aDialogType, char const * aIconType, int aDefaultButton); >+ extern bool addovl, addipx, addne2k, prepared, inshell, usecon, uao, loadlang, morelen, mountfro[26], mountiro[26], resetcolor, staycolors, printfont, notrycp, internal_program; >+ extern bool clear_screen(), OpenGL_using(void), DOS_SetAnsiAttr(uint8_t attr), isDBCSCP(); >diff --git a/emulators/dosbox-x/files/patch-src_dos_drive__iso.cpp b/emulators/dosbox-x/files/patch-src_dos_drive__iso.cpp >new file mode 100644 >index 000000000000..c9162b0bdb2d >--- /dev/null >+++ b/emulators/dosbox-x/files/patch-src_dos_drive__iso.cpp >@@ -0,0 +1,31 @@ >+--- src/dos/drive_iso.cpp.orig 2024-10-02 06:16:36 UTC >++++ src/dos/drive_iso.cpp >+@@ -40,6 +40,10 @@ extern bool CodePageHostToGuestUTF16(char *d/*CROSS_LE >+ extern bool gbk, isDBCSCP(), isKanji1_gbk(uint8_t chr), shiftjis_lead_byte(int c); >+ extern bool filename_not_8x3(const char *n), filename_not_strict_8x3(const char *n); >+ extern bool CodePageHostToGuestUTF16(char *d/*CROSS_LEN*/,const uint16_t *s/*CROSS_LEN*/); >++inline bool CodePageHostToGuestUTF16(uint8_t *d/*CROSS_LEN*/,const uint8_t *s/*CROSS_LEN*/) { >++ std::u16string u16s(reinterpret_cast<const char16_t *>(s)); >++ return CodePageHostToGuestUTF16(reinterpret_cast<char *>(d), reinterpret_cast<const uint16_t *>(u16s.c_str())); >++} >+ >+ using namespace std; >+ >+@@ -1762,7 +1766,7 @@ int isoDrive::readDirEntry(isoDirEntry* de, const uint >+ // The string is big Endian UCS-16, convert to host Endian UCS-16 >+ for (size_t i=0;((const uint16_t*)de->ident)[i] != 0;i++) ((uint16_t*)de->ident)[i] = be16toh(((uint16_t*)de->ident)[i]); >+ // finally, convert from UCS-16 to local code page, using C++ string construction to make a copy first >+- CodePageHostToGuestUTF16((char*)de->ident,std::basic_string<uint16_t>((const uint16_t*)de->ident).c_str()); >++ CodePageHostToGuestUTF16(de->ident, de->ident); >+ } >+ } >+ } else { >+@@ -1784,7 +1788,7 @@ int isoDrive::readDirEntry(isoDirEntry* de, const uint >+ // The string is big Endian UCS-16, convert to host Endian UCS-16 >+ for (size_t i=0;((const uint16_t*)de->ident)[i] != 0;i++) ((uint16_t*)de->ident)[i] = be16toh(((uint16_t*)de->ident)[i]); >+ // finally, convert from UCS-16 to local code page, using C++ string construction to make a copy first >+- CodePageHostToGuestUTF16((char*)de->ident,std::basic_string<uint16_t>((const uint16_t*)de->ident).c_str()); >++ CodePageHostToGuestUTF16(de->ident, de->ident); >+ } >+ else { >+ // remove any file version identifiers as there are some cdroms that don't have them
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 282386
: 254596