[PATCH] Backport PR libstdc++/54847 fix to gcc-4_7-branch
Jack Howarth
howarth@bromo.med.uc.edu
Sat Apr 13 00:07:00 GMT 2013
The attached patch backports r192335 from gcc trunk for the gcc 4.7.4 release.
Tested on i386-apple-darwin10, x86_64-apple-darwin10, x86_64-apple-darwin11 and
x86_64-apple-darwin12. Okay for gcc-4_7-branch?
Jack
-------------- next part --------------
2013-04-12 Jack Howarth <howarth@bromo.med.uc.edu>
Backport from mainline
2012-10-10 Jack Howarth <howarth@bromo.med.uc.edu>
Jonathan Wakely <jwakely.gcc@gmail.com>
PR libstdc++/54847
* config/os/bsd/darwin/os_defines.h: Define _GLIBCXX_USE_NANOSLEEP
and _GLIBCXX_USE_SCHED_YIELD.
* acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Add comment.
Index: libstdc++-v3/config/os/bsd/darwin/os_defines.h
===================================================================
--- libstdc++-v3/config/os/bsd/darwin/os_defines.h (revision 197937)
+++ libstdc++-v3/config/os/bsd/darwin/os_defines.h (working copy)
@@ -42,4 +42,9 @@
// Static initializer macro is buggy in darwin, see libstdc++/51906
#define _GTHREAD_USE_RECURSIVE_MUTEX_INIT_FUNC
+// Configure checks for nanosleep fail on Darwin, but nanosleep and
+// sched_yield are always available, so use them.
+#define _GLIBCXX_USE_NANOSLEEP 1
+#define _GLIBCXX_USE_SCHED_YIELD 1
+
#endif
Index: libstdc++-v3/acinclude.m4
===================================================================
--- libstdc++-v3/acinclude.m4 (revision 197937)
+++ libstdc++-v3/acinclude.m4 (working copy)
@@ -1132,6 +1132,11 @@ dnl --enable-libstdcxx-time=no
dnl --disable-libstdcxx-time
dnl disables the checks completely
dnl
+dnl N.B. Darwin provides nanosleep but doesn't support the whole POSIX
+dnl Timers option, so doesn't define _POSIX_TIMERS. Because the test
+dnl below fails Darwin unconditionally defines _GLIBCXX_USE_NANOSLEEP in
+dnl os_defines.h and also defines _GLIBCXX_USE_SCHED_YIELD.
+dnl
AC_DEFUN([GLIBCXX_ENABLE_LIBSTDCXX_TIME], [
AC_MSG_CHECKING([for clock_gettime, nanosleep and sched_yield])
More information about the Libstdc++
mailing list