This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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: [PATCH] Initial commit of Networking TS implementation


On 16/10/18 17:12 +0100, Jonathan Wakely wrote:
On 16/10/18 16:36 +0100, Jonathan Wakely wrote:
On 16/10/18 16:24 +0100, Jonathan Wakely wrote:
On 12/10/18 11:50 +0100, Jonathan Wakely wrote:
This implementation is very incomplete (see the various TODO comments
in the code) but rather than keeping it out of tree any longer I'm
committing it to trunk. This will allow others to experiment with it
and (I hope) work on finishing it. Either way we'll ship somehing for
gcc 9. It works OK for some synchronous operations, but most of the
async ops are not done yet.

	* include/Makefile.am: Add new headers.
	* include/Makefile.in: Regenerate.
	* include/experimental/bits/net.h: New header for common
	implementation details of Networking TS.
	* include/experimental/buffer: New header.
	* include/experimental/executor: New header.
	* include/experimental/internet: New header.
	* include/experimental/io_context: New header.
	* include/experimental/net: New header.
	* include/experimental/netfwd: New header.
	* include/experimental/socket: New header.
	* include/experimental/timer: New header.
	* testsuite/experimental/net/buffer/arithmetic.cc: New test.
	* testsuite/experimental/net/buffer/const.cc: New test.
	* testsuite/experimental/net/buffer/creation.cc: New test.
	* testsuite/experimental/net/buffer/mutable.cc: New test.
	* testsuite/experimental/net/buffer/size.cc: New test.
	* testsuite/experimental/net/buffer/traits.cc: New test.
	* testsuite/experimental/net/execution_context/use_service.cc: New
	test.
	* testsuite/experimental/net/headers.cc: New test.
	* testsuite/experimental/net/internet/address/v4/comparisons.cc: New
	test.
	* testsuite/experimental/net/internet/address/v4/cons.cc: New test.
	* testsuite/experimental/net/internet/address/v4/creation.cc: New
	test.
	* testsuite/experimental/net/internet/address/v4/members.cc: New
	test.
	* testsuite/experimental/net/internet/resolver/base.cc: New test.
	* testsuite/experimental/net/internet/resolver/ops/lookup.cc: New
	test.
	* testsuite/experimental/net/internet/resolver/ops/reverse.cc: New
	test.
	* testsuite/experimental/net/timer/waitable/cons.cc: New test.
	* testsuite/experimental/net/timer/waitable/dest.cc: New test.
	* testsuite/experimental/net/timer/waitable/ops.cc: New test.

A minor correction. Committed to trunk.

The tests were written three years ago, before we used effective
targets to control the C++14 dialect used for tests. This fixes them
to use the modern style.

And this makes it a bit more portable (but still a long way from
compiling for mingw).

This fixes the versioned namespace macros, which we use differently on
trunk to how we used them three years ago when I wrote this code.

Tested x86_64-linux and powerpc-aix, committed to trunk.


commit 756b5ac5510ad13ad60cedf71be0c53015b10219
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Oct 16 16:51:54 2018 +0100

    Fix versioned namespace macros for Networking TS
    
    We no longer put the versioned namespace macros on the innermost
    namespace, but always nested directly below namespace std.
    
            * include/experimental/bits/net.h: Move versioned namespace macros
            to correct location.
            * include/experimental/buffer: Likewise.
            * include/experimental/executor: Likewise.
            * include/experimental/internet: Likewise.
            * include/experimental/io_context: Likewise.
            * include/experimental/netfwd: Likewise.
            * include/experimental/socket: Likewise.
            * include/experimental/timer: Likewise.

