From: Jonathan Wakely <jwakely@redhat.com>
To: libstdc++@gcc.gnu.org, gcc-patches@gcc.gnu.org
Cc: Iain Sandoe <idsandoe@googlemail.com>
Subject: [PATCH] Check AI_NUMERICSERV is defined before using it
Date: Thu, 10 Jan 2019 13:22:00 -0000 [thread overview]
Message-ID: <20190110132153.GA7836@redhat.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 404 bytes --]
The AI_NUMERICSERV constant is missing from old Darwin systems, so only
use it if it's supported.
* include/experimental/internet [AI_NUMERICSERV]
(resolver_base::numeric_service): Define conditionally.
* testsuite/experimental/net/internet/resolver/base.cc: Test it
conditionally.
* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
Likewise.
Tested x86_64-linux, committed to trunk.
[-- Attachment #2: patch.txt --]
[-- Type: text/plain, Size: 3188 bytes --]
commit 263a9a4d85e1c2cbfc7fad5585d98dd133c874b1
Author: Jonathan Wakely <jwakely@redhat.com>
Date: Thu Jan 10 13:18:17 2019 +0000
Check AI_NUMERICSERV is defined before using it
The AI_NUMERICSERV constant is missing from old Darwin systems, so only
use it if it's supported.
* include/experimental/internet [AI_NUMERICSERV]
(resolver_base::numeric_service): Define conditionally.
* testsuite/experimental/net/internet/resolver/base.cc: Test it
conditionally.
* testsuite/experimental/net/internet/resolver/ops/lookup.cc:
Likewise.
diff --git a/libstdc++-v3/include/experimental/internet b/libstdc++-v3/include/experimental/internet
index cd0eee29585..07c62e697cd 100644
--- a/libstdc++-v3/include/experimental/internet
+++ b/libstdc++-v3/include/experimental/internet
@@ -1629,7 +1629,9 @@ namespace ip
__flags_passive = AI_PASSIVE,
__flags_canonical_name = AI_CANONNAME,
__flags_numeric_host = AI_NUMERICHOST,
+#ifdef AI_NUMERICSERV
__flags_numeric_service = AI_NUMERICSERV,
+#endif
__flags_v4_mapped = AI_V4MAPPED,
__flags_all_matching = AI_ALL,
__flags_address_configured = AI_ADDRCONFIG
@@ -1637,7 +1639,9 @@ namespace ip
static constexpr flags passive = __flags_passive;
static constexpr flags canonical_name = __flags_canonical_name;
static constexpr flags numeric_host = __flags_numeric_host;
+#ifdef AI_NUMERICSERV
static constexpr flags numeric_service = __flags_numeric_service;
+#endif
static constexpr flags v4_mapped = __flags_v4_mapped;
static constexpr flags all_matching = __flags_all_matching;
static constexpr flags address_configured = __flags_address_configured;
diff --git a/libstdc++-v3/testsuite/experimental/net/internet/resolver/base.cc b/libstdc++-v3/testsuite/experimental/net/internet/resolver/base.cc
index 657e2f56b43..746557af656 100644
--- a/libstdc++-v3/testsuite/experimental/net/internet/resolver/base.cc
+++ b/libstdc++-v3/testsuite/experimental/net/internet/resolver/base.cc
@@ -49,7 +49,9 @@ test01()
(void) resolver::passive;
(void) resolver::canonical_name;
(void) resolver::numeric_host;
+#ifdef AI_NUMERICSERV
(void) resolver::numeric_service;
+#endif
(void) resolver::v4_mapped;
(void) resolver::all_matching;
(void) resolver::address_configured;
diff --git a/libstdc++-v3/testsuite/experimental/net/internet/resolver/ops/lookup.cc b/libstdc++-v3/testsuite/experimental/net/internet/resolver/ops/lookup.cc
index d926385f1a8..39fb7fd7708 100644
--- a/libstdc++-v3/testsuite/experimental/net/internet/resolver/ops/lookup.cc
+++ b/libstdc++-v3/testsuite/experimental/net/internet/resolver/ops/lookup.cc
@@ -49,7 +49,10 @@ test02()
std::error_code ec;
io_context ctx;
ip::tcp::resolver resolv(ctx);
- auto flags = ip::resolver_base::numeric_host | ip::tcp::resolver::numeric_service;
+ auto flags = ip::resolver_base::numeric_host;
+#ifdef AI_NUMERICSERV
+ flags |= ip::tcp::resolver::numeric_service;
+#endif
auto addrs = resolv.resolve("127.0.0.1", "42", flags, ec);
VERIFY( !ec );
VERIFY( addrs.size() > 0 );
reply other threads:[~2019-01-10 13:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190110132153.GA7836@redhat.com \
--to=jwakely@redhat.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=idsandoe@googlemail.com \
--cc=libstdc++@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).