[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [lwip-devel] Issues with sys_arch.c for Win32
From: |
address@hidden |
Subject: |
Re: [lwip-devel] Issues with sys_arch.c for Win32 |
Date: |
Mon, 10 Feb 2020 21:56:02 +0100 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.4.2 |
Both fixed, thanks for the hint.
Regards,
Simon
Am 06.02.2020 um 15:59 schrieb Gisle Vanem:
> In 'contrib/ports/win32/sys_arch.c', this function
> is implemented as:
>
> u32_t lwip_port_rand(void)
> {
> ...
> }
>
> Whereas it's prototyped to return 'unsigned int'.
> Not always the same thing.
>
> Also in the same file, there is:
> static void
> sys_thread_function(void* arg)
> {
> ...
> }
> ...
> h = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)sys_thread_function,
> new_thread, 0, &(new_thread->id));
>
> on which clang-cl warns about:
> contrib/ports/win32/sys_arch.c(457,28): warning: cast between incompatible
> calling conventions 'cdecl' and 'stdcall'; calls through this pointer may
> abort at runtime [-Wcast-calling-convention]
> h = CreateThread(0, 0, (LPTHREAD_START_ROUTINE)sys_thread_function,
> new_thread, 0, &(new_thread->id));
> ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> contrib/ports/win32/sys_arch.c(425,1): note: consider defining
> 'sys_thread_function' with the 'stdcall' calling convention
>
> -----
>
> It's probably safe since 'CreateThread()' ignores a
> 'ret 4' vs simply a 'ret'. But this fixes the warning:
>
> --- a/contrib/ports/win32/sys_arch.c 2019-04-22 09:15:35
> +++ b/contrib/ports/win32/sys_arch.c 2020-02-06 14:52:21
> @@ -421,7 +421,7 @@
> }
> #endif /* _MSC_VER */
>
> -static void
> +static void WINAPI
> sys_thread_function(void* arg)
> {
> struct threadlist* t = (struct threadlist*)arg;
>
>
>