Skip to content

Commit ce4a0ab

Browse files
committed
Revert "libstdc++-v3: add support for --enable-libstdcxx-time=c11"
This reverts commit 47b9276. Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
1 parent b016c34 commit ce4a0ab

File tree

4 files changed

+5
-71
lines changed

4 files changed

+5
-71
lines changed

libstdc++-v3/acinclude.m4

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1320,8 +1320,6 @@ dnl not always desirable because, in glibc 2.16 and earlier, for
13201320
dnl example, in turn it triggers the linking of libpthread too,
13211321
dnl which activates locking,
13221322
dnl a large overhead for single-thread programs.
1323-
dnl --enable-libstdcxx-time=c11
1324-
dnl checks for the availability of <threads.h> and thrd_sleep in libc.
13251323
dnl --enable-libstdcxx-time=no
13261324
dnl --disable-libstdcxx-time
13271325
dnl disables the checks completely
@@ -1335,7 +1333,7 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
13351333
13361334
GLIBCXX_ENABLE(libstdcxx-time,auto,[[[=KIND]]],
13371335
[use KIND for check type],
1338-
[permit yes|no|rt|c11])
1336+
[permit yes|no|rt])
13391337
13401338
AC_LANG_SAVE
13411339
AC_LANG_CPLUSPLUS
@@ -1347,9 +1345,6 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
13471345
ac_has_clock_realtime=no
13481346
ac_has_nanosleep=no
13491347
ac_has_sched_yield=no
1350-
ac_has_thrd_sleep=no
1351-
1352-
AC_CHECK_HEADERS(threads.h, ac_has_threads_h=yes, ac_has_threads_h=no)
13531348
13541349
if test x"$enable_libstdcxx_time" = x"auto"; then
13551350
@@ -1401,20 +1396,11 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
14011396
ac_has_sched_yield=yes
14021397
esac
14031398
1404-
elif test x"$enable_libstdcxx_time" = x"c11"; then
1405-
1406-
# workaround for the error below until ac_cv_func_thrd_sleep is available when cross-compiling
1407-
# checking for library containing thrd_sleep...
1408-
# configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
1409-
ac_has_thrd_sleep=yes
1410-
14111399
elif test x"$enable_libstdcxx_time" != x"no"; then
14121400
14131401
if test x"$enable_libstdcxx_time" = x"rt"; then
14141402
AC_SEARCH_LIBS(clock_gettime, [rt])
14151403
AC_SEARCH_LIBS(nanosleep, [rt])
1416-
elif test x"$enable_libstdcxx_time" = x"c11"; then
1417-
AC_CHECK_FUNC(thrd_sleep)
14181404
else
14191405
AC_CHECK_FUNC(clock_gettime)
14201406
AC_CHECK_FUNC(nanosleep)
@@ -1551,9 +1537,6 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
15511537
if test x"$ac_has_nanosleep" = x"yes"; then
15521538
AC_DEFINE(_GLIBCXX_USE_NANOSLEEP, 1,
15531539
[ Defined if nanosleep is available. ])
1554-
elif test x"$ac_has_thrd_sleep" = x"yes"; then
1555-
AC_DEFINE(_GLIBCXX_USE_THRD_SLEEP, 1,
1556-
[ Defined if thrd_sleep is available. ])
15571540
else
15581541
AC_MSG_CHECKING([for sleep])
15591542
AC_TRY_COMPILE([#include <unistd.h>],
@@ -1574,7 +1557,7 @@ AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
15741557
AC_MSG_RESULT($ac_has_usleep)
15751558
fi
15761559
1577-
if test x"$ac_has_nanosleep$ac_has_sleep$ac_has_thrd_sleep" = x"nonono"; then
1560+
if test x"$ac_has_nanosleep$ac_has_sleep" = x"nono"; then
15781561
ac_no_sleep=yes
15791562
AC_MSG_CHECKING([for Sleep])
15801563
AC_TRY_COMPILE([#include <windows.h>],

libstdc++-v3/configure

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -20493,7 +20493,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
2049320493
if test "${enable_libstdcxx_time+set}" = set; then :
2049420494
enableval=$enable_libstdcxx_time;
2049520495
case "$enableval" in
20496-
yes|no|rt|c11) ;;
20496+
yes|no|rt) ;;
2049720497
*) as_fn_error $? "Unknown argument to enable/disable libstdcxx-time" "$LINENO" 5 ;;
2049820498
esac
2049920499

@@ -20518,21 +20518,6 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
2051820518
ac_has_clock_realtime=no
2051920519
ac_has_nanosleep=no
2052020520
ac_has_sched_yield=no
20521-
ac_has_thrd_sleep=no
20522-
20523-
for ac_header in threads.h
20524-
do :
20525-
ac_fn_cxx_check_header_mongrel "$LINENO" "threads.h" "ac_cv_header_threads_h" "$ac_includes_default"
20526-
if test "x$ac_cv_header_threads_h" = xyes; then :
20527-
cat >>confdefs.h <<_ACEOF
20528-
#define HAVE_THREADS_H 1
20529-
_ACEOF
20530-
ac_has_threads_h=yes
20531-
else
20532-
ac_has_threads_h=no
20533-
fi
20534-
20535-
done
2053620521

2053720522
if test x"$enable_libstdcxx_time" = x"auto"; then
2053820523

@@ -20642,13 +20627,6 @@ fi
2064220627
ac_has_sched_yield=yes
2064320628
esac
2064420629

20645-
elif test x"$enable_libstdcxx_time" = x"c11"; then
20646-
20647-
# workaround for the error below until ac_cv_func_thrd_sleep is available when cross-compiling
20648-
# checking for library containing thrd_sleep...
20649-
# configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
20650-
ac_has_thrd_sleep=yes
20651-
2065220630
elif test x"$enable_libstdcxx_time" != x"no"; then
2065320631

2065420632
if test x"$enable_libstdcxx_time" = x"rt"; then
@@ -20770,11 +20748,6 @@ if test "$ac_res" != no; then :
2077020748

2077120749
fi
2077220750

20773-
elif test x"$enable_libstdcxx_time" = x"c11"; then
20774-
ac_fn_cxx_check_func "$LINENO" "thrd_sleep" "ac_cv_func_thrd_sleep"
20775-
if test "x$ac_cv_func_thrd_sleep" = xyes; then :
20776-
20777-
fi
2077820751
else
2077920752
ac_fn_cxx_check_func "$LINENO" "clock_gettime" "ac_cv_func_clock_gettime"
2078020753
if test "x$ac_cv_func_clock_gettime" = xyes; then :
@@ -21085,10 +21058,6 @@ $as_echo "#define _GLIBCXX_USE_SCHED_YIELD 1" >>confdefs.h
2108521058

2108621059
$as_echo "#define _GLIBCXX_USE_NANOSLEEP 1" >>confdefs.h
2108721060

21088-
elif test x"$ac_has_thrd_sleep" = x"yes"; then
21089-
21090-
$as_echo "#define _GLIBCXX_USE_THRD_SLEEP 1" >>confdefs.h
21091-
2109221061
else
2109321062
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sleep" >&5
2109421063
$as_echo_n "checking for sleep... " >&6; }
@@ -21145,7 +21114,7 @@ $as_echo "#define HAVE_USLEEP 1" >>confdefs.h
2114521114
$as_echo "$ac_has_usleep" >&6; }
2114621115
fi
2114721116

