Skip to content

Commit 8014a4d

Browse files
committed
src: suppress c-ares deprecation warnings
Suppress deprecation warnings for legacy c-ares APIs (ares_parse_*_reply, ares_get_servers_ports, ares_set_servers_ports) using compiler pragmas for Clang, GCC, and MSVC. A full migration to the modern replacement APIs (ares_dns_parse, ares_get_servers_csv, ares_set_servers_csv) is left as follow-up work. Fixes: #52464 Signed-off-by: om-ghante <mr.omghante1@gmail.com>
1 parent d080801 commit 8014a4d

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/cares_wrap.cc

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,19 @@
5656
# define AI_V4MAPPED 0
5757
#endif
5858

59+
// Suppress c-ares deprecation warnings. c-ares has deprecated many legacy
60+
// APIs (ares_parse_*_reply, ares_get_servers_ports, ares_set_servers_ports,
61+
// etc.) in favor of ares_dns_parse, ares_get_servers_csv, and
62+
// ares_set_servers_csv. A full migration is tracked separately; this pragma
63+
// silences the build warnings until that work is complete.
64+
// TODO(omghante): Migrate to the replacement c-ares APIs.
65+
#if defined(__clang__)
66+
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
67+
#elif defined(__GNUC__)
68+
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
69+
#elif defined(_MSC_VER)
70+
#pragma warning(disable : 4996)
71+
#endif
5972

6073
namespace node {
6174
namespace cares_wrap {

0 commit comments

Comments
 (0)