Skip to content

Commit

Permalink
fix c++ < 14 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
bradh352 committed Aug 4, 2024
1 parent 729c89d commit 2634189
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 35 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/centos7.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ jobs:
- name: Checkout c-ares
uses: actions/checkout@v1
- name: Build GoogleTest
# GoogleTest v1.10 doesn't require c++14
run: |
git clone --depth=1 -b v1.10.x https://github.com/google/googletest googletest
cd googletest
Expand All @@ -48,15 +49,13 @@ jobs:
- name: "CMake: build and test c-ares"
env:
BUILD_TYPE: CMAKE
CMAKE_TEST_FLAGS: "-DCARES_BUILD_TESTS=ON"
TEST_DEBUGGER: gdb
run: |
./ci/build.sh
./ci/test.sh
- name: "Autotools: build and test c-ares"
env:
BUILD_TYPE: autotools
TEST_DEBUGGER: gdb
# Can't run tests due to C++14 check and compiler not supporting C++14
run: |
./ci/build.sh
./ci/test.sh
8 changes: 4 additions & 4 deletions test/ares-test-internal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ TEST_F(FileChannelTest, GetAddrInfoHostsPositive) {
"1.3.5.7 \n"
"::1 ipv6.com");
EnvValue with_env("CARES_HOSTS", hostsfile.filename());
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
AddrInfoResult result = {};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT;
Expand All @@ -311,7 +311,7 @@ TEST_F(FileChannelTest, GetAddrInfoHostsSpaces) {
"1.3.5.7 \n"
"::1 ipv6.com");
EnvValue with_env("CARES_HOSTS", hostsfile.filename());
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
AddrInfoResult result = {};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT;
Expand All @@ -331,7 +331,7 @@ TEST_F(FileChannelTest, GetAddrInfoHostsByALias) {
"1.3.5.7 \n"
"::1 ipv6.com");
EnvValue with_env("CARES_HOSTS", hostsfile.filename());
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
AddrInfoResult result = {};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT;
Expand All @@ -351,7 +351,7 @@ TEST_F(FileChannelTest, GetAddrInfoHostsIPV6) {
"1.3.5.7 \n"
"::1 ipv6.com");
EnvValue with_env("CARES_HOSTS", hostsfile.filename());
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
AddrInfoResult result = {};
hints.ai_family = AF_INET6;
hints.ai_flags = ARES_AI_CANONNAME | ARES_AI_ENVHOSTS | ARES_AI_NOSORT;
Expand Down
6 changes: 3 additions & 3 deletions test/ares-test-live.cc
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ MATCHER_P(IncludesAddrType, addrtype, "") {
}

//VIRT_NONVIRT_TEST_F(DefaultChannelTest, LiveGetAddrInfoV4) {
//struct ares_addrinfo_hints hints = {};
//struct ares_addrinfo_hints hints = {0, 0, 0, 0};
//hints.ai_family = AF_INET;
//AddrInfoResult result;
//ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand All @@ -86,7 +86,7 @@ MATCHER_P(IncludesAddrType, addrtype, "") {
//}

//VIRT_NONVIRT_TEST_F(DefaultChannelTest, LiveGetAddrInfoV6) {
//struct ares_addrinfo_hints hints = {};
//struct ares_addrinfo_hints hints = {0, 0, 0, 0};
//hints.ai_family = AF_INET6;
//AddrInfoResult result;
//ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand All @@ -98,7 +98,7 @@ MATCHER_P(IncludesAddrType, addrtype, "") {
//}

