Skip to content

Add missing casts for ThreadImpl.win32 with mingw#1351

Open
tobil4sk wants to merge 1 commit into
HaxeFoundation:masterfrom
tobil4sk:fix/threads-mingw
Open

Add missing casts for ThreadImpl.win32 with mingw#1351
tobil4sk wants to merge 1 commit into
HaxeFoundation:masterfrom
tobil4sk:fix/threads-mingw

Conversation

@tobil4sk

Copy link
Copy Markdown
Member

Possibly a regression from: #1336.

Mingw is stricter about these conversions so it catches them as compiler errors if an explicit cast isn't used:

Error: /.../hxcpp/src/hx/thread/ThreadImpl.win32.cpp: In member function ‘virtual String hx::thread::ThreadImpl_obj::getName()’:
/.../hxcpp/src/hx/thread/ThreadImpl.win32.cpp:14:52: error: invalid conversion from ‘std::thread::native_handle_type’ {aka ‘long long unsigned int’} to ‘HANDLE’ {aka ‘void*’} [-fpermissive]
   14 |         auto result = GetThreadDescription(native->handle, &buffer);
      |                                            ~~~~~~~~^~~~~~
      |                                                    |
      |                                                    std::thread::native_handle_type {aka long long unsigned int}
In file included from /usr/x86_64-w64-mingw32/include/winbase.h:29,
                 from /usr/x86_64-w64-mingw32/include/windows.h:70,
                 from /.../hxcpp/src/hx/thread/ThreadImpl.win32.cpp:2:
/usr/x86_64-w64-mingw32/include/processthreadsapi.h:367:58: note: initializing argument 1 of ‘HRESULT GetThreadDescription(HANDLE, WCHAR**)’
  367 |   WINBASEAPI HRESULT WINAPI GetThreadDescription (HANDLE hThread, PWSTR *ppszThreadDescription);
      |                                                   ~~~~~~~^~~~~~~
/.../hxcpp/src/hx/thread/ThreadImpl.win32.cpp: In member function ‘virtual void hx::thread::ThreadImpl_obj::setName(const String&)’:
/.../hxcpp/src/hx/thread/ThreadImpl.win32.cpp:39:52: error: invalid conversion from ‘std::thread::native_handle_type’ {aka ‘long long unsigned int’} to ‘HANDLE’ {aka ‘void*’} [-fpermissive]
   39 |         auto result = SetThreadDescription(native->handle, name.wchar_str(&buffer));
      |                                            ~~~~~~~~^~~~~~
      |                                                    |
      |                                                    std::thread::native_handle_type {aka long long unsigned int}
/usr/x86_64-w64-mingw32/include/processthreadsapi.h:366:58: note: initializing argument 1 of ‘HRESULT SetThreadDescription(HANDLE, PCWSTR)’
  366 |   WINBASEAPI HRESULT WINAPI SetThreadDescription (HANDLE hThread, PCWSTR lpThreadDescription);
      |                                                   ~~~~~~~^~~~~~~
/.../hxcpp/src/hx/thread/ThreadImpl.win32.cpp: In constructor ‘hx::thread::ThreadImpl_obj::Native::Native()’:
/.../hxcpp/src/hx/thread/ThreadImpl.win32.cpp:55:81: error: invalid conversion from ‘HANDLE’ {aka ‘void*’} to ‘std::thread::native_handle_type’ {aka ‘long long unsigned int’} [-fpermissive]
   55 | hx::thread::ThreadImpl_obj::Native::Native() : thread(), handle(GetCurrentThread()) {}
      |                                                                 ~~~~~~~~~~~~~~~~^~
      |                                                                                 |
      |                                                                                 HANDLE {aka void*}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant