From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2181) id A53D93858005; Tue, 24 Aug 2021 16:00:21 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org A53D93858005 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Jonathan Wakely To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org Subject: [gcc r11-8908] libstdc++: Allow net::io_context to compile without [PR 100180] X-Act-Checkin: gcc X-Git-Author: Jonathan Wakely X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 8140362761e9c225023f42c28647babd548dc653 X-Git-Newrev: 530a8f5c824f34a72ad4380d150225905198845b Message-Id: <20210824160021.A53D93858005@sourceware.org> Date: Tue, 24 Aug 2021 16:00:21 +0000 (GMT) X-BeenThere: libstdc++-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 24 Aug 2021 16:00:21 -0000 https://gcc.gnu.org/g:530a8f5c824f34a72ad4380d150225905198845b commit r11-8908-g530a8f5c824f34a72ad4380d150225905198845b Author: Jonathan Wakely Date: Fri Apr 23 13:38:05 2021 +0100 libstdc++: Allow net::io_context to compile without [PR 100180] This adds dummy placeholders to net::io_context so that it can still be compiled on targets without . libstdc++-v3/ChangeLog: PR libstdc++/100180 * include/experimental/io_context (io_context): Define dummy_pollfd type so that most member functions still compile without and struct pollfd. (cherry picked from commit 0e1e7b77904f1fe2a6dbfe84bb4fc026584ba480) Diff: --- libstdc++-v3/include/experimental/io_context | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/libstdc++-v3/include/experimental/io_context b/libstdc++-v3/include/experimental/io_context index 82d7b4f545e..63d7db5b2d0 100644 --- a/libstdc++-v3/include/experimental/io_context +++ b/libstdc++-v3/include/experimental/io_context @@ -716,6 +716,7 @@ inline namespace v1 struct __reactor { +#ifdef _GLIBCXX_HAVE_POLL_H __reactor() : _M_fds(1) { int __pipe[2]; @@ -739,6 +740,7 @@ inline namespace v1 ::close(_M_fds.back().fd); ::close(_M_notify_wr); } +#endif // write a notification byte to the pipe (ignoring errors) void _M_notify() @@ -799,8 +801,12 @@ inline namespace v1 _M_notify(); } -# ifdef _GLIBCXX_HAVE_POLL_H +#ifdef _GLIBCXX_HAVE_POLL_H using __fdvec = vector<::pollfd>; +#else + struct dummy_pollfd { int fd = -1; short events = 0, revents = 0; }; + using __fdvec = vector; +#endif // Find first element p such that !(p.fd < __fd) // N.B. always returns a dereferencable iterator. @@ -816,6 +822,7 @@ inline namespace v1 __status wait(__fdvec& __fds, chrono::milliseconds __timeout) { +#ifdef _GLIBCXX_HAVE_POLL_H // XXX not thread-safe! __fds = _M_fds; // take snapshot to pass to poll() @@ -845,10 +852,14 @@ inline namespace v1 __fds.erase(__part, __fds.end()); return _S_ok; +#else + (void) __timeout; + __fds.clear(); + return _S_error; +#endif } __fdvec _M_fds; // _M_fds.back() is the read end of the self-pipe -#endif int _M_notify_wr; // write end of the self-pipe };