public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
From: Jonathan Wakely <redi@gcc.gnu.org>
To: gcc-cvs@gcc.gnu.org, libstdc++-cvs@gcc.gnu.org
Subject: [gcc r11-8282] libstdc++: Remove #error from <semaphore> implementation [PR 100179]
Date: Thu, 22 Apr 2021 13:37:31 +0000 (GMT)	[thread overview]
Message-ID: <20210422133731.E04F43896C18@sourceware.org> (raw)

https://gcc.gnu.org/g:718fcebe8b65e98b794f9a53ce7358e034657588

commit r11-8282-g718fcebe8b65e98b794f9a53ce7358e034657588
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Apr 22 11:10:06 2021 +0100

    libstdc++: Remove #error from <semaphore> implementation [PR 100179]
    
    This removes the #error from <bits/semaphore_base.h> for the case where
    neither __atomic_semaphore nor __platform_semaphore is defined.
    
    Also rename the _GLIBCXX_REQUIRE_POSIX_SEMAPHORE macro to
    _GLIBCXX_USE_POSIX_SEMAPHORE for consistency with the similar
    _GLIBCXX_USE_CXX11_ABI macro that can be used to request an alternative
    (ABI-changing) implementation.
    
    libstdc++-v3/ChangeLog:
    
            PR libstdc++/100179
            * include/bits/semaphore_base.h: Remove #error.
            * include/std/semaphore: Do not define anything unless one of
            the implementations is available.
    
    (cherry picked from commit 4b2db8077136d2f8b5a0db026e6161810be327b3)

Diff:
---
 libstdc++-v3/include/bits/semaphore_base.h | 6 ++----
 libstdc++-v3/include/std/semaphore         | 2 ++
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/libstdc++-v3/include/bits/semaphore_base.h b/libstdc++-v3/include/bits/semaphore_base.h
index 84b33423fff..4948f0fd0bc 100644
--- a/libstdc++-v3/include/bits/semaphore_base.h
+++ b/libstdc++-v3/include/bits/semaphore_base.h
@@ -263,14 +263,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
   };
 #endif // __cpp_lib_atomic_wait
 
-// Note: the _GLIBCXX_REQUIRE_POSIX_SEMAPHORE macro can be used to force the
+// Note: the _GLIBCXX_USE_POSIX_SEMAPHORE macro can be used to force the
 // use of Posix semaphores (sem_t). Doing so however, alters the ABI.
-#if defined __cpp_lib_atomic_wait && !_GLIBCXX_REQUIRE_POSIX_SEMAPHORE
+#if defined __cpp_lib_atomic_wait && !_GLIBCXX_USE_POSIX_SEMAPHORE
   using __semaphore_impl = __atomic_semaphore;
 #elif _GLIBCXX_HAVE_POSIX_SEMAPHORE
   using __semaphore_impl = __platform_semaphore;
-#else
-#  error "No suitable semaphore implementation available"
 #endif
 
 _GLIBCXX_END_NAMESPACE_VERSION
diff --git a/libstdc++-v3/include/std/semaphore b/libstdc++-v3/include/std/semaphore
index a1560915d83..52addca742c 100644
--- a/libstdc++-v3/include/std/semaphore
+++ b/libstdc++-v3/include/std/semaphore
@@ -34,6 +34,7 @@
 #if __cplusplus > 201703L
 #include <bits/semaphore_base.h>
 
+#if __cpp_lib_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE
 namespace std _GLIBCXX_VISIBILITY(default)
 {
 _GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -89,5 +90,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
 _GLIBCXX_END_NAMESPACE_VERSION
 } // namespace
+#endif // cpp_lib_atomic_wait || _GLIBCXX_HAVE_POSIX_SEMAPHORE
 #endif // C++20
 #endif // _GLIBCXX_SEMAPHORE


                 reply	other threads:[~2021-04-22 13:37 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210422133731.E04F43896C18@sourceware.org \
    --to=redi@gcc.gnu.org \
    --cc=gcc-cvs@gcc.gnu.org \
    --cc=libstdc++-cvs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).