//VIRT_NONVIRT_TEST_F(DefaultChannelTest, LiveGetAddrInfoUnspec) {
//struct ares_addrinfo_hints hints = {};
//struct ares_addrinfo_hints hints = {0, 0, 0, 0};
//hints.ai_family = AF_UNSPEC;
//AddrInfoResult result;
//ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand Down
2 changes: 1 addition & 1 deletion test/ares-test-misc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ TEST_F(DefaultChannelTest, HostByNameFileOnionDomain) {

TEST_F(DefaultChannelTest, GetAddrinfoOnionDomain) {
AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_UNSPEC;
ares_getaddrinfo(channel_, "dontleak.onion", NULL, &hints, AddrInfoCallback, &result);
EXPECT_TRUE(result.done_);
Expand Down
48 changes: 24 additions & 24 deletions test/ares-test-mock-ai.cc
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ TEST_P(MockUDPChannelTestAI, GetAddrInfoParallelLookups) {
ON_CALL(server_, OnRequest("www.example.com", T_A))
.WillByDefault(SetReply(&server_, &rsp2));

struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
AddrInfoResult result1;
Expand Down Expand Up @@ -145,7 +145,7 @@ TEST_P(MockUDPChannelTestAI, TruncationRetry) {
.WillOnce(SetReply(&server_, &rspok));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand All @@ -162,7 +162,7 @@ TEST_P(MockTCPChannelTestAI, MalformedResponse) {
.WillByDefault(SetReplyData(&server_, one));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand All @@ -180,7 +180,7 @@ TEST_P(MockTCPChannelTestAI, FormErrResponse) {
.WillOnce(SetReply(&server_, &rsp));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand All @@ -198,7 +198,7 @@ TEST_P(MockTCPChannelTestAI, ServFailResponse) {
.WillByDefault(SetReply(&server_, &rsp));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand All @@ -216,7 +216,7 @@ TEST_P(MockTCPChannelTestAI, NotImplResponse) {
.WillByDefault(SetReply(&server_, &rsp));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand All @@ -234,7 +234,7 @@ TEST_P(MockTCPChannelTestAI, RefusedResponse) {
.WillByDefault(SetReply(&server_, &rsp));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand All @@ -252,7 +252,7 @@ TEST_P(MockTCPChannelTestAI, YXDomainResponse) {
.WillOnce(SetReply(&server_, &rsp));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand Down Expand Up @@ -295,7 +295,7 @@ TEST_P(MockExtraOptsTestAI, SimpleQuery) {
.WillByDefault(SetReply(&server_, &rsp));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand Down Expand Up @@ -346,7 +346,7 @@ TEST_P(MockExtraOptsNDots5TestAI, SimpleQuery) {
.WillByDefault(SetReply(&server_, &rsp));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "dynamodb.us-east-1.amazonaws.com.", NULL, &hints, AddrInfoCallback, &result);
Expand Down Expand Up @@ -392,7 +392,7 @@ TEST_P(MockExtraOptsNDots0TestAI, SimpleQuery) {
.WillByDefault(SetReply(&server_, &rsp_ndots0_third));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "ndots0", NULL, &hints, AddrInfoCallback, &result);
Expand Down Expand Up @@ -434,7 +434,7 @@ TEST_P(MockNoCheckRespChannelTestAI, ServFailResponse) {
.WillByDefault(SetReply(&server_, &rsp));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand All @@ -452,7 +452,7 @@ TEST_P(MockNoCheckRespChannelTestAI, NotImplResponse) {
.WillByDefault(SetReply(&server_, &rsp));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand All @@ -470,7 +470,7 @@ TEST_P(MockNoCheckRespChannelTestAI, RefusedResponse) {
.WillByDefault(SetReply(&server_, &rsp));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand All @@ -489,7 +489,7 @@ TEST_P(MockChannelTestAI, FamilyV6) {
ON_CALL(server_, OnRequest("example.com", T_AAAA))
.WillByDefault(SetReply(&server_, &rsp6));
AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET6;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "example.com.", NULL, &hints,
Expand All @@ -516,7 +516,7 @@ TEST_P(MockChannelTestAI, PartialQueryCancel) {


AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_UNSPEC;
ares_getaddrinfo(channel_, "example.com.", NULL, &hints,
AddrInfoCallback, &result);
Expand All @@ -536,7 +536,7 @@ TEST_P(MockChannelTestAI, FamilyV4) {
ON_CALL(server_, OnRequest("example.com", T_A))
.WillByDefault(SetReply(&server_, &rsp4));
AddrInfoResult result = {};
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "example.com.", NULL, &hints,
Expand All @@ -556,7 +556,7 @@ TEST_P(MockChannelTestAI, FamilyV4_MultipleAddresses) {
ON_CALL(server_, OnRequest("example.com", T_A))
.WillByDefault(SetReply(&server_, &rsp4));
AddrInfoResult result = {};
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "example.com.", NULL, &hints,
Expand Down Expand Up @@ -584,7 +584,7 @@ TEST_P(MockChannelTestAI, FamilyUnspecified) {
ON_CALL(server_, OnRequest("example.com", T_A))
.WillByDefault(SetReply(&server_, &rsp4));
AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_UNSPEC;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "example.com.", NULL, &hints,
Expand Down Expand Up @@ -614,7 +614,7 @@ TEST_P(MockEDNSChannelTestAI, RetryWithoutEDNS) {
.WillOnce(SetReply(&server_, &rspok));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.google.com.", NULL, &hints, AddrInfoCallback, &result);
Expand Down Expand Up @@ -643,7 +643,7 @@ TEST_P(MockChannelTestAI, SearchDomains) {
.WillByDefault(SetReply(&server_, &yesthird));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www", NULL, &hints, AddrInfoCallback, &result);
Expand Down Expand Up @@ -689,7 +689,7 @@ TEST_P(MockChannelTestAI, SearchDomainsServFailOnAAAA) {
.WillByDefault(SetReply(&server_, &failthird4));

AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_UNSPEC;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www", NULL, &hints, AddrInfoCallback, &result);
Expand All @@ -707,7 +707,7 @@ class MockMultiServerChannelTestAI
: MockChannelOptsTest(3, GetParam().first, GetParam().second, opts, optmask) {}
void CheckExample() {
AddrInfoResult result;
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "www.example.com.", NULL, &hints, AddrInfoCallback, &result);
Expand Down Expand Up @@ -785,7 +785,7 @@ TEST_P(MockChannelTestAI, FamilyV4ServiceName) {
ON_CALL(server_, OnRequest("example.com", T_A))
.WillByDefault(SetReply(&server_, &rsp4));
AddrInfoResult result = {};
struct ares_addrinfo_hints hints = {};
struct ares_addrinfo_hints hints = {0, 0, 0, 0};
hints.ai_family = AF_INET;
hints.ai_flags = ARES_AI_NOSORT;
ares_getaddrinfo(channel_, "example.com", "http", &hints, AddrInfoCallback, &result);
Expand Down

0 comments on commit 2634189

Please sign in to comment.