summaryrefslogtreecommitdiffstats
path: root/libstdc++-v3/src
diff options
context:
space:
mode:
authorbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-25 23:02:54 +0000
committerbkoz <bkoz@138bc75d-0d04-0410-961f-82ee72b054a4>2013-05-25 23:02:54 +0000
commitb354b404d1873970b34ff786f03640064d402d47 (patch)
tree29f1664d4c5890a8f921b8157d23745b9f59535a /libstdc++-v3/src
parente0462563efccdaa56527d3ffd9546152c8b9117d (diff)
downloadppe42-gcc-b354b404d1873970b34ff786f03640064d402d47.tar.gz
ppe42-gcc-b354b404d1873970b34ff786f03640064d402d47.zip
2013-05-24 Benjamin Kosnik <bkoz@redhat.com>
* include/std/chrono: Wrap clocks in inline namespace _V2. * src/c++11/chrono.cc: Same. * src/c++11/compatibility-chrono.cc: Revert to previous chrono.cc file, with default configure macros selected. * config/abi/pre/gnu.ver (GLIBCXX_3.4.19): Use symbols from inline namespace. * config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Fix up. * config/abi/post/i386-linux-gnu/baseline_symbols.txt: Regenerated. * config/abi/post/s390x-linux-gnu/baseline_symbols.txt: Regenerated. * config/abi/post/powerpc64-linux-gnu/baseline_symbols.txt: Regenerated. * config/abi/post/powerpc64-linux-gnu/32/baseline_symbols.txt: Regenerated. * config/abi/post/x86_64-linux-gnu/baseline_symbols.txt: Regenerated. * config/abi/post/x86_64-linux-gnu/32/baseline_symbols.txt: Regenerated. * config/abi/post/powerpc-linux-gnu/baseline_symbols.txt: Regenerated. * config/abi/post/s390-linux-gnu/baseline_symbols.txt: Regenerated. * config/abi/post/i486-linux-gnu/baseline_symbols.txt: Regenerated. * config/abi/post/solaris2.10/baseline_symbols.txt: Regenerated. * config/abi/post/solaris2.10/amd64/baseline_symbols.txt: Regenerated. * config/abi/post/solaris2.10/sparcv9/baseline_symbols.txt: Regenerated. * config/abi/post/solaris2.9/baseline_symbols.txt: Regenerated. * config/abi/post/solaris2.9/sparcv9/baseline_symbols.txt: Regenerated. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@199331 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libstdc++-v3/src')
-rw-r--r--libstdc++-v3/src/c++11/chrono.cc31
-rw-r--r--libstdc++-v3/src/c++11/compatibility-chrono.cc87
2 files changed, 67 insertions, 51 deletions
diff --git a/libstdc++-v3/src/c++11/chrono.cc b/libstdc++-v3/src/c++11/chrono.cc
index 15de4eb8767..ca10fb36881 100644
--- a/libstdc++-v3/src/c++11/chrono.cc
+++ b/libstdc++-v3/src/c++11/chrono.cc
@@ -23,28 +23,17 @@
// <http://www.gnu.org/licenses/>.
#include <bits/c++config.h>
-
-#ifndef _GLIBCXX_USE_CLOCK_MONOTONIC
-// If !_GLIBCXX_USE_CLOCK_MONOTONIC, std::chrono::steady_clock
-// is just a typedef to std::chrono::system_clock, for ABI compatibility
-// force it not to be a typedef now and export it anyway. Programs
-// using the headers where it is a typedef will actually just use
-// std::chrono::system_clock instead, and this remains here just as a fallback.
-#define _GLIBCXX_USE_CLOCK_MONOTONIC
-#include <chrono>
-#undef _GLIBCXX_USE_CLOCK_MONOTONIC
-#else
#include <chrono>
-#endif
#ifdef _GLIBCXX_USE_C99_STDINT_TR1
-// conditional inclusion of sys/time.h for gettimeofday
+// Conditional inclusion of sys/time.h for gettimeofday
#if !defined(_GLIBCXX_USE_CLOCK_MONOTONIC) && \
!defined(_GLIBCXX_USE_CLOCK_REALTIME) && \
defined(_GLIBCXX_USE_GETTIMEOFDAY)
#include <sys/time.h>
#endif
+
#ifdef _GLIBCXX_USE_CLOCK_GETTIME_SYSCALL
#include <unistd.h>
#include <sys/syscall.h>
@@ -56,7 +45,9 @@ namespace std _GLIBCXX_VISIBILITY(default)
{
_GLIBCXX_BEGIN_NAMESPACE_VERSION
-#ifndef _GLIBCXX_COMPATIBILITY_CXX0X
+ // XXX GLIBCXX_ABI Deprecated
+ inline namespace _V2 {
+
constexpr bool system_clock::is_steady;
system_clock::time_point
@@ -83,18 +74,10 @@ namespace std _GLIBCXX_VISIBILITY(default)
return system_clock::from_time_t(__sec);
#endif
}
-#endif
+
-#ifndef _GLIBCXX_COMPATIBILITY_CXX0X
constexpr bool steady_clock::is_steady;
-#endif
-#if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \
- && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE) \
- && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT) \
- && !defined(_GLIBCXX_COMPATIBILITY_CXX0X)
- __attribute__((__weak__))
-#endif
steady_clock::time_point
steady_clock::now() noexcept
{
@@ -113,6 +96,8 @@ namespace std _GLIBCXX_VISIBILITY(default)
#endif
}
+ } // end inline namespace _V2
+
_GLIBCXX_END_NAMESPACE_VERSION
} // namespace chrono
} // namespace std
diff --git a/libstdc++-v3/src/c++11/compatibility-chrono.cc b/libstdc++-v3/src/c++11/compatibility-chrono.cc
index ada0946619b..fd67daec4c5 100644
--- a/libstdc++-v3/src/c++11/compatibility-chrono.cc
+++ b/libstdc++-v3/src/c++11/compatibility-chrono.cc
@@ -22,37 +22,68 @@
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
-#define _GLIBCXX_COMPATIBILITY_CXX0X
#include <bits/c++config.h>
-#if defined(_GLIBCXX_SYMVER_GNU) && defined(_GLIBCXX_SHARED) \
- && defined(_GLIBCXX_HAVE_AS_SYMVER_DIRECTIVE)\
- && defined(_GLIBCXX_HAVE_SYMVER_SYMBOL_RENAMING_RUNTIME_SUPPORT)
+#ifdef _GLIBCXX_USE_C99_STDINT_TR1
+#ifdef _GLIBCXX_USE_GETTIMEOFDAY
+#include <sys/time.h>
+#endif
+
+#define system_clock system_clockXX
#define steady_clock steady_clockXX
-#include "chrono.cc"
-
-// The rename syntax for default exported names is
-// asm (".symver name1,exportedname@GLIBCXX_3.4.17")
-// asm (".symver name2,exportedname@@GLIBCXX_3.4.19")
-// In the future, GLIBCXX_ABI > 6 should remove all uses of
-// _GLIBCXX_*_SYMVER macros in this file.
-
-#define _GLIBCXX_3_4_17_SYMVER(XXname, name) \
- extern "C" void \
- _X##name() \
- __attribute__ ((alias(#XXname))); \
- asm (".symver " "_X" #name "," #name "@GLIBCXX_3.4.17");
-
-#define _GLIBCXX_3_4_19_SYMVER(XXname, name) \
- extern "C" void \
- _Y##name() \
- __attribute__ ((alias(#XXname))); \
- asm (".symver " "_Y" #name "," #name "@@GLIBCXX_3.4.19");
-
-_GLIBCXX_3_4_17_SYMVER(_ZNSt6chrono14steady_clockXX3nowEv,
- _ZNSt6chrono12steady_clock3nowEv)
-_GLIBCXX_3_4_19_SYMVER(_ZNSt6chrono14steady_clockXX3nowEv,
- _ZNSt6chrono12steady_clock3nowEv)
+#include <chrono>
+#undef system_clock
+#undef steady_clock
+namespace std _GLIBCXX_VISIBILITY(default)
+{
+ namespace chrono
+ {
+ _GLIBCXX_BEGIN_NAMESPACE_VERSION
+
+ // NB: Default configuration was no realtime.
+ struct system_clock
+ {
+#ifdef _GLIBCXX_USE_GETTIMEOFDAY
+ typedef chrono::microseconds duration;
+#else
+ typedef chrono::seconds duration;
#endif
+
+ typedef duration::rep rep;
+ typedef duration::period period;
+ typedef chrono::time_point<system_clock, duration> time_point;
+
+ static_assert(system_clock::duration::min()
+ < system_clock::duration::zero(),
+ "a clock's minimum duration cannot be less than its epoch");
+
+ static constexpr bool is_steady = false;
+
+ static time_point
+ now() noexcept;
+ };
+
+ constexpr bool system_clock::is_steady;
+
+ system_clock::time_point
+ system_clock::now() noexcept
+ {
+#ifdef _GLIBCXX_USE_GETTIMEOFDAY
+ timeval tv;
+ // EINVAL, EFAULT
+ gettimeofday(&tv, 0);
+ return time_point(duration(chrono::seconds(tv.tv_sec)
+ + chrono::microseconds(tv.tv_usec)));
+#else
+ std::time_t __sec = std::time(0);
+ return system_clock::from_time_t(__sec);
+#endif
+ }
+
+ _GLIBCXX_END_NAMESPACE_VERSION
+ } // namespace chrono
+} // namespace std
+
+#endif // _GLIBCXX_USE_C99_STDINT_TR1
OpenPOWER on IntegriCloud