bytecodealliance / wasm-micro-runtime

WebAssembly Micro Runtime (WAMR)
Apache License 2.0
4.94k stars 623 forks source link

wamr windows build error with clang #3799

Open calvin2021y opened 1 month ago

calvin2021y commented 1 month ago

build WAMR-2.1.2 windows target with clang error. (with buildin libc)

calvin2021y commented 1 month ago
wamr/core/shared/platform/windows/win_socket.c:186:71: warning: passing 'unsigned int *' to parameter of type 'int *' converts between pointers to integer types with different sign [-Wpointer-sign]
  186 |         accept(server_sock->raw.socket, (struct sockaddr *)&addr_tmp, &len);
      |                                                                       ^~~~
/opt/local/mingw18/x86_64-w64-mingw32/include/winsock2.h:1003:80: note: passing argument to parameter 'addrlen' here
 1003 |   WINSOCK_API_LINKAGE SOCKET WSAAPI accept(SOCKET s,struct sockaddr *addr,int *addrlen);
      |                                                                                ^
wamr/core/shared/platform/windows/win_thread.c:534:16: warning: comparison of integers of different signs: 'int' and 'DWORD' (aka 'unsigned long') [-Wsign-compare]
  534 |     return ret != WAIT_FAILED ? BHT_OK : BHT_ERROR;
      |            ~~~ ^  ~~~~~~~~~~~
[ 45%] Building C object CMakeFiles/iwasm_static.dir/core/shared/utils/bh_common.c.obj
[ 45%] Building C object CMakeFiles/iwasm_static.dir/core/shared/utils/bh_hashmap.c.obj
wamr/core/shared/platform/windows/win_thread.c:722:8: warning: unknown attribute 'thread' ignored [-Wunknown-attributes]
  722 | static os_thread_local_attribute uint8 *thread_stack_boundary = NULL;
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~
wamr/core/shared/platform/windows/platform_internal.h:95:46: note: expanded from macro 'os_thread_local_attribute'
   95 | #define os_thread_local_attribute __declspec(thread)
      |                                              ^~~~~~
<built-in>:388:38: note: expanded from macro '__declspec'
  388 | #define __declspec(a) __attribute__((a))
      |                                      ^
wamr/core/shared/platform/windows/win_thread.c:776:8: warning: unknown attribute 'thread' ignored [-Wunknown-attributes]
  776 | static os_thread_local_attribute bool thread_signal_inited = false;
      |        ^~~~~~~~~~~~~~~~~~~~~~~~~
wamr/core/shared/platform/windows/platform_internal.h:95:46: note: expanded from macro 'os_thread_local_attribute'
   95 | #define os_thread_local_attribute __declspec(thread)
      |                                              ^~~~~~
<built-in>:388:38: note: expanded from macro '__declspec'
  388 | #define __declspec(a) __attribute__((a))
      |                                      ^
wamr/core/shared/platform/windows/win_file.c:87:13: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
   87 |             FILE_ATTRIBUTE_TAG_INFO file_info;
      |             ^
[ 47%] Building C object CMakeFiles/iwasm_static.dir/core/shared/utils/bh_leb128.c.obj
wamr/core/shared/platform/windows/win_file.c:865:13: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
  865 |             bool success = CloseHandle(handle->raw.handle);
      |             ^
/opt/local/mingw18/lib/clang/18/include/stdbool.h:20:14: note: expanded from macro 'bool'
   20 | #define bool _Bool
      |              ^
wamr/core/shared/platform/windows/win_file.c:872:13: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
  872 |             int ret = closesocket(handle->raw.socket);
      |             ^
wamr/core/shared/platform/windows/win_file.c:1298:31: warning: backslash and newline separated by space [-Wbackslash-newline-escape]
 1298 |             // Starts with \??\ 
      |                               ^
wamr/core/shared/platform/windows/win_file.c:1300:20: error: expected identifier
 1300 |                 && ((wbuf[4] >= L'A' && wbuf[4] <= L'Z')
      |                    ^
wamr/core/shared/platform/windows/win_file.c:1304:36: warning: backslash and newline separated by space [-Wbackslash-newline-escape]
 1304 |                     // \??\<drive>:\ 
      |                                    ^
wamr/core/shared/platform/windows/win_file.c:1313:106: warning: backslash and newline separated by space [-Wbackslash-newline-escape]
 1313 |                     // \??\UNC\<server>\<share>\ - make sure the final path looks like \\<server>\<share>\ 
      |                                                                                                          ^
wamr/core/shared/platform/windows/win_file.c:1705:28: warning: comparison of integers of different signs: 'int' and '__wasi_dircookie_t' (aka 'unsigned long long') [-Wsign-compare]
 1705 |     if (dir_stream->cookie == position)
      |         ~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~
wamr/core/shared/platform/windows/win_file.c:1708:28: warning: comparison of integers of different signs: 'int' and '__wasi_dircookie_t' (aka 'unsigned long long') [-Wsign-compare]
 1708 |     if (dir_stream->cookie > position) {
      |         ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~
wamr/core/shared/platform/windows/win_file.c:1712:31: warning: comparison of integers of different signs: 'int' and '__wasi_dircookie_t' (aka 'unsigned long long') [-Wsign-compare]
 1712 |     while (dir_stream->cookie < position) {
      |            ~~~~~~~~~~~~~~~~~~ ^ ~~~~~~~~
wamr/core/shared/platform/windows/win_file.c:1761:23: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
 1761 |         if (win_error = ERROR_INVALID_HANDLE)
      |             ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~
wamr/core/shared/platform/windows/win_file.c:1761:23: note: place parentheses around the assignment to silence this warning
 1761 |         if (win_error = ERROR_INVALID_HANDLE)
      |                       ^                     
      |             (                               )
wamr/core/shared/platform/windows/win_file.c:1761:23: note: use '==' to turn this assignment into an equality comparison
 1761 |         if (win_error = ERROR_INVALID_HANDLE)
      |                       ^
      |                       ==
3 warnings generated.