Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
cmake finds wrong recv and send arguments with MSVC #1640
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.
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: