Details
-
Bug
-
Status: Open
-
Trivial
-
Resolution: Unresolved
-
None
-
None
-
None
Description
Multiple errors of this form when HAVE_POLL_H is defined but HAVE_SYS_POLL_H is not defined. Technically, the correct dependency here should be HAVE_POLL_H, because that is the actual header in the POSIX spec.
/Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/TServerSocket.cpp: In member function 'virtual std::shared_ptr<apache::thrift::transport::TTransport> apache::thrift::transport::TServerSocket::acceptImpl()': /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/TServerSocket.cpp:597:24: error: elements of array 'apache::thrift::transport::TServerSocket::acceptImpl()::pollfd fds [2]' have incomplete type 597 | struct THRIFT_POLLFD fds[2]; | ^~~ /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/TServerSocket.cpp:597:24: error: storage size of 'fds' isn't known In file included from /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/TServerSocket.cpp:50: /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/PlatformSocket.h:123:26: error: 'POLLIN' was not declared in this scope 123 | # define THRIFT_POLLIN POLLIN | ^~~~~~ /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/TServerSocket.cpp:605:21: note: in expansion of macro 'THRIFT_POLLIN' 605 | fds[0].events = THRIFT_POLLIN; | ^~~~~~~~~~~~~ /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/PlatformSocket.h:121:23: error: 'poll' was not declared in this scope; did you mean 'k_poll'? 121 | # define THRIFT_POLL poll | ^~~~ /Users/cfriedt/workspace/zephyrproject/modules/lib/thrift/.upstream/lib/cpp/src/thrift/transport/TServerSocket.cpp:614:15: note: in expansion of macro 'THRIFT_POLL' 614 | int ret = THRIFT_POLL(fds, 2, accTimeout_); | ^~~~~~~~~~~
Looks as though it affects the following files, and the problem is obvious (they don't include the correct header <poll.h>).
- lib/cpp/src/thrift/transport/TNonblockingServerSocket.cpp
- lib/cpp/src/thrift/transport/TSSLSocket.cpp
- lib/cpp/src/thrift/transport/TServerSocket.cpp
- lib/cpp/src/thrift/transport/TSocket.cpp
The sys/poll.h header is not actually where poll(2) must be defined according to the POSIX spec, but the sources above seem to assume that.
However, we shouldn't simply erase use of sys/poll.h everywhere. There may be the case where some non-POSIX compliant platform uses that instead of <poll.h>.
PR is here
https://github.com/apache/thrift/pull/2723
Attachments
Issue Links
- links to