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 a name collision in a test, because various systems (at
least GNU and AIX) define struct ip in <netinet/ip.h>.

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

commit 2b7ecc5d99dd705e82c390c7cf8ed01997a94d50
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Tue Oct 16 17:08:23 2018 +0100

    Rename namespace alias in test to avoid name collision
    
            * testsuite/experimental/net/internet/address/v4/creation.cc: Do not
            declare ip in global namespace, to avoid collision with struct ip
            defined in <netinet/ip.h>.

diff --git a/libstdc++-v3/testsuite/experimental/net/internet/address/v4/creation.cc b/libstdc++-v3/testsuite/experimental/net/internet/address/v4/creation.cc
index bf92b213fc8..770918f4686 100644
--- a/libstdc++-v3/testsuite/experimental/net/internet/address/v4/creation.cc
+++ b/libstdc++-v3/testsuite/experimental/net/internet/address/v4/creation.cc
@@ -21,8 +21,8 @@
 #include <experimental/internet>
 #include <testsuite_hooks.h>
 
-namespace ip = std::experimental::net::ip;
-using ip::address_v4;
+namespace net = std::experimental::net;
+using net::ip::address_v4;
 
 void
 test01()
@@ -44,12 +44,12 @@ test02()
 {
   bool test __attribute__((unused)) = false;
 
-  auto a0 = ip::make_address_v4(0u);
+  auto a0 = net::ip::make_address_v4(0u);
   VERIFY( a0.to_uint() == 0 );
   VERIFY( a0.to_bytes() == address_v4::bytes_type{} );
 
   address_v4::uint_type u1 = ntohl((5 << 24) | (6 << 16) | (7 << 8) | 8);
-  auto a1 = ip::make_address_v4( u1 );
+  auto a1 = net::ip::make_address_v4( u1 );
   VERIFY( a1.to_uint() == u1 );
   VERIFY( a1.to_bytes() == address_v4::bytes_type( 5, 6, 7, 8 ) );
 }
@@ -59,27 +59,27 @@ test03()
 {
   bool test __attribute__((unused)) = false;
 
-  auto a1 = ip::make_address_v4("127.0.0.1");
+  auto a1 = net::ip::make_address_v4("127.0.0.1");
   VERIFY( a1.is_loopback() );
-  auto a2 = ip::make_address_v4(std::string{"127.0.0.2"});
+  auto a2 = net::ip::make_address_v4(std::string{"127.0.0.2"});
   VERIFY( a2.is_loopback() );
-  auto a3 = ip::make_address_v4(std::experimental::string_view{"127.0.0.3"});
+  auto a3 = net::ip::make_address_v4(std::experimental::string_view{"127.0.0.3"});
   VERIFY( a3.is_loopback() );
 
   std::error_code ec;
-  auto a4 = ip::make_address_v4("127...1", ec);
+  auto a4 = net::ip::make_address_v4("127...1", ec);
   VERIFY( ec == std::errc::invalid_argument );
 
-  ip::make_address_v4("127.0.0.1", ec);
+  net::ip::make_address_v4("127.0.0.1", ec);
   VERIFY( !ec );
 
-  a4 = ip::make_address_v4(std::string{"256.0.0.1"}, ec);
+  a4 = net::ip::make_address_v4(std::string{"256.0.0.1"}, ec);
   VERIFY( ec == std::errc::invalid_argument );
 
-  ip::make_address_v4(std::string{"127.0.0.1"}, ec);
+  net::ip::make_address_v4(std::string{"127.0.0.1"}, ec);
   VERIFY( !ec );
 
-  a4 = ip::make_address_v4(std::experimental::string_view{""}, ec);
+  a4 = net::ip::make_address_v4(std::experimental::string_view{""}, ec);
   VERIFY( ec == std::errc::invalid_argument );
 }
 

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