Fix calling convention of thread entry point
authorHannes Domani <ssbssa@yahoo.de>
Mon, 28 Nov 2022 18:22:38 +0000 (19:22 +0100)
committerHannes Domani <ssbssa@yahoo.de>
Mon, 28 Nov 2022 19:46:01 +0000 (20:46 +0100)
commit1d39fec4aeacc53f6eb696eaa846f8f07948fcf5
treeff20b720736d4de897cb95a294be8b7565a52bcc
parent5975a5caceb238be7eddb3b279d51145a1628af8
Fix calling convention of thread entry point

For i686 the CreateThread entry point function needs the WINAPI (stdcall)
calling convention:

../../gdb/windows-nat.c: In constructor 'windows_nat_target::windows_nat_target()':
../../gdb/windows-nat.c:450:56: error: invalid user-defined conversion from 'windows_nat_target::windows_nat_target()::<lambda(LPVOID)>' to 'LPTHREAD_START_ROUTINE' {aka 'long unsigned int (__attribute__((stdcall)) *)(void*)'} [-fpermissive]
  450 |   HANDLE bg_thread = CreateThread (nullptr, 64 * 1024, fn, this, 0, nullptr);
      |                                                        ^~
../../gdb/windows-nat.c:444:13: note: candidate is: 'constexpr windows_nat_target::windows_nat_target()::<lambda(LPVOID)>::operator DWORD (*)(LPVOID)() const' (near match)
  444 |   auto fn = [] (LPVOID self) -> DWORD
      |             ^
../../gdb/windows-nat.c:444:13: note:   no known conversion from 'DWORD (*)(LPVOID)' {aka 'long unsigned int (*)(void*)'} to 'LPTHREAD_START_ROUTINE' {aka 'long unsigned int (__attribute__((stdcall)) *)(void*)'}

Since it's not possible to change the calling convention of a lambda, I've
moved it to a separate function.
gdb/windows-nat.c