Skip to content

Fix warnings in server.c / client.c Windows build #235

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jsha opened this issue Nov 15, 2021 · 1 comment · Fixed by #405
Closed

Fix warnings in server.c / client.c Windows build #235

jsha opened this issue Nov 15, 2021 · 1 comment · Fixed by #405

Comments

@jsha
Copy link
Collaborator

jsha commented Nov 15, 2021

tests/server.c(57): warning C4013: 'ws_strerror' undefined; assuming extern returning int
tests/server.c(57): warning C4477: 'fprintf' : format string '%s' requires an argument of type 'char *', but variadic argument 2 has type 'int'
tests/server.c(57): warning C4313: 'fprintf': '%s' in format string conflicts with argument 2 of type 'int'
tests/server.c(62): warning C4477: 'fprintf' : format string '%s' requires an argument of type 'char *', but variadic argument 2 has type 'int'
tests/server.c(62): warning C4313: 'fprintf': '%s' in format string conflicts with argument 2 of type 'int'
tests/server.c(98): warning C4477: 'fprintf' : format string '%s' requires an argument of type 'char *', but variadic argument 1 has type 'int'
tests/server.c(98): warning C4313: 'fprintf': '%s' in format string conflicts with argument 1 of type 'int'
tests/server.c(110): warning C4477: 'fprintf' : format string '%ld' requires an argument of type 'long', but variadic argument 1 has type 'size_t'
tests/server.c(110): note: consider using '%zd' in the format string
tests/server.c(129): warning C4477: 'fprintf' : format string '%ld' requires an argument of type 'long', but variadic argument 1 has type 'size_t'
tests/server.c(129): note: consider using '%zd' in the format string
tests/server.c(135): warning C4477: 'fprintf' : format string '%s' requires an argument of type 'char *', but variadic argument 1 has type 'int'
tests/server.c(135): warning C4313: 'fprintf': '%s' in format string conflicts with argument 1 of type 'int'
tests/server.c(168): warning C4477: 'fprintf' : format string '%ld' requires an argument of type 'long', but variadic argument 1 has type 'size_t'
tests/server.c(168): note: consider using '%zd' in the format string
tests/server.c(331): error C2079: 'siga' uses undefined struct 'sigaction'
tests/server.c(332): error C2224: left of '.sa_handler' must have struct/union type
tests/server.c(333): warning C4013: 'sigaction' undefined; assuming extern returning int
tests/server.c(363): warning C4244: '=': conversion from 'SOCKET' to 'int', possible loss of data
tests/server.c(365): warning C4477: 'fprintf' : format string '%s' requires an argument of type 'char *', but variadic argument 1 has type 'int'
tests/server.c(365): warning C4313: 'fprintf': '%s' in format string conflicts with argument 1 of type 'int'
tests/server.c(369): warning C4133: 'function': incompatible types - from 'int *' to 'const char *'
tests/server.c(379): warning C4996: 'inet_addr': Use inet_pton() or InetPton() instead or define _WINSOCK_DEPRECATED_NO_WARNINGS to disable deprecated API warnings
tests/server.c(396): warning C4244: 'initializing': conversion from 'SOCKET' to 'int', possible loss of data
jsha pushed a commit that referenced this issue Apr 13, 2022
This adds a cross-platform CMake build system, which supports basic
building and testing on Linux, macOS and Windows. (It does not
yet have parity on Linux/macOS debug builds, sanitizer builds, or
running test harnesses, but those could be added in the future with
CMAKE_BUILD_TYPE conditionals and CTest. It also doesn't cover the
install step yet.) I also rewrote the bash test harnesses in Python,
as a cross-platform substitute, and fixed a couple portability issues
with the test programs.

* Added CMake projects.
* Added Python versions of shell scripts.
* Moved Windows compatibility defines to common.h, so common.c would
  see them. (Prior to this, read_cb was checking `errno` rather than
  `WSAGetLastError()`, failing to properly handle `WSAEWOULDBLOCK`,
  and reporting an EOF too early.
* Added a forward declaration of `ws_strerror()`. Without this declaration,
  the compiler would assume it returned an `int` rather than a pointer, which
  resulted in the pointer getting truncated, and a later `fprintf` call performing
  a wild read. (In retrospect, this was foretold in #235)
* Added CMake CI jobs on Windows, macOS, and Linux.

Fixes #192, fixes #121
jsha pushed a commit that referenced this issue Dec 11, 2022
@cpu
Copy link
Member

cpu commented Mar 30, 2024

I think the contributions in #275 did the hard work here. I'm only seeing two warnings in the CMake windows builds as of the time of writing:

D:\a\rustls-ffi\rustls-ffi\tests\client.c(461,23): warning C4133: 'function': incompatible types - from 'rustls_result (__cdecl *)(void *,const rustls_verify_server_cert_params *)' to 'rustls_verify_server_cert_callback'
D:\a\rustls-ffi\rustls-ffi\tests\server.c(342,51): warning C4133: 'function': incompatible types - from 'int *' to 'const char *' [D:\a\rustls-ffi\rustls-ffi\build\tests\server.vcxproj]

I think #405 will fix both and resolve this issue.

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 a pull request may close this issue.

2 participants