21148-
if test x"$ac_has_nanosleep$ac_has_sleep$ac_has_thrd_sleep" = x"nonono"; then
21117+
if test x"$ac_has_nanosleep$ac_has_sleep" = x"nono"; then
2114921118
ac_no_sleep=yes
2115021119
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for Sleep" >&5
2115121120
$as_echo_n "checking for Sleep... " >&6; }

libstdc++-v3/include/bits/this_thread_sleep.h

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,6 @@
4040
# include <time.h> // nanosleep
4141
#endif
4242

43-
#ifdef _GLIBCXX_USE_THRD_SLEEP
44-
#include <threads.h>
45-
#endif
46-
4743
namespace std _GLIBCXX_VISIBILITY(default)
4844
{
4945
_GLIBCXX_BEGIN_NAMESPACE_VERSION
@@ -61,7 +57,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
6157
{
6258
#ifndef _GLIBCXX_NO_SLEEP
6359

64-
#if !(defined(_GLIBCXX_USE_NANOSLEEP) || defined(_GLIBCXX_USE_THRD_SLEEP))
60+
#ifndef _GLIBCXX_USE_NANOSLEEP
6561
void
6662
__sleep_for(chrono::seconds, chrono::nanoseconds);
6763
#endif
@@ -83,13 +79,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
8379
};
8480
while (::nanosleep(&__ts, &__ts) == -1 && errno == EINTR)
8581
{ }
86-
#elif defined(_GLIBCXX_USE_THRD_SLEEP)
87-
struct ::timespec __ts =
88-
{
89-
static_cast<std::time_t>(__s.count()),
90-
static_cast<long>(__ns.count())
91-
};
92-
::thrd_sleep(&__ts, &__ts);
9382
#else
9483
__sleep_for(__s, __ns);
9584
#endif

libstdc++-v3/src/c++11/thread.cc

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,6 @@ namespace this_thread
214214
};
215215
while (::nanosleep(&__ts, &__ts) == -1 && errno == EINTR)
216216
{ }
217-
#elif defined(_GLIBCXX_HAVE_THRD_SLEEP)
218-
struct ::timespec __ts =
219-
{
220-
static_cast<std::time_t>(__s.count()),
221-
static_cast<long>(__ns.count())
222-
};
223-
::thrd_sleep(&__ts, &__ts);
224217
#elif defined(_GLIBCXX_HAVE_SLEEP)
225218
const auto target = chrono::steady_clock::now() + __s + __ns;
226219
while (true)

0 commit comments

Comments
 (0)