This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: [patch] Default to --enable-libstdcxx-time=auto
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Steve Ellcey <sellcey at imgtec dot com>
- Cc: "libstdc++" <libstdc++ at gcc dot gnu dot org>, gcc-patches <gcc-patches at gcc dot gnu dot org>, Jakub Jelinek <jakub at redhat dot com>, Benjamin Kosnik <bkoz at redhat dot com>
- Date: Tue, 28 May 2013 17:29:38 +0100
- Subject: Re: [patch] Default to --enable-libstdcxx-time=auto
- References: <CAH6eHdTgTspzbfHhD3uDwDVD3uXAapb_NMZ0jAZ-4-UjfD4H4g at mail dot gmail dot com> <1369757459 dot 12204 dot 4 dot camel at ubuntu-sellcey>
On 28 May 2013 17:10, Steve Ellcey wrote:
> On Wed, 2013-05-22 at 09:14 +0100, Jonathan Wakely wrote:
>> This alters the configure script to enable C++11 thread library
>> features based on targets that are known to support the features,
>> rather than based on link tests which are disabled by default. With
>> Glibc 2.17 this enables a nanosecond resolution std::system_clock in
>> the default configuration, yay!
>>
>> I've tested this on two versions of Fedora and Debian, but would be
>> grateful for test results on Solaris, Cygwin and BSD targets, and for
>> cross-compilers to any of those targets.
>>
>> * acinclude.m4 (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Add KIND=auto to
>> enable features if target OS is known to support them.
>> * configure.ac (GLIBCXX_ENABLE_LIBSTDCXX_TIME): Default to 'auto'.
>> * configure: Regenerate.
>>
>>
>> Tested x86_64-linux, committed to trunk.
>
> Jonathan,
>
> This has broken the mips-mti-elf build for me,
I don't think it was my patch that broke it, because
compatibility-chrono.cc didn't exist when my patch went in :-)
> this target uses newlib
> and I am building with the latest newlib sources as well as the latest
> GCC sources. I don't know if this is related to the problem that others
> have had or not. I saw emails about test failures but not about build
> failures. The problem I get when building a x86 to mips cross compiler
> is:
>
> /local/home/sellcey/nightly2/src/gcc/libstdc++-v3/src/c++11/compatibility-chrono.cc: In static member function 'static std::chrono::system_clock::time_point std::chrono::system_clock::now()':
> /local/home/sellcey/nightly2/src/gcc/libstdc++-v3/src/c++11/compatibility-chrono.cc:81:14: error: 'from_time_t' is not a member of 'std::chrono::system_clock'
> return system_clock::from_time_t(__sec);
> ^
> /local/home/sellcey/nightly2/src/gcc/libstdc++-v3/src/c++11/compatibility-chrono.cc:83:5: warning: control reaches end of non-void function [-Wreturn-type]
> }
>
> I will dig around some more but I thought I would see if you had any
> ideas on what the problem was and how to fix it.
Does this help?
--- src/c++11/compatibility-chrono.cc.orig 2013-05-28
17:27:54.631919423 +0100
+++ src/c++11/compatibility-chrono.cc 2013-05-28 17:28:43.697861786 +0100
@@ -78,7 +78,9 @@
+ chrono::microseconds(tv.tv_usec)));
#else
std::time_t __sec = std::time(0);
- return system_clock::from_time_t(__sec);
+ typedef chrono::time_point<system_clock, seconds> __from;
+ return time_point_cast<system_clock::duration>
+ (__from(chrono::seconds(__sec)));
#endif
}