FreeBSD Bugzilla – Attachment 253581 Details for
Bug 281516
graphics/libemf: fix build with libc++ 19
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
graphics/libemf: fix build with libc++ 19
graphics__libemf-fix-libcxx19-build-1.diff (text/plain), 2.57 KB, created by
Dimitry Andric
on 2024-09-15 11:55:54 UTC
(
hide
)
Description:
graphics/libemf: fix build with libc++ 19
Filename:
MIME Type:
Creator:
Dimitry Andric
Created:
2024-09-15 11:55:54 UTC
Size:
2.57 KB
patch
obsolete
>commit 26a03177140023fc00b89c77b18872bda8041060 >Author: Dimitry Andric <dim@FreeBSD.org> >Date: 2024-09-15T13:55:03+02:00 > > graphics/libemf: 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 graphics/libemf 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, > | ^ > libemf.cpp:982:30: note: in instantiation of template class 'std::basic_string<unsigned short>' requested here > 982 | std::basic_string<WCHAR> filename_w( filename, filename + filename_count ); > | ^ > /usr/include/c++/v1/__fwd/string.h:23:29: note: template is declared here > 23 | struct _LIBCPP_TEMPLATE_VIS char_traits; > | ^ > > libemf should really use char16_t for its 16-bit character type, but the > code is full of Windows assumptions that WCHAR is unsigned short. Since > std::basic_string<unsigned short> is no longer available, use > std::basic_string<char16_t> instead, and cast the result to the > appropriate type for GetEnhMetaFileW(). > > [1] https://libcxx.llvm.org/ReleaseNotes/19.html#deprecations-and-removals > > PR: 281516 > MFH: 2024Q3 > >diff --git a/graphics/libemf/files/patch-libemf_libemf.cpp b/graphics/libemf/files/patch-libemf_libemf.cpp >index b0da3b4bbe53..e0368f114e08 100644 >--- a/graphics/libemf/files/patch-libemf_libemf.cpp >+++ b/graphics/libemf/files/patch-libemf_libemf.cpp >@@ -1,4 +1,4 @@ >---- libemf/libemf.cpp.orig 2021-11-01 12:21:53 UTC >+--- libemf/libemf.cpp.orig 2020-06-07 13:10:20 UTC > +++ libemf/libemf.cpp > @@ -72,8 +72,7 @@ namespace EMF { > if ( not bigEndian() ) { >@@ -10,3 +10,15 @@ > } > > /*! >+@@ -980,9 +979,9 @@ extern "C" { >+ >+ int filename_count = ::strlen( filename ); >+ >+- std::basic_string<WCHAR> filename_w( filename, filename + filename_count ); >++ std::basic_string<char16_t> filename_w( filename, filename + filename_count ); >+ >+- HENHMETAFILE handle = GetEnhMetaFileW( filename_w.c_str() ); >++ HENHMETAFILE handle = GetEnhMetaFileW( reinterpret_cast<LPCWSTR>(filename_w.c_str()) ); >+ >+ return handle; >+ }
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 281516
: 253581