This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [c++0x] <date_time> implementation, take 5


Finally committed. Thanks again!

Paolo.

///////////////
2008-03-16  Paolo Carlini  <pcarlini@suse.de>

	* testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc:
	Update.
	* testsuite/17_intro/headers/c++200x/all.cc: Likewise.
	* include/precompiled/stdc++.h: Likewise.

2008-03-16  Pedro Lamarão  <pedro.lamarao@gmail.com>

	* include/std/date_time: New file.
	* src/date_time.cc: New file.
 	* config/abi/pre/gnu.ver: Added <date_time> symbols in version
 	GLIBCXX_3.4.11 and changed two patterns in version GLIBCXX_3.4
	that matched new symbols.
	* include/Makefile.am: Add date_time in std headers.
	* src/Makefile.am: Add date_time.cc to source files.
	* include/Makefile.in: Regenerate.
	* src/Makefile.in: Likewise.

2008-03-16  Pedro Lamarão  <pedro.lamarao@gmail.com>

      * testsuite/31_date_time/headers/date_time/types_std.cc: New.
      * testsuite/31_date_time/headers/date_time/std_c++0x_neg.cc: Likewise.
      * testsuite/31_date_time/headers/date_time/functions_std.cc: Likewise.
      * testsuite/31_date_time/headers/date_time/synopsis.cc: Likewise.
      * testsuite/31_date_time/nanoseconds/requirements/traits.cc: Likewise.
      * testsuite/31_date_time/nanoseconds/requirements/duration.cc: Likewise.
      * testsuite/31_date_time/system_time/requirements: Likewise.
      * testsuite/31_date_time/system_time/requirements/traits.cc: Likewise. 	

2008-03-16  Paolo Carlini  <pcarlini@suse.de>

	* config.h.in: Regenerate.
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 133270)
+++ src/Makefile.am	(working copy)
@@ -141,6 +141,7 @@
 	compatibility.cc \
 	complex_io.cc \
 	ctype.cc \
+	date_time.cc \
 	debug.cc \
 	functexcept.cc \
 	hash.cc \
@@ -242,6 +243,11 @@
 hashtable_c++0x.o: hashtable_c++0x.cc
 	$(CXXCOMPILE) -std=gnu++0x -c $<
 
+date_time.lo: date_time.cc
+	$(LTCXXCOMPILE) -std=gnu++0x -c $<
+date_time.o: date_time.cc
+	$(CXXCOMPILE) -std=gnu++0x -c $<
+
 if GLIBCXX_LDBL_COMPAT
 # Use special rules for compatibility-ldbl.cc compilation, as we need to
 # pass -mlong-double-64.
Index: include/precompiled/stdc++.h
===================================================================
--- include/precompiled/stdc++.h	(revision 133270)
+++ include/precompiled/stdc++.h	(working copy)
@@ -98,6 +98,7 @@
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
 #include <array>
+#include <date_time>
 #include <random>
 #include <regex>
 #include <system_error>
Index: include/Makefile.am
===================================================================
--- include/Makefile.am	(revision 133270)
+++ include/Makefile.am	(working copy)
@@ -33,6 +33,7 @@
 	${std_srcdir}/bitset \
 	${std_srcdir}/c++0x_warning.h \
 	${std_srcdir}/complex \
+	${std_srcdir}/date_time \
 	${std_srcdir}/deque \
 	${std_srcdir}/fstream \
 	${std_srcdir}/functional \
