From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTP id 19C7C3AA004E for ; Fri, 23 Apr 2021 13:01:13 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 19C7C3AA004E Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-274-fwxf5-_3MXibL6POR6f5mA-1; Fri, 23 Apr 2021 09:01:10 -0400 X-MC-Unique: fwxf5-_3MXibL6POR6f5mA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 898481006C86; Fri, 23 Apr 2021 13:01:09 +0000 (UTC) Received: from localhost (unknown [10.33.36.164]) by smtp.corp.redhat.com (Postfix) with ESMTP id 334555C1C2; Fri, 23 Apr 2021 13:01:09 +0000 (UTC) Date: Fri, 23 Apr 2021 14:01:08 +0100 From: Jonathan Wakely To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org Subject: [committed 3/3] libstdc++: Allow net::io_context to compile without [PR 100180] Message-ID: <20210423130108.GG3008@redhat.com> References: MIME-Version: 1.0 In-Reply-To: X-Clacks-Overhead: GNU Terry Pratchett X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: multipart/mixed; boundary="vkzoT2Bc9VsM/9ev" Content-Disposition: inline X-Spam-Status: No, score=-14.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H4, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 23 Apr 2021 13:01:14 -0000 --vkzoT2Bc9VsM/9ev Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline This adds dummy placeholders to net::io_context so that it can still be compiled on targets without . Tested powerpc64le-linux and sparc-solaris. Committed to trunk. This could be backported so that it fixes PR 100180 everywhere, but after the gcc-11 release. --vkzoT2Bc9VsM/9ev Content-Type: text/x-patch; charset=us-ascii Content-Disposition: attachment; filename="patch.txt" commit 0e1e7b77904f1fe2a6dbfe84bb4fc026584ba480 Author: Jonathan Wakely Date: Fri Apr 23 13:38:05 2021 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. 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 }; --vkzoT2Bc9VsM/9ev--