Skip to content

Fix MSVC compilation warnings with mbedTLS#3617

Closed
saghul wants to merge 2 commits into
warmcat:mainfrom
saghul:fix-msvc-warnings-and-disable-werror
Closed

Fix MSVC compilation warnings with mbedTLS#3617
saghul wants to merge 2 commits into
warmcat:mainfrom
saghul:fix-msvc-warnings-and-disable-werror

Conversation

@saghul

@saghul saghul commented Jun 19, 2026

Copy link
Copy Markdown
Contributor
  • mbedtls: cast sockfd to int when storing in net_context fd
  • cmake: honor DISABLE_WERROR on MSVC

saghul added 2 commits June 19, 2026 15:30
The mbedtls server and client bio setup assigned lws_sockfd_type
directly to mbedtls_net_context.fd, which is an int. On Win64
lws_sockfd_type is SOCKET (a 64-bit UINT_PTR), so MSVC warns C4244
"possible loss of data", which fails the build under /WX.

Add an explicit (int) cast, matching the gnutls and openhitls backends
which already cast the same sockfd the same way.
DISABLE_WERROR only gated the GCC/Clang -Werror flag; the MSVC branch
added /WX unconditionally, so setting DISABLE_WERROR=ON had no effect
when building with MSVC.

Gate /WX on DISABLE_WERROR the same way the GCC/Clang path does, leaving
/W3 (the warning level) always enabled.
@saghul

saghul commented Jun 20, 2026

Copy link
Copy Markdown
Contributor Author

Landed in main.

@saghul saghul closed this Jun 20, 2026
@sonarqubecloud

Copy link
Copy Markdown

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