Index: testsuite/31_date_time/system_time/requirements/traits.cc
===================================================================
--- testsuite/31_date_time/system_time/requirements/traits.cc	(revision 0)
+++ testsuite/31_date_time/system_time/requirements/traits.cc	(revision 0)
@@ -0,0 +1,33 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <date_time>
+
+namespace gnu
+{
+  void
+  test_system_time_traits()
+  {
+    static_assert(std::nanoseconds::ticks_per_second == std::nanoseconds::ticks_per_second, "FIXME");
+    static_assert(std::system_time::seconds_per_tick == 0, "FIXME");
+    static_assert(std::system_time::is_subsecond == true, "FIXME");
+  }
+}
Index: testsuite/31_date_time/nanoseconds/requirements/duration.cc
===================================================================
--- testsuite/31_date_time/nanoseconds/requirements/duration.cc	(revision 0)
+++ testsuite/31_date_time/nanoseconds/requirements/duration.cc	(revision 0)
@@ -0,0 +1,50 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <date_time>
+
+namespace gnu
+{
+  bool
+  test_nanoseconds_is_duration()
+  {
+    typedef std::nanoseconds D;
+    D d;
+    D e(d);
+    d == e;
+    d < e;
+    d = e;
+
+    typedef D::tick_type tick_type;
+    tick_type t1 = D::ticks_per_second;
+    tick_type t2 = D::seconds_per_tick;
+    bool b1 = D::is_subsecond;
+    tick_type t3 = d.count();
+    -d;
+
+    d += e;
+    d -= e;
+    d *= static_cast<long>(1);
+    d /= static_cast<long>(1);
+
+    return b1 || t1 || t2 || t3;
+  }
+}
Index: testsuite/31_date_time/nanoseconds/requirements/traits.cc
===================================================================
--- testsuite/31_date_time/nanoseconds/requirements/traits.cc	(revision 0)
+++ testsuite/31_date_time/nanoseconds/requirements/traits.cc	(revision 0)
@@ -0,0 +1,33 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <date_time>
+
+namespace gnu
+{
+  void
+  test_nanoseconds_traits()
+  {
+    static_assert(std::nanoseconds::ticks_per_second == 1000L * 1000 * 1000, "FIXME");
+    static_assert(std::nanoseconds::seconds_per_tick == 0, "FIXME");
+    static_assert(std::nanoseconds::is_subsecond == true, "FIXME");
+  }
+}
Index: testsuite/31_date_time/headers/date_time/types_std.cc
===================================================================
--- testsuite/31_date_time/headers/date_time/types_std.cc	(revision 0)
+++ testsuite/31_date_time/headers/date_time/types_std.cc	(revision 0)
@@ -0,0 +1,33 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <date_time>
+
+namespace gnu
+{
+  typedef std::nanoseconds t1;
+  typedef std::microseconds t2;
+  typedef std::milliseconds t3;
+  typedef std::seconds t4;
+  typedef std::minutes t5;
+  typedef std::hours t6;
+  typedef std::system_time t7;
+}
Index: testsuite/31_date_time/headers/date_time/functions_std.cc
===================================================================
--- testsuite/31_date_time/headers/date_time/functions_std.cc	(revision 0)
+++ testsuite/31_date_time/headers/date_time/functions_std.cc	(revision 0)
@@ -0,0 +1,27 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <date_time>
+
+namespace gnu
+{
+  using std::get_system_time;
+}
Index: testsuite/31_date_time/headers/date_time/std_c++0x_neg.cc
===================================================================
--- testsuite/31_date_time/headers/date_time/std_c++0x_neg.cc	(revision 0)
+++ testsuite/31_date_time/headers/date_time/std_c++0x_neg.cc	(revision 0)
@@ -0,0 +1,24 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++98" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <date_time>  // { dg-excess-errors "In file included from" }
+
+// { dg-error "upcoming ISO" "" { target *-*-* } 36 } 
Index: testsuite/31_date_time/headers/date_time/synopsis.cc
===================================================================
--- testsuite/31_date_time/headers/date_time/synopsis.cc	(revision 0)
+++ testsuite/31_date_time/headers/date_time/synopsis.cc	(revision 0)
@@ -0,0 +1,70 @@
+// { dg-do compile }
+// { dg-options "-std=gnu++0x" }
+
+// Copyright (C) 2008 Free Software Foundation, Inc.
+//
+// This file is part of the GNU ISO C++ Library.  This library is free
+// software; you can redistribute it and/or modify it under the
+// terms of the GNU General Public License as published by the
+// Free Software Foundation; either version 2, or (at your option)
+// any later version.
+
+// This library is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+// GNU General Public License for more details.
+
+// You should have received a copy of the GNU General Public License along
+// with this library; see the file COPYING.  If not, write to the Free
+// Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
+// USA.
+
+#include <date_time>
+
+namespace std {
+  // duration types
+  class nanoseconds;
+  class microseconds;
+  class milliseconds;
+  class seconds;
+  class minutes;
+  class hours;
+
+  // timepoint type
+  class system_time;
+
+  // non-member functions
+  system_time get_system_time();
+
+  template<typename Duration>
+    system_time operator+(const Duration& td, const system_time& rhs);
+
+  template <class LhsDuration, class RhsDuration>
+    bool operator==(const LhsDuration& lhs, const RhsDuration& rhs);
+  template <class LhsDuration, class RhsDuration>
+    bool operator!=(const LhsDuration& lhs, const RhsDuration& rhs);
+
+  template <class LhsDuration, class RhsDuration>
+    bool operator< (const LhsDuration& lhs, const RhsDuration& rhs);
+  template <class LhsDuration, class RhsDuration>
+    bool operator<=(const LhsDuration& lhs, const RhsDuration& rhs);
+  template <class LhsDuration, class RhsDuration>
+    bool operator> (const LhsDuration& lhs, const RhsDuration& rhs);
+  template <class LhsDuration, class RhsDuration>
+    bool operator>=(const LhsDuration& lhs, const RhsDuration& rhs);
+
+/*
+  template <class LhsDuration, class RhsDuration>
+    FinestDuration operator+(const LhsDuration& lhs, const RhsDuration& rhs);
+  template <class LhsDuration, class RhsDuration>
+    FinestDuration operator-(const LhsDuration& lhs, const RhsDuration& rhs);
+*/
+  
+  template <class Duration>
+    Duration operator*(Duration lhs, long rhs);
+  template <class Duration>
+    Duration operator*(long lhs, Duration rhs);
+
+  template <class Duration>
+    Duration operator/(Duration lhs, long rhs);
+}
Index: testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc
===================================================================
--- testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc	(revision 133270)
+++ testsuite/17_intro/headers/c++200x/all_multiple_inclusion.cc	(working copy)
@@ -1,7 +1,7 @@
 // { dg-options "-std=gnu++0x" }
 // { dg-do compile }
 
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -94,6 +94,7 @@
 #include <array>
 #include <bitset>
 #include <complex>
