Skip to content

cmake finds wrong recv and send arguments with MSVC #1640

@bagder

Description

@bagder

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions