[committed] libstdc++: Add preprocessor checks to <experimental/internet> [PR100285]

Message ID 20230609121900.307482-1-jwakely@redhat.com
State Committed
Commit 793ed718b522b15e2d758eca953feeec1979fe2c
Headers
Series [committed] libstdc++: Add preprocessor checks to <experimental/internet> [PR100285] |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 fail Patch failed to apply
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm fail Patch failed to apply

Commit Message

Jonathan Wakely June 9, 2023, 12:19 p.m. UTC
  Tested x86_64-linux. Pushed to trunk.

 --> 8--

We can't define endpoints and resolvers without the relevant OS support.
If IPPROTO_TCP and IPPROTO_UDP are both udnefined then we won't need
basic_endpoint and basic_resovler anyway, so make them depend on those
macros.

libstdc++-v3/ChangeLog:

	PR libstdc++/100285
	* include/experimental/internet [IPPROTO_TCP || IPPROTO_UDP]
	(basic_endpoint, basic_resolver_entry, resolver_base)
	(basic_resolver_results, basic_resolver): Only define if the tcp
	or udp protocols will be defined.
---
 libstdc++-v3/include/experimental/internet | 2 ++
 1 file changed, 2 insertions(+)
  

Patch

diff --git a/libstdc++-v3/include/experimental/internet b/libstdc++-v3/include/experimental/internet
index 1f63c61ce85..bd9a05f12aa 100644
--- a/libstdc++-v3/include/experimental/internet
+++ b/libstdc++-v3/include/experimental/internet
@@ -1502,6 +1502,7 @@  namespace ip
     operator<<(basic_ostream<_CharT, _Traits>& __os, const network_v6& __net)
     { return __os << __net.to_string(); }
 
+#if defined IPPROTO_TCP || defined  IPPROTO_UDP
   /// An IP endpoint.
   template<typename _InternetProtocol>
     class basic_endpoint
@@ -2187,6 +2188,7 @@  namespace ip
       __ec = std::make_error_code(errc::operation_not_supported);
 #endif
     }
+#endif // IPPROTO_TCP || IPPROTO_UDP
 
   /** The name of the local host.
    * @{