mirror of
https://git.freebsd.org/ports.git
synced 2025-04-29 01:56:37 -04:00
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
24 lines
1.3 KiB
C++
24 lines
1.3 KiB
C++
Fix build with clang 19
|
|
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=282386
|
|
|
|
--- 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();
|