+#include <date_time>
 #include <deque>
 #include <exception>
 #include <fstream>
@@ -204,6 +205,7 @@
 #include <array>
 #include <bitset>
 #include <complex>
+#include <date_time>
 #include <deque>
 #include <exception>
 #include <fstream>
Index: testsuite/17_intro/headers/c++200x/all.cc
===================================================================
--- testsuite/17_intro/headers/c++200x/all.cc	(revision 133270)
+++ testsuite/17_intro/headers/c++200x/all.cc	(working copy)
@@ -1,7 +1,7 @@
 // { dg-options "-std=gnu++0x" }
 // { dg-do compile }
 
-// Copyright (C) 2007 Free Software Foundation, Inc.
+// Copyright (C) 2007, 2008 Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the
@@ -94,6 +94,7 @@
 #include <array>
 #include <bitset>
 #include <complex>
+#include <date_time>
 #include <deque>
 #include <exception>
 #include <fstream>
Index: config.h.in
===================================================================
--- config.h.in	(revision 133270)
+++ config.h.in	(working copy)
@@ -66,6 +66,9 @@
 /* Define if ECANCELED exists. */
 #undef HAVE_ECANCELED
 
+/* Define if EIDRM exists. */
+#undef HAVE_EIDRM
+
 /* Define to 1 if you have the <endian.h> header file. */
 #undef HAVE_ENDIAN_H
 
@@ -99,6 +102,9 @@
 /* Define if ETIME exists. */
 #undef HAVE_ETIME
 
+/* Define if ETXTBSY exists. */
+#undef HAVE_ETXTBSY
+
 /* Define to 1 if you have the `expf' function. */
 #undef HAVE_EXPF
 
Index: config/abi/pre/gnu.ver
===================================================================
--- config/abi/pre/gnu.ver	(revision 133270)
+++ config/abi/pre/gnu.ver	(working copy)
@@ -60,7 +60,9 @@
 #     std::c[i-z]*;
       std::c[i-s]*;
       std::c[u-z]*;
-      std::[d-g]*;
+#     std::[d-g]*;
+      std::[d-e]*;
+      std::gslice*;
       std::h[^a]*;
       std::i[a-n]*;
       std::ios_base::[A-Ha-z]*;
@@ -95,7 +97,8 @@
       std::locale::_[T-Za-z]*;
 #     std::[A-Zm-r]*;
       std::[A-Zm]*;
-      std::n[^u]*;
+#     std::n[^u]*;
+      std::n[^au]*;
       std::nu[^m]*;
       std::num[^e]*;
       std::[p-r]*;
@@ -804,6 +807,17 @@
 
     _ZNKSt4hashISt10error_codeEclES0_;
 
+    # date_time
+    _ZSt15get_system_timev;
+ 
+    _ZNSt11nanoseconds16seconds_per_tickE;
+    _ZNSt11nanoseconds16ticks_per_secondE;
+    _ZNSt11nanoseconds12is_subsecondE;
+
+    _ZNSt11system_time16seconds_per_tickE;
+    _ZNSt11system_time16ticks_per_secondE;
+    _ZNSt11system_time12is_subsecondE;
+
 } GLIBCXX_3.4.10;
 
 # Symbols in the support library (libsupc++) have their own tag.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]