lwip-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lwip-devel] Issues with sys_arch.c for Win32


From: Gisle Vanem
Subject: [lwip-devel] Issues with sys_arch.c for Win32
Date: Thu, 6 Feb 2020 15:59:32 +0100
User-agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0

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;



--
--gv



reply via email to

[Prev in Thread] Current Thread [Next in Thread]