http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54847



--- Comment #27 from Jack Howarth <howarth at nitro dot med.uc.edu> 2012-10-08 
13:47:32 UTC ---

The unistd.h header on darwin12 defines...



#define _POSIX_TIMERS                   (-1)            /* [TMR] */



>From the documentation on --enable-libstdcxx-time...



dnl Check for clock_gettime, nanosleep and sched_yield, used in the

dnl implementation of 20.11.7 [time.clock], and 30.3.2 [thread.thread.this]

dnl in the C++11 standard.

dnl

dnl --enable-libstdcxx-time

dnl --enable-libstdcxx-time=yes

dnl        checks for the availability of monotonic and realtime clocks,

dnl        nanosleep and sched_yield in libc and libposix4 and, if needed,

dnl        links in the latter.

dnl --enable-libstdcxx-time=rt

dnl        also searches (and, if needed, links) librt.  Note that this is

dnl        not always desirable because, in glibc, for example, in turn it

dnl        triggers the linking of libpthread too, which activates locking,

dnl        a large overhead for single-thread programs.

dnl --enable-libstdcxx-time=no

dnl --disable-libstdcxx-time

dnl        disables the checks completely



it seems that --enable-libstdcxx-time defaults to 'no' which would seem to

imply that it is effectively --disable-libstdcxx-time. The

--enable-libstdcxx-time=yes check is too strict for darwin because it doesn't

handle the case of _POSIX_TIMER defined to -1 for testing pre-POSIX 2008

nanosleep(). What would you consider to be an acceptable change to the test

at...



      AC_MSG_CHECKING([for nanosleep])

      AC_TRY_LINK(

        [#include <unistd.h>

         #include <time.h>

        ],

        [#if _POSIX_TIMERS > 0

          timespec tp;

         #endif

          nanosleep(&tp, 0);

        ], [ac_has_nanosleep=yes], [ac_has_nanosleep=no])



      AC_MSG_RESULT($ac_has_nanosleep)



in libstdc++-v3/acinclude.m4 to solve this limitation? Again I would note that

short-circuiting this test for  _POSIX_TIMERS > 0 introduces no regressions in

the libstdc++-v3 test suite so the darwin nanosleep() appears to be sufficient.

Or is the libstdc++-v3 testsuite currently incapable of properly testing this

feature?

Reply via email to