Message ID | 20241009124248.579260-1-jwakely@redhat.com |
---|---|
State | New |
Headers | show |
Series | [committed] libstdc++: Ignore _GLIBCXX_USE_POSIX_SEMAPHORE if not supported [PR116992] | expand |
diff --git a/libstdc++-v3/include/bits/semaphore_base.h b/libstdc++-v3/include/bits/semaphore_base.h index 9d73b37e60a..dd16d2c9249 100644 --- a/libstdc++-v3/include/bits/semaphore_base.h +++ b/libstdc++-v3/include/bits/semaphore_base.h @@ -45,6 +45,9 @@ # include <cerrno> // errno, EINTR, EAGAIN etc. # include <limits.h> // SEM_VALUE_MAX # include <semaphore.h> // sem_t, sem_init, sem_wait, sem_post etc. +#elif defined(_GLIBCXX_USE_POSIX_SEMAPHORE) +# warning "POSIX semaphore not available, ignoring _GLIBCXX_USE_POSIX_SEMAPHORE" +# undef _GLIBCXX_USE_POSIX_SEMAPHORE #endif namespace std _GLIBCXX_VISIBILITY(default) diff --git a/libstdc++-v3/testsuite/30_threads/semaphore/platform_try_acquire_for.cc b/libstdc++-v3/testsuite/30_threads/semaphore/platform_try_acquire_for.cc index bf6cd142bf0..6d90564ea8a 100644 --- a/libstdc++-v3/testsuite/30_threads/semaphore/platform_try_acquire_for.cc +++ b/libstdc++-v3/testsuite/30_threads/semaphore/platform_try_acquire_for.cc @@ -5,3 +5,5 @@ // { dg-add-options libatomic } #include "try_acquire_for.cc" + +// { dg-prune-output "ignoring _GLIBCXX_USE_POSIX_SEMAPHORE" }