diff --git a/libstdc++-v3/include/experimental/bits/net.h b/libstdc++-v3/include/experimental/bits/net.h
index 17bd300ccf2..e2fedd358a5 100644
--- a/libstdc++-v3/include/experimental/bits/net.h
+++ b/libstdc++-v3/include/experimental/bits/net.h
@@ -40,13 +40,13 @@
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 namespace experimental
 {
 namespace net
 {
 inline namespace v1
 {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /**
    * @ingroup networking
@@ -163,10 +163,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// @}
 
-_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace v1
 } // namespace net
 } // namespace experimental
+_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
 #endif // C++14
diff --git a/libstdc++-v3/include/experimental/buffer b/libstdc++-v3/include/experimental/buffer
index 5541823165b..754a9de9953 100644
--- a/libstdc++-v3/include/experimental/buffer
+++ b/libstdc++-v3/include/experimental/buffer
@@ -43,13 +43,13 @@
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 namespace experimental
 {
 namespace net
 {
 inline namespace v1
 {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /**
    * @ingroup networking
@@ -876,20 +876,15 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 #endif
   /// @}
 
-_GLIBCXX_END_NAMESPACE_VERSION
-
 } // namespace v1
 } // namespace net
 } // namespace experimental
 
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
   template<>
     struct is_error_code_enum<experimental::net::v1::stream_errc>
     : public true_type {};
 
 _GLIBCXX_END_NAMESPACE_VERSION
-
 } // namespace std
 
 #endif // C++14
diff --git a/libstdc++-v3/include/experimental/executor b/libstdc++-v3/include/experimental/executor
index db8df4b871b..a9cb583c50d 100644
--- a/libstdc++-v3/include/experimental/executor
+++ b/libstdc++-v3/include/experimental/executor
@@ -49,13 +49,13 @@
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 namespace experimental
 {
 namespace net
 {
 inline namespace v1
 {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /**
    * @ingroup networking
@@ -1868,13 +1868,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// @}
 
-_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace v1
 } // namespace net
 } // namespace experimental
 
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
   template<typename _Alloc>
     struct uses_allocator<experimental::net::executor, _Alloc>
     : true_type {};
diff --git a/libstdc++-v3/include/experimental/internet b/libstdc++-v3/include/experimental/internet
index 402a0474a95..5e1dbb834db 100644
--- a/libstdc++-v3/include/experimental/internet
+++ b/libstdc++-v3/include/experimental/internet
@@ -59,6 +59,7 @@
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 namespace experimental
 {
 namespace net
@@ -67,7 +68,6 @@ inline namespace v1
 {
 namespace ip
 {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /**
    * @ingroup networking
@@ -2145,11 +2145,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     static const int _S_name = IPV6_V6ONLY;
   };
 
-_GLIBCXX_END_NAMESPACE_VERSION
-
-  namespace unicast {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
+  namespace unicast
+  {
     /// Set the default number of hops (TTL) for outbound datagrams.
     struct hops : __sockopt_crtp<hops>
     {
@@ -2165,13 +2162,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	name(const _Protocol& __p) const noexcept
 	{ return __p.family() == AF_INET6 ? IPV6_UNICAST_HOPS : IP_TTL; }
     };
-
-_GLIBCXX_END_NAMESPACE_VERSION
   } // namespace unicast
 
-  namespace multicast {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
+  namespace multicast
+  {
     /// Request that a socket joins a multicast group.
     struct join_group
     {
@@ -2368,7 +2362,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 	}
     };
 
-_GLIBCXX_END_NAMESPACE_VERSION
   } // namespace multicast
 
   // @}
@@ -2415,6 +2408,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
       { return _Hash_impl::hash(__a.to_bytes()); }
     };
 
+_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
 #endif // C++14
diff --git a/libstdc++-v3/include/experimental/io_context b/libstdc++-v3/include/experimental/io_context
index b8d231f7e68..78940645632 100644
--- a/libstdc++-v3/include/experimental/io_context
+++ b/libstdc++-v3/include/experimental/io_context
@@ -53,13 +53,13 @@
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 namespace experimental
 {
 namespace net
 {
 inline namespace v1
 {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /**
    * @ingroup networking
@@ -861,10 +861,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// @}
 
-_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace v1
 } // namespace net
 } // namespace experimental
+_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
 #endif // C++14
diff --git a/libstdc++-v3/include/experimental/netfwd b/libstdc++-v3/include/experimental/netfwd
index a0311a9aa69..cafac446fbf 100644
--- a/libstdc++-v3/include/experimental/netfwd
+++ b/libstdc++-v3/include/experimental/netfwd
@@ -40,13 +40,13 @@
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 namespace experimental
 {
 namespace net
 {
 inline namespace v1
 {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /**
    * @ingroup networking
@@ -90,12 +90,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// @}
 
-_GLIBCXX_END_NAMESPACE_VERSION
-
 namespace ip
 {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
-
   /**
    * @ingroup networking
    * @{
@@ -121,13 +117,11 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
     class udp;
   /// @}
 
-_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace ip
-
-
 } // namespace v1
 } // namespace net
 } // namespace experimental
+_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
 #endif // C++14
diff --git a/libstdc++-v3/include/experimental/socket b/libstdc++-v3/include/experimental/socket
index e903eb824b2..e165edaf804 100644
--- a/libstdc++-v3/include/experimental/socket
+++ b/libstdc++-v3/include/experimental/socket
@@ -61,13 +61,13 @@
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 namespace experimental
 {
 namespace net
 {
 inline namespace v1
 {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /**
    * @ingroup networking
@@ -2598,7 +2598,6 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   // @}
 
-_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace v1
 } // namespace net
 } // namespace experimental
@@ -2607,6 +2606,7 @@ _GLIBCXX_END_NAMESPACE_VERSION
     struct is_error_code_enum<experimental::net::v1::socket_errc>
     : public true_type {};
 
+_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
 #endif // C++14
diff --git a/libstdc++-v3/include/experimental/timer b/libstdc++-v3/include/experimental/timer
index 3ec365944da..af4b5bbe053 100644
--- a/libstdc++-v3/include/experimental/timer
+++ b/libstdc++-v3/include/experimental/timer
@@ -42,13 +42,13 @@
 
 namespace std _GLIBCXX_VISIBILITY(default)
 {
+_GLIBCXX_BEGIN_NAMESPACE_VERSION
 namespace experimental
 {
 namespace net
 {
 inline namespace v1
 {
-_GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /**
    * @ingroup networking
@@ -197,10 +197,10 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
 
   /// @}
 
-_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace v1
 } // namespace net
 } // namespace experimental
+_GLIBCXX_END_NAMESPACE_VERSION
 } // namespace std
 
 #endif // C++14

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