aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/config.h.in
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2020-12-09 16:53:18 +0000
committerJonathan Wakely <jwakely@redhat.com>2020-12-09 16:56:54 +0000
commit0aa1786d34b891c8e1e219fb11255af5358013c4 (patch)
treeffcd99b767bd68d2d519d0e697977203496133f0 /libstdc++-v3/config.h.in
parent84d08255f9f2f7137caf648fcc9dc36101bc893c (diff)
downloadgcc-0aa1786d34b891c8e1e219fb11255af5358013c4.zip
gcc-0aa1786d34b891c8e1e219fb11255af5358013c4.tar.gz
gcc-0aa1786d34b891c8e1e219fb11255af5358013c4.tar.bz2
libstdc++: Fix build failure for target with no way to sleep
In previous releases the std::this_thread::sleep_for function was only declared if the target supports multiple threads. I changed that recently in r11-2649-g5bbb1f3000c57fd4d95969b30fa0e35be6d54ffb so that sleep_for could be used single-threaded. But that means that targets using --disable-threads are now required to provide some way to sleep. This breaks the build for (at least) AVR when trying to build a hosted library. This patch adds a new autoconf macro that is defined when no way to sleep is available, and uses that to suppress the sleeping functions in std::this_thread. The #error in src/c++11/thread.cc is retained for the case where there is no sleep function available but multiple threads are supported. This is consistent with previous releases, but that #error could probably be removed without any consequences. libstdc++-v3/ChangeLog: * acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Define NO_SLEEP if none of nanosleep, sleep and Sleep is available. * config.h.in: Regenerate. * configure: Regenerate. * include/std/thread [_GLIBCXX_NO_SLEEP] (__sleep_for): Do not declare. [_GLIBCXX_NO_SLEEP] (sleep_for, sleep_until): Do not define. * src/c++11/thread.cc [_GLIBCXX_NO_SLEEP] (__sleep_for): Do not define.
Diffstat (limited to 'libstdc++-v3/config.h.in')
-rw-r--r--libstdc++-v3/config.h.in3
1 files changed, 3 insertions, 0 deletions
diff --git a/libstdc++-v3/config.h.in b/libstdc++-v3/config.h.in
index 72faabf..17b1199 100644
--- a/libstdc++-v3/config.h.in
+++ b/libstdc++-v3/config.h.in
@@ -767,6 +767,9 @@
*/
#undef LT_OBJDIR
+/* Defined if no way to sleep is available. */
+#undef NO_SLEEP
+
/* Name of package */
#undef PACKAGE