Skip to content

HANDLE_EINTR macro fails to compile with CPPHTTPLIB_USE_POLL when using msvsc2017 #500

Closed
@Bendr0id

Description

When compiling on Windows using the msbuild (Visual Studio 2017) and -DCPPHTTPLIB_USE_POLL it gets me some compile errors when it reaches the HANDLE_EINTR(poll calls.

Errors:

c:\xxx\cpp-httplib\httplib.h(1648): warning C4003: not enough arguments for function-like macro invocation 'poll' [C:\xxx\xxx.vcxproj]
c:\xxx\cpp-httplib\httplib.h(1648): error C2059: syntax error: ',' [C:\xxx\xxx.vcxproj]
c:\xxx\cpp-httplib\httplib.h(1671): warning C4003: not enough arguments for function-like macro invocation 'poll' [C:\xxx\xxx.vcxproj]
c:\xxx\cpp-httplib\httplib.h(1671): error C2059: syntax error: ',' [C:\xxx\xxx.vcxproj]
c:\xxx\cpp-httplib\httplib.h(1694): warning C4003: not enough arguments for function-like macro invocation 'poll' [C:\xxx\xxx.vcxproj]
c:\xxx\cpp-httplib\httplib.h(1694): error C2059: syntax error: ',' [C:\xxx\xxx.vcxproj]
c:\xxx\cpp-httplib\httplib.h(2184): warning C4267: '=': conversion from 'size_t' to 'uInt', possible loss of data [C:\xxx\xxx.vcxproj]

When i switch it back from:

return HANDLE_EINTR(poll, &pfd_read, 1, timeout);

To:

return poll(&pfd_read, 1, timeout);

It compiles fine. All the other calls using the HANDLER_EINTR makro seems to work.

So it seems to have something todo with the define here which is Windows only:

#ifdef CPPHTTPLIB_USE_POLL
#define poll(fds, nfds, timeout) WSAPoll(fds, nfds, timeout)
#endif

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions