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

cmake finds wrong recv and send arguments with MSVC #1640

Closed
bagder opened this Issue Jul 4, 2017 · 0 comments

Comments

Projects
None yet
1 participant
@bagder
Member

bagder commented Jul 4, 2017

I did this

I'm researching what to do to decrease the number of compiler warnings in our regular CI builds. I took a closer look at our AppVeyor builds for windows. They generate MSVC project files with cmake and build curl.

Example build log

I expected the following

Our use of the sread() and swrite() macros in the code should not cause compiler warnings, but they do.

Since send() and recv() on various systems are not always following the POSIX prototype, we try to detect what arguments they prefer. This is done by autotools and by cmake, for all platforms. The cmake code that checks these functions for MSVC on windows seem to pick the first tested argument set, which is the POSIX complient set, which is not the set that Windows' recv() and send() functions want. This then makes the compiler generate a lot of warnings about conversions from size_t to int (the third argument).

On Windows, the prototypes for these functions look like this:

int recv(SOCKET s, char *buf, int len, int flags);
int send(SOCKET s, const char *buf, int len, int flags);

curl/libcurl version

git master

operating system

Windows

@bagder bagder added the cmake label Jul 4, 2017

bagder added a commit that referenced this issue Jul 5, 2017

cmake: fix send/recv argument scanner for windows
... by simply trying the Windows argument types first.

Fixes #1640

@bagder bagder closed this in #1644 Jul 5, 2017

bagder added a commit that referenced this issue Jul 5, 2017

cmake: fix send/recv argument scanner for windows
... by simply trying the Windows argument types first.

Fixes #1640

@lock lock bot locked as resolved and limited conversation to collaborators May 6, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.