diff options
author | Francis Dupont <fdupont@isc.org> | 2024-06-02 20:53:05 +0200 |
---|---|---|
committer | Francis Dupont <fdupont@isc.org> | 2024-06-05 10:13:55 +0200 |
commit | 31b7b96f820fbe7e77cab3d5543385bfc19f9663 (patch) | |
tree | 5a9c3c328f4cbd3ef565a68ad388101c6e752ffc | |
parent | [#3350] upgrade pip in hammer for rhel (diff) | |
download | kea-31b7b96f820fbe7e77cab3d5543385bfc19f9663.tar.xz kea-31b7b96f820fbe7e77cab3d5543385bfc19f9663.zip |
[#2618] Fixed shadow
34 files changed, 127 insertions, 132 deletions
diff --git a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc index 12c95a7f5b..62a7113970 100644 --- a/src/bin/d2/tests/d2_cfg_mgr_unittests.cc +++ b/src/bin/d2/tests/d2_cfg_mgr_unittests.cc @@ -929,7 +929,6 @@ TEST_F(D2CfgMgrTest, configPermutations) { // 3. data - configuration text to parse // 4. convert data into JSON text // 5. submit JSON for parsing - isc::data::ConstElementPtr test; ASSERT_TRUE(tests->get("test-list")); for (auto const& test : tests->get("test-list")->listValue()) { // Grab the description. diff --git a/src/bin/dhcp4/tests/hooks_unittest.cc b/src/bin/dhcp4/tests/hooks_unittest.cc index d0f7a4a616..416bc09fcd 100644 --- a/src/bin/dhcp4/tests/hooks_unittest.cc +++ b/src/bin/dhcp4/tests/hooks_unittest.cc @@ -3489,8 +3489,7 @@ TEST_F(LoadUnloadDhcpv4SrvTest, Dhcpv4SrvConfigured) { if (parameters.empty()) { EXPECT_EQ(0, status_code); string expected = "{ \"arguments\": { \"hash\": \""; - ConstElementPtr config = - CfgMgr::instance().getStagingCfg()->toElement(); + config = CfgMgr::instance().getStagingCfg()->toElement(); expected += BaseCommandMgr::getHash(config); expected += "\" }, \"result\": 0, \"text\": "; expected += "\"Configuration successful.\" }"; diff --git a/src/bin/dhcp4/tests/inform_unittest.cc b/src/bin/dhcp4/tests/inform_unittest.cc index 50697d5717..a91e45d70c 100644 --- a/src/bin/dhcp4/tests/inform_unittest.cc +++ b/src/bin/dhcp4/tests/inform_unittest.cc @@ -551,9 +551,9 @@ TEST_F(InformTest, messageFieldsLongOptions) { // then restored. uint32_t count = 0; uint8_t index = 0; - for (auto const& option : client.getContext().query_->options_) { - if (option.first == 231) { - for (auto const& value : option.second->getData()) { + for (auto const& opt : client.getContext().query_->options_) { + if (opt.first == 231) { + for (auto const& value : opt.second->getData()) { ASSERT_EQ(value, index); index++; } @@ -563,11 +563,11 @@ TEST_F(InformTest, messageFieldsLongOptions) { ASSERT_EQ(1, count); count = 0; - for (auto const& option : resp->options_) { - if (option.first == DHO_DHCP_AGENT_OPTIONS) { - for (auto const& suboption: option.second->getOptions()) { + for (auto const& opt : resp->options_) { + if (opt.first == DHO_DHCP_AGENT_OPTIONS) { + for (auto const& suboption: opt.second->getOptions()) { if (suboption.first == RAI_OPTION_AGENT_CIRCUIT_ID) { - uint8_t index = 0; + index = 0; for (auto const& value : suboption.second->getData()) { ASSERT_EQ(value, index); index++; @@ -588,10 +588,10 @@ TEST_F(InformTest, messageFieldsLongOptions) { count = 0; string value = ""; - for (auto const& option : resp->options_) { - if (option.second->getType() == 240) { - value += string(reinterpret_cast<const char*>(&option.second->getData()[0]), - option.second->getData().size()); + for (auto const& opt : resp->options_) { + if (opt.second->getType() == 240) { + value += string(reinterpret_cast<const char*>(&opt.second->getData()[0]), + opt.second->getData().size()); count++; } } diff --git a/src/bin/dhcp6/tests/hooks_unittest.cc b/src/bin/dhcp6/tests/hooks_unittest.cc index 6b6170a555..6a4d0f512c 100644 --- a/src/bin/dhcp6/tests/hooks_unittest.cc +++ b/src/bin/dhcp6/tests/hooks_unittest.cc @@ -5716,8 +5716,7 @@ TEST_F(LoadUnloadDhcpv6SrvTest, Dhcpv6SrvConfigured) { if (parameters.empty()) { EXPECT_EQ(0, status_code); string expected = "{ \"arguments\": { \"hash\": \""; - ConstElementPtr config = - CfgMgr::instance().getStagingCfg()->toElement(); + config = CfgMgr::instance().getStagingCfg()->toElement(); expected += BaseCommandMgr::getHash(config); expected += "\" }, \"result\": 0, \"text\": "; expected += "\"Configuration successful.\" }"; diff --git a/src/bin/perfdhcp/command_options.cc b/src/bin/perfdhcp/command_options.cc index 85d58a2d1b..84de94c107 100644 --- a/src/bin/perfdhcp/command_options.cc +++ b/src/bin/perfdhcp/command_options.cc @@ -503,9 +503,9 @@ CommandOptions::initialize(int argc, char** argv, bool print_cmd_line) { } // Create and remember the option. - OptionPtr opt(new Option(ipversion_ == 4 ? Option::V4 : Option::V6, - code, bin)); - extra_opts_.insert(make_pair(code, opt)); + OptionPtr option(new Option(ipversion_ == 4 ? Option::V4 : Option::V6, + code, bin)); + extra_opts_.insert(make_pair(code, option)); break; } case 'p': diff --git a/src/bin/perfdhcp/tests/stats_mgr_unittest.cc b/src/bin/perfdhcp/tests/stats_mgr_unittest.cc index 54253d5b8b..498ab51773 100644 --- a/src/bin/perfdhcp/tests/stats_mgr_unittest.cc +++ b/src/bin/perfdhcp/tests/stats_mgr_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2012-2021 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2012-2024 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -232,14 +232,14 @@ public: // with transaction ids of already sent packets. Pkt4ModifiablePtr sent_packet(createPacket4(DHCPDISCOVER, transid[i] + 1)); - Pkt4ModifiablePtr rcvd_packet(createPacket4(DHCPOFFER, - transid[i] + 1)); + Pkt4ModifiablePtr rcvd_packet2(createPacket4(DHCPOFFER, + transid[i] + 1)); ASSERT_NO_THROW( stats_mgr->passSentPacket(ExchangeType::DO, sent_packet) ) << "failure for transaction id " << transid[i]; ASSERT_NO_THROW( - stats_mgr->passRcvdPacket(ExchangeType::DO, rcvd_packet); + stats_mgr->passRcvdPacket(ExchangeType::DO, rcvd_packet2); ) << "failure for transaction id " << transid[i]; } diff --git a/src/hooks/dhcp/high_availability/ha_config_parser.cc b/src/hooks/dhcp/high_availability/ha_config_parser.cc index 18747ae964..f7349e0872 100644 --- a/src/hooks/dhcp/high_availability/ha_config_parser.cc +++ b/src/hooks/dhcp/high_availability/ha_config_parser.cc @@ -104,8 +104,8 @@ HAConfigParser::parseAll(const HAConfigMapperPtr& config_storage, if (config_vec.empty()) { isc_throw(ConfigError, "a list of HA configurations must not be empty"); } - for (auto const& config : config_vec) { - parseOne(config_storage, config); + for (auto const& cfg : config_vec) { + parseOne(config_storage, cfg); } } diff --git a/src/hooks/dhcp/high_availability/tests/lease_update_backlog_unittest.cc b/src/hooks/dhcp/high_availability/tests/lease_update_backlog_unittest.cc index a1cbe62ab9..f84d3ce997 100644 --- a/src/hooks/dhcp/high_availability/tests/lease_update_backlog_unittest.cc +++ b/src/hooks/dhcp/high_availability/tests/lease_update_backlog_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2020-2021 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2020-2024 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -49,8 +49,8 @@ TEST(LeaseUpdateBacklogTest, pushAndPop) { // Try to pop all lease updates. LeaseUpdateBacklog::OpType op_type; for (auto i = 0; i < 5; ++i) { - auto lease = backlog.pop(op_type); - ASSERT_TRUE(lease); + auto l = backlog.pop(op_type); + ASSERT_TRUE(l); ASSERT_EQ(i % 2 ? LeaseUpdateBacklog::ADD : LeaseUpdateBacklog::DELETE, op_type); } diff --git a/src/hooks/dhcp/perfmon/tests/alarm_unittests.cc b/src/hooks/dhcp/perfmon/tests/alarm_unittests.cc index 0814dc4574..e0653a0788 100644 --- a/src/hooks/dhcp/perfmon/tests/alarm_unittests.cc +++ b/src/hooks/dhcp/perfmon/tests/alarm_unittests.cc @@ -290,7 +290,6 @@ TEST(Alarm, checkSample) { usleep(50); // Invoke checkSample() with the scenario sample duration. It should not throw. - bool should_report; ASSERT_NO_THROW_LOG(should_report = alarm->checkSample(scenario.sample_, report_interval)); // Verify that we returned the expected value for a reportable event (or not). diff --git a/src/hooks/dhcp/user_chk/user_file.cc b/src/hooks/dhcp/user_chk/user_file.cc index cd3b34aa2f..ebf4c128a6 100644 --- a/src/hooks/dhcp/user_chk/user_file.cc +++ b/src/hooks/dhcp/user_chk/user_file.cc @@ -85,7 +85,6 @@ UserFile::makeUser(const std::string& user_string) { // Iterate over the elements, saving of "type" and "id" to their // respective locals. Anything else is assumed to be an option so // add it to the local property map. - std::pair<std::string, isc::data::ConstElementPtr> element_pair; for (auto const& element_pair : elements->mapValue()) { // Get the element's label. std::string label = element_pair.first; diff --git a/src/lib/dhcp/iface_mgr_bsd.cc b/src/lib/dhcp/iface_mgr_bsd.cc index 7d373f1501..959eb95467 100644 --- a/src/lib/dhcp/iface_mgr_bsd.cc +++ b/src/lib/dhcp/iface_mgr_bsd.cc @@ -114,13 +114,13 @@ IfaceMgr::detectIfaces(bool update_only) { freeifaddrs(iflist); // Interfaces registering - for (auto const& iface_iter : ifaces) { + for (auto const& iface_it : ifaces) { IfacePtr iface; if (update_only) { - iface = getIface(iface_iter.first); + iface = getIface(iface_it.first); } if (!iface) { - addInterface(iface_iter.second); + addInterface(iface_it.second); } } } diff --git a/src/lib/dhcp/iface_mgr_sun.cc b/src/lib/dhcp/iface_mgr_sun.cc index 4f1cd36c03..6376f3262e 100644 --- a/src/lib/dhcp/iface_mgr_sun.cc +++ b/src/lib/dhcp/iface_mgr_sun.cc @@ -114,13 +114,13 @@ IfaceMgr::detectIfaces(bool update_only) { freeifaddrs(iflist); // Interfaces registering - for (auto const& iface_iter : ifaces) { + for (auto const& iface_it : ifaces) { IfacePtr iface; if (update_only) { - iface = getIface(iface_iter.first); + iface = getIface(iface_it.first); } if (!iface) { - addInterface(iface_iter.second); + addInterface(iface_it.second); } } } diff --git a/src/lib/dhcp/pkt4.cc b/src/lib/dhcp/pkt4.cc index 7803101245..d552eead56 100644 --- a/src/lib/dhcp/pkt4.cc +++ b/src/lib/dhcp/pkt4.cc @@ -123,7 +123,7 @@ Pkt4::pack() { /// Create a ManagedScopedOptionsCopyContainer to handle storing and /// restoration of copied options. - ManagedScopedOptionsCopyContainer scoped_options; + ManagedScopedOptionsCopyContainer m_scoped_options; // The RFC3396 adds support for long options split over multiple options // using the same code. @@ -132,7 +132,7 @@ Pkt4::pack() { // options will differ from the ones instantiated by the // @ref OptionDefinition::optionFactory. At this stage the server should // not do anything useful with the options beside packing. - LibDHCP::splitOptions4(options_, scoped_options.scoped_options_); + LibDHCP::splitOptions4(options_, m_scoped_options.scoped_options_); // Call packOptions4() with parameter,"top", true. This invokes // logic to emit the message type option first. diff --git a/src/lib/dhcp/tests/libdhcp++_unittest.cc b/src/lib/dhcp/tests/libdhcp++_unittest.cc index f6f262aeef..086de74005 100644 --- a/src/lib/dhcp/tests/libdhcp++_unittest.cc +++ b/src/lib/dhcp/tests/libdhcp++_unittest.cc @@ -1746,21 +1746,21 @@ TEST_F(LibDhcpTest, extendVivso) { for (auto const& option : options) { ASSERT_EQ(option.second->getType(), DHO_VIVSO_SUBOPTIONS); OptionCollection suboptions = option.second->getOptions(); - OptionPtr suboption; + OptionPtr subopt; OptionVendorPtr vendor = boost::dynamic_pointer_cast<OptionVendor>(option.second); ASSERT_TRUE(vendor); if (vendor->getVendorId() == 1) { ASSERT_EQ(suboptions.size(), 3); - suboption = option.second->getOption(16); - ASSERT_TRUE(suboption); - suboption = option.second->getOption(32); - ASSERT_TRUE(suboption); - suboption = option.second->getOption(64); - ASSERT_TRUE(suboption); + subopt = option.second->getOption(16); + ASSERT_TRUE(subopt); + subopt = option.second->getOption(32); + ASSERT_TRUE(subopt); + subopt = option.second->getOption(64); + ASSERT_TRUE(subopt); } else if (vendor->getVendorId() == 2) { ASSERT_EQ(suboptions.size(), 1); - suboption = option.second->getOption(128); - ASSERT_TRUE(suboption); + subopt = option.second->getOption(128); + ASSERT_TRUE(subopt); } else { FAIL() << "unexpected vendor type: " << vendor->getVendorId(); } diff --git a/src/lib/dhcp/tests/packet_queue4_unittest.cc b/src/lib/dhcp/tests/packet_queue4_unittest.cc index 58164f27e2..4bf604debb 100644 --- a/src/lib/dhcp/tests/packet_queue4_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue4_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2018-2019,2021 Internet Systems Consortium, Inc. ("ISC") +// Copyright (C) 2018-2024 Internet Systems Consortium, Inc. ("ISC") // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -109,7 +109,7 @@ TEST(PacketQueueRing4, enqueueDequeueTest) { // Enqueue five packets. The first two should be pushed off. SocketInfo sock1(isc::asiolink::IOAddress("127.0.0.1"), 777, 10); - for (int i = 1; i < 6; ++i) { + for (unsigned i = 1; i < 6; ++i) { Pkt4Ptr pkt(new Pkt4(DHCPDISCOVER, 1000+i)); ASSERT_NO_THROW(q->enqueuePacket(pkt, sock1)); } @@ -120,7 +120,7 @@ TEST(PacketQueueRing4, enqueueDequeueTest) { // We should have transids 1003,1004,1005 Pkt4Ptr pkt; - for (int i = 3; i < 6; ++i) { + for (unsigned i = 3; i < 6; ++i) { ASSERT_NO_THROW(pkt = q->dequeuePacket()); ASSERT_TRUE(pkt); EXPECT_EQ(1000 + i, pkt->getTransid()); @@ -134,9 +134,9 @@ TEST(PacketQueueRing4, enqueueDequeueTest) { ASSERT_FALSE(pkt); // Enqueue three more packets. - for (int i = 0; i < 3; ++i) { - Pkt4Ptr pkt(new Pkt4(DHCPDISCOVER, 1000+i)); - ASSERT_NO_THROW(q->enqueuePacket(pkt, sock1)); + for (unsigned i = 0; i < 3; ++i) { + Pkt4Ptr dis(new Pkt4(DHCPDISCOVER, 1000+i)); + ASSERT_NO_THROW(q->enqueuePacket(dis, sock1)); } checkIntStat(q, "size", 3); @@ -153,7 +153,7 @@ TEST(PacketQueueRing4, peekPushPopTest) { PacketQueueRing4 q("kea-ring4", 3); // Push five packets onto the end. The first two should get pushed off. - for (int i = 1; i < 6; ++i) { + for (unsigned i = 1; i < 6; ++i) { Pkt4Ptr pkt(new Pkt4(DHCPDISCOVER, 1000+i)); ASSERT_NO_THROW(q.pushPacket(pkt)); } @@ -276,7 +276,7 @@ TEST(TestQueue4, eatPacketsTest) { Pkt4Ptr pkt; // Let's add five packets. - for (int i = 1; i < 6; ++i) { + for (unsigned i = 1; i < 6; ++i) { pkt.reset(new Pkt4(DHCPDISCOVER, 1000 + i)); ASSERT_NO_THROW(q.enqueuePacket(pkt, sock)); ASSERT_EQ(i, q.getSize()); diff --git a/src/lib/dhcp/tests/packet_queue6_unittest.cc b/src/lib/dhcp/tests/packet_queue6_unittest.cc index 52fb0dc3d7..0e9c7d2690 100644 --- a/src/lib/dhcp/tests/packet_queue6_unittest.cc +++ b/src/lib/dhcp/tests/packet_queue6_unittest.cc @@ -110,7 +110,7 @@ TEST(PacketQueueRing6, enqueueDequeueTest) { // Enqueue five packets. The first two should be pushed off. SocketInfo sock1(isc::asiolink::IOAddress("127.0.0.1"), 777, 10); - for (int i = 1; i < 6; ++i) { + for (unsigned i = 1; i < 6; ++i) { Pkt6Ptr pkt(new Pkt6(DHCPV6_SOLICIT, 1000+i)); ASSERT_NO_THROW(q->enqueuePacket(pkt, sock1)); } @@ -121,7 +121,7 @@ TEST(PacketQueueRing6, enqueueDequeueTest) { // We should have transids 1003,1004,1005 Pkt6Ptr pkt; - for (int i = 3; i < 6; ++i) { + for (unsigned i = 3; i < 6; ++i) { ASSERT_NO_THROW(pkt = q->dequeuePacket()); ASSERT_TRUE(pkt); EXPECT_EQ(1000 + i, pkt->getTransid()); @@ -135,9 +135,9 @@ TEST(PacketQueueRing6, enqueueDequeueTest) { ASSERT_FALSE(pkt); // Enqueue three more packets. - for (int i = 0; i < 3; ++i) { - Pkt6Ptr pkt(new Pkt6(DHCPV6_SOLICIT, 1000+i)); - ASSERT_NO_THROW(q->enqueuePacket(pkt, sock1)); + for (unsigned i = 0; i < 3; ++i) { + Pkt6Ptr sol(new Pkt6(DHCPV6_SOLICIT, 1000+i)); + ASSERT_NO_THROW(q->enqueuePacket(sol, sock1)); } checkIntStat(q, "size", 3); @@ -154,7 +154,7 @@ TEST(PacketQueueRing6, peekPushPopTest) { PacketQueueRing6 q("kea-ring6", 3); // Push five packets onto the end. The first two should get pushed off. - for (int i = 1; i < 6; ++i) { + for (unsigned i = 1; i < 6; ++i) { Pkt6Ptr pkt(new Pkt6(DHCPV6_SOLICIT, 1000+i)); ASSERT_NO_THROW(q.pushPacket(pkt)); } @@ -277,7 +277,7 @@ TEST(TestQueue6, eatPacketsTest) { Pkt6Ptr pkt; // Let's add five packets. - for (int i = 1; i < 6; ++i) { + for (unsigned i = 1; i < 6; ++i) { pkt.reset(new Pkt6(DHCPV6_SOLICIT, 1000 + i)); ASSERT_NO_THROW(q.enqueuePacket(pkt, sock)); ASSERT_EQ(i, q.getSize()); diff --git a/src/lib/dhcpsrv/cb_ctl_dhcp4.cc b/src/lib/dhcpsrv/cb_ctl_dhcp4.cc index 211681bce4..0768a7c4ae 100644 --- a/src/lib/dhcpsrv/cb_ctl_dhcp4.cc +++ b/src/lib/dhcpsrv/cb_ctl_dhcp4.cc @@ -235,7 +235,7 @@ CBControlDHCPv4::databaseConfigApply(const BackendSelector& backend_selector, // We're only affected by the allocator change if this is the update from // the configuration backend. if (cb_update) { - auto allocator = CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::ALLOCATOR); + allocator = CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::ALLOCATOR); if (allocator && (allocator->getType() == Element::string)) { allocator_changed = (global_allocator != allocator->stringValue()); } diff --git a/src/lib/dhcpsrv/cb_ctl_dhcp6.cc b/src/lib/dhcpsrv/cb_ctl_dhcp6.cc index 1ed4820810..4dfed59f56 100644 --- a/src/lib/dhcpsrv/cb_ctl_dhcp6.cc +++ b/src/lib/dhcpsrv/cb_ctl_dhcp6.cc @@ -241,7 +241,7 @@ CBControlDHCPv6::databaseConfigApply(const db::BackendSelector& backend_selector // We're only affected by the allocator change if this is the update from // the configuration backend. if (cb_update) { - auto allocator = CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::ALLOCATOR); + allocator = CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::ALLOCATOR); if (allocator && (allocator->getType() == Element::string)) { allocator_changed = (global_allocator != allocator->stringValue()); } @@ -249,7 +249,7 @@ CBControlDHCPv6::databaseConfigApply(const db::BackendSelector& backend_selector // The address allocator hasn't changed. So, let's check if the PD allocator // has changed. if (!allocator_changed) { - auto allocator = CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::PD_ALLOCATOR); + allocator = CfgMgr::instance().getCurrentCfg()->getConfiguredGlobal(CfgGlobals::PD_ALLOCATOR); if (allocator && (allocator->getType() == Element::string)) { allocator_changed = (global_pd_allocator != allocator->stringValue()); } diff --git a/src/lib/dhcpsrv/host_mgr.cc b/src/lib/dhcpsrv/host_mgr.cc index eb9ebb91b5..c57eae4515 100644 --- a/src/lib/dhcpsrv/host_mgr.cc +++ b/src/lib/dhcpsrv/host_mgr.cc @@ -966,8 +966,8 @@ HostMgr::setIPReservationsUnique(const bool unique) { ip_reservations_unique_ = true; LOG_WARN(hosts_logger, HOSTS_MGR_NON_UNIQUE_IP_UNSUPPORTED) .arg(source->getType()); - for (auto const& source : alternate_sources_) { - source->setIPReservationsUnique(true); + for (auto const& src : alternate_sources_) { + src->setIPReservationsUnique(true); } return (false); } diff --git a/src/lib/dhcpsrv/lease_mgr.cc b/src/lib/dhcpsrv/lease_mgr.cc index ab769dd814..ec46fe2f97 100644 --- a/src/lib/dhcpsrv/lease_mgr.cc +++ b/src/lib/dhcpsrv/lease_mgr.cc @@ -143,18 +143,18 @@ LeaseMgr::recountLeaseStats4() { stats_mgr.setValue(name_da, zero); } - const std::string& name_rec_dec(StatsMgr::generateName("subnet", subnet_id, - StatsMgr::generateName("pool", pool->getID(), + const std::string& pname_rec_dec(StatsMgr::generateName("subnet", subnet_id, + StatsMgr::generateName("pool", pool->getID(), "reclaimed-declined-addresses"))); - if (!stats_mgr.getObservation(name_rec_dec)) { - stats_mgr.setValue(name_rec_dec, zero); + if (!stats_mgr.getObservation(pname_rec_dec)) { + stats_mgr.setValue(pname_rec_dec, zero); } - const std::string& name_rec(StatsMgr::generateName("subnet", subnet_id, - StatsMgr::generateName("pool", pool->getID(), + const std::string& pname_rec(StatsMgr::generateName("subnet", subnet_id, + StatsMgr::generateName("pool", pool->getID(), "reclaimed-leases"))); - if (!stats_mgr.getObservation(name_rec)) { - stats_mgr.setValue(name_rec, zero); + if (!stats_mgr.getObservation(pname_rec)) { + stats_mgr.setValue(pname_rec, zero); } } } diff --git a/src/lib/dhcpsrv/memfile_lease_mgr.cc b/src/lib/dhcpsrv/memfile_lease_mgr.cc index db4f5d577c..5cbe808b5c 100644 --- a/src/lib/dhcpsrv/memfile_lease_mgr.cc +++ b/src/lib/dhcpsrv/memfile_lease_mgr.cc @@ -2584,12 +2584,12 @@ Memfile_LeaseMgr::wipeLeases4(const SubnetID& subnet_id) { // Try to get the lease using the DUID, IAID and lease type. std::pair<Lease4StorageSubnetIdIndex::const_iterator, - Lease4StorageSubnetIdIndex::const_iterator> l = + Lease4StorageSubnetIdIndex::const_iterator> r = idx.equal_range(subnet_id); // Let's collect all leases. Lease4Collection leases; - BOOST_FOREACH(auto const& lease, l) { + BOOST_FOREACH(auto const& lease, r) { leases.push_back(lease); } @@ -2613,12 +2613,12 @@ Memfile_LeaseMgr::wipeLeases6(const SubnetID& subnet_id) { // Try to get the lease using the DUID, IAID and lease type. std::pair<Lease6StorageSubnetIdIndex::const_iterator, - Lease6StorageSubnetIdIndex::const_iterator> l = + Lease6StorageSubnetIdIndex::const_iterator> r = idx.equal_range(subnet_id); // Let's collect all leases. Lease6Collection leases; - BOOST_FOREACH(auto const& lease, l) { + BOOST_FOREACH(auto const& lease, r) { leases.push_back(lease); } diff --git a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc index 45d9db3a1f..aeb7942500 100644 --- a/src/lib/dhcpsrv/parsers/dhcp_parsers.cc +++ b/src/lib/dhcpsrv/parsers/dhcp_parsers.cc @@ -896,7 +896,7 @@ Subnet4ConfigParser::initSubnet(data::ConstElementPtr params, string prefix = subnet4o6.substr(0, slash); string lenstr = subnet4o6.substr(slash + 1); - uint8_t len = 128; + len = 128; try { len = boost::lexical_cast<unsigned int>(lenstr.c_str()); } catch (const boost::bad_lexical_cast &) { diff --git a/src/lib/dhcpsrv/parsers/shared_network_parser.cc b/src/lib/dhcpsrv/parsers/shared_network_parser.cc index 95e444339d..3a6915f60d 100644 --- a/src/lib/dhcpsrv/parsers/shared_network_parser.cc +++ b/src/lib/dhcpsrv/parsers/shared_network_parser.cc @@ -248,7 +248,7 @@ SharedNetwork6Parser::parse(const data::ConstElementPtr& shared_network_data, // Make sure that the network name has been specified. The name is required // to create a SharedNetwork6 object. - std::string name = getString(shared_network_data, "name"); + name = getString(shared_network_data, "name"); shared_network.reset(new SharedNetwork6(name)); ElementPtr mutable_params; diff --git a/src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc b/src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc index 09c9a36659..73939315b2 100644 --- a/src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc +++ b/src/lib/dhcpsrv/tests/alloc_engine4_unittest.cc @@ -4037,7 +4037,6 @@ TEST_F(AllocEngine4Test, storeExtendedInfoEnabled4) { false, false, "", false); // Iterate over the test scenarios. - Lease4Ptr lease; for (auto const& scenario : scenarios) { SCOPED_TRACE(scenario.description_); @@ -4141,8 +4140,6 @@ TEST_F(AllocEngine4Test, storeExtendedInfoDisabled4) { IOAddress::IPV4_ZERO_ADDRESS(), false, false, "", false); - Lease4Ptr lease; - // Iterate over the test scenarios. for (auto const& scenario : scenarios) { SCOPED_TRACE(scenario.description_); diff --git a/src/lib/dhcpsrv/tests/cfg_option_unittest.cc b/src/lib/dhcpsrv/tests/cfg_option_unittest.cc index 573899b7ab..636cc4a4cb 100644 --- a/src/lib/dhcpsrv/tests/cfg_option_unittest.cc +++ b/src/lib/dhcpsrv/tests/cfg_option_unittest.cc @@ -744,14 +744,14 @@ TEST_F(CfgOptionTest, encapsulate) { OptionUint8Ptr second_level_uint8 = boost::dynamic_pointer_cast< OptionUint8>(second_level_opt.second); ASSERT_TRUE(second_level_uint8); - const unsigned value = static_cast< + const unsigned value2 = static_cast< unsigned>(second_level_uint8->getValue()); // Certain sub-options should have a value of 3, other the values // of 4. if (second_level_uint8->getType() < 20) { - EXPECT_EQ(3, value); + EXPECT_EQ(3, value2); } else { - EXPECT_EQ(4, value); + EXPECT_EQ(4, value2); } } } diff --git a/src/lib/dhcpsrv/tests/flq_allocator_unittest.cc b/src/lib/dhcpsrv/tests/flq_allocator_unittest.cc index cca8b28ce1..eb9a368e8c 100644 --- a/src/lib/dhcpsrv/tests/flq_allocator_unittest.cc +++ b/src/lib/dhcpsrv/tests/flq_allocator_unittest.cc @@ -132,11 +132,11 @@ TEST_F(FreeLeaseQueueAllocatorTest4, singlePoolWithAllocations) { ++i; } - for (auto i = 0; i < 5; ++i) { - IOAddress candidate = alloc.pickAddress(cc_, clientid_, IOAddress("0.0.0.0")); + for (auto j = 0; j < 5; ++j) { + candidate = alloc.pickAddress(cc_, clientid_, IOAddress("0.0.0.0")); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, candidate)); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, candidate, cc_)); - auto lease = createLease4(candidate, i); + auto lease = createLease4(candidate, j); EXPECT_TRUE(lease_mgr.addLease(lease)); } @@ -179,8 +179,8 @@ TEST_F(FreeLeaseQueueAllocatorTest4, singlePoolWithReclamations) { } ++i; } - for (auto i = 0; i < 5; ++i) { - IOAddress candidate = alloc.pickAddress(cc_, clientid_, IOAddress("0.0.0.0")); + for (auto j = 0; j < 5; ++j) { + candidate = alloc.pickAddress(cc_, clientid_, IOAddress("0.0.0.0")); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, candidate)); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_V4, candidate, cc_)); auto lease = lease_mgr.getLease4(candidate); @@ -460,8 +460,8 @@ TEST_F(FreeLeaseQueueAllocatorTest6, singlePoolWithAllocations) { ++i; } - for (auto i = 0; i < 8; ++i) { - IOAddress candidate = alloc.pickAddress(cc_, duid_, IOAddress("::")); + for (auto j = 0; j < 8; ++j) { + candidate = alloc.pickAddress(cc_, duid_, IOAddress("::")); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, candidate)); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, candidate, cc_)); auto lease = createLease6(Lease::TYPE_NA, candidate, i); @@ -508,8 +508,8 @@ TEST_F(FreeLeaseQueueAllocatorTest6, singlePoolWithReclamations) { ++i; } - for (auto i = 0; i < 8; ++i) { - IOAddress candidate = alloc.pickAddress(cc_, duid_, IOAddress("::")); + for (auto j = 0; j < 8; ++j) { + candidate = alloc.pickAddress(cc_, duid_, IOAddress("::")); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, candidate)); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_NA, candidate, cc_)); auto lease = lease_mgr.getLease6(Lease::TYPE_NA, candidate); @@ -643,7 +643,7 @@ TEST_F(FreeLeaseQueueAllocatorTest6, clientClasses) { for (auto i = 0; i < 20; ++i) { // Allocate random addresses and make sure they belong to the // pools associated with the class bar. - IOAddress candidate = alloc.pickAddress(cc_, duid_, IOAddress("::")); + candidate = alloc.pickAddress(cc_, duid_, IOAddress("::")); EXPECT_FALSE(candidate.isV6Zero()); EXPECT_TRUE(lease_mgr.addLease(createLease6(Lease::TYPE_NA, candidate, i+50))); addresses_set.insert(candidate); @@ -655,7 +655,7 @@ TEST_F(FreeLeaseQueueAllocatorTest6, clientClasses) { // All pools should now be available. cc_.insert("foo"); for (auto i = 0; i < 27; ++i) { - IOAddress candidate = alloc.pickAddress(cc_, duid_, IOAddress("::")); + candidate = alloc.pickAddress(cc_, duid_, IOAddress("::")); addresses_set.insert(candidate); EXPECT_TRUE(lease_mgr.addLease(createLease6(Lease::TYPE_NA, candidate, i+100))); EXPECT_TRUE(subnet_->inRange(candidate)); @@ -766,11 +766,11 @@ TEST_F(FreeLeaseQueueAllocatorTest6, singlePdPoolWithAllocations) { ++i; } - for (auto i = 0; i < 128; ++i) { + for (auto j = 0; j < 128; ++j) { candidate = alloc.pickPrefix(cc_, pool, duid_, Allocator::PREFIX_LEN_HIGHER, IOAddress("::"), 0); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_PD, candidate)); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_PD, candidate, cc_)); - auto lease = createLease6(Lease::TYPE_PD, candidate, i); + auto lease = createLease6(Lease::TYPE_PD, candidate, j); EXPECT_TRUE(lease_mgr.addLease(lease)); } @@ -823,7 +823,7 @@ TEST_F(FreeLeaseQueueAllocatorTest6, singlePdPoolWithReclamations) { ++i; } - for (auto i = 0; i < 128; ++i) { + for (auto j = 0; j < 128; ++j) { candidate = alloc.pickPrefix(cc_, pool, duid_, Allocator::PREFIX_LEN_HIGHER, IOAddress("::"), 0); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_PD, candidate)); EXPECT_TRUE(subnet_->inPool(Lease::TYPE_PD, candidate, cc_)); diff --git a/src/lib/dhcpsrv/tests/ip_range_permutation_unittest.cc b/src/lib/dhcpsrv/tests/ip_range_permutation_unittest.cc index 92fbceda6e..1afa3b1ee8 100644 --- a/src/lib/dhcpsrv/tests/ip_range_permutation_unittest.cc +++ b/src/lib/dhcpsrv/tests/ip_range_permutation_unittest.cc @@ -47,7 +47,7 @@ TEST(IPRangePermutationTest, ipv4) { bool done = false; // Call the next() function 95 times. The first 91 calls should return non-zero // IP addresses. - for (auto i = 0; i < 95; ++i) { + for (auto j = 0; j < 95; ++j) { auto next = perm.next(done); if (!next.isV4Zero()) { // Make sure the returned address is within the range. @@ -56,7 +56,7 @@ TEST(IPRangePermutationTest, ipv4) { } // If we went over all addresses in the range, the flags indicating that // the permutation is exhausted should be set to true. - if (i >= 90) { + if (j >= 90) { EXPECT_TRUE(done); EXPECT_TRUE(perm.exhausted()); } else { @@ -110,7 +110,7 @@ TEST(IPRangePermutationTest, ipv6) { std::set<IOAddress> addrs; std::vector<IOAddress> ordered_addrs; bool done = false; - for (auto i = 0; i < 44335; ++i) { + for (auto j = 0; j < 44335; ++j) { auto next = perm.next(done); if (!next.isV6Zero()) { // Make sure that the address is within the range. @@ -119,7 +119,7 @@ TEST(IPRangePermutationTest, ipv6) { } // If we went over all addresses in the range, the flags indicating that // the permutation is exhausted should be set to true. - if (i >= 44333) { + if (j >= 44333) { EXPECT_TRUE(done); EXPECT_TRUE(perm.exhausted()); } else { @@ -171,7 +171,7 @@ TEST(IPRangePermutationTest, pd) { std::set<IOAddress> addrs; std::vector<IOAddress> ordered_addrs; bool done = false; - for (auto i = 0; i < 257; ++i) { + for (auto j = 0; j < 257; ++j) { auto next = perm.next(done); if (!next.isV6Zero()) { // Make sure the prefix is within the range. @@ -180,7 +180,7 @@ TEST(IPRangePermutationTest, pd) { } // If we went over all delegated prefixes in the range, the flags indicating // that the permutation is exhausted should be set to true. - if (i >= 255) { + if (j >= 255) { EXPECT_TRUE(done); EXPECT_TRUE(perm.exhausted()); } else { diff --git a/src/lib/dhcpsrv/tests/shared_network_unittest.cc b/src/lib/dhcpsrv/tests/shared_network_unittest.cc index 98c24bde1e..7e1fb44764 100644 --- a/src/lib/dhcpsrv/tests/shared_network_unittest.cc +++ b/src/lib/dhcpsrv/tests/shared_network_unittest.cc @@ -377,11 +377,11 @@ TEST(SharedNetwork4Test, getNextSubnet) { // Collect networks associated with our subnets in the vector. std::vector<SharedNetwork4Ptr> networks; for (auto i = 0; i < subnets.size(); ++i) { - SharedNetwork4Ptr network; - subnets[i]->getSharedNetwork(network); - ASSERT_TRUE(network) << "failed to retrieve shared network for a" + SharedNetwork4Ptr net; + subnets[i]->getSharedNetwork(net); + ASSERT_TRUE(net) << "failed to retrieve shared network for a" << " subnet id " << subnets[i]->getID(); - networks.push_back(network); + networks.push_back(net); } // All subnets should be associated with the same network. @@ -1127,11 +1127,11 @@ TEST(SharedNetwork6Test, getNextSubnet) { // Collect networks associated with our subnets in the vector. std::vector<SharedNetwork6Ptr> networks; for (auto i = 0; i < subnets.size(); ++i) { - SharedNetwork6Ptr network; - subnets[i]->getSharedNetwork(network); - ASSERT_TRUE(network) << "failed to retrieve shared network for a" + SharedNetwork6Ptr net; + subnets[i]->getSharedNetwork(net); + ASSERT_TRUE(net) << "failed to retrieve shared network for a" << " subnet id " << subnets[i]->getID(); - networks.push_back(network); + networks.push_back(net); } // All subnets should be associated with the same network. diff --git a/src/lib/dns/rdata.cc b/src/lib/dns/rdata.cc index b175dfa406..fec5d2d97e 100644 --- a/src/lib/dns/rdata.cc +++ b/src/lib/dns/rdata.cc @@ -239,17 +239,17 @@ Generic::constructFromLexer(MasterLexer& lexer) { string hex_part; // Whitespace is allowed within hex data, so read to the end of input. while (true) { - const MasterToken& token = + const MasterToken& rdtoken = lexer.getNextToken(MasterToken::STRING, true); - if ((token.getType() == MasterToken::END_OF_FILE) || - (token.getType() == MasterToken::END_OF_LINE)) { + if ((rdtoken.getType() == MasterToken::END_OF_FILE) || + (rdtoken.getType() == MasterToken::END_OF_LINE)) { // Unget the last read token as createRdata() expects us // to leave it at the end-of-line or end-of-file when we // return. lexer.ungetToken(); break; } - token.getString(hex_part); + rdtoken.getString(hex_part); hex_txt.append(hex_part); } diff --git a/src/lib/dns/tests/rdata_tkey_unittest.cc b/src/lib/dns/tests/rdata_tkey_unittest.cc index 31c64bc910..40ca68b789 100644 --- a/src/lib/dns/tests/rdata_tkey_unittest.cc +++ b/src/lib/dns/tests/rdata_tkey_unittest.cc @@ -102,7 +102,7 @@ protected: } template <typename Output> - void toWireCommonChecks(Output& output) const; + void toWireCommonChecks(Output& output); const string valid_text1; const string valid_text2; @@ -343,9 +343,7 @@ TEST_F(Rdata_TKEY_Test, assignment) { template <typename Output> void -Rdata_TKEY_Test::toWireCommonChecks(Output& output) const { - vector<uint8_t> expect_data; - +Rdata_TKEY_Test::toWireCommonChecks(Output& output) { output.clear(); expect_data.clear(); rdata_tkey.toWire(output); diff --git a/src/lib/dns/tests/rdata_tsig_unittest.cc b/src/lib/dns/tests/rdata_tsig_unittest.cc index a9cab140b5..c128911526 100644 --- a/src/lib/dns/tests/rdata_tsig_unittest.cc +++ b/src/lib/dns/tests/rdata_tsig_unittest.cc @@ -95,7 +95,7 @@ protected: } template <typename Output> - void toWireCommonChecks(Output& output) const; + void toWireCommonChecks(Output& output); const string valid_text1; const string valid_text2; @@ -328,9 +328,7 @@ TEST_F(Rdata_TSIG_Test, assignment) { template <typename Output> void -Rdata_TSIG_Test::toWireCommonChecks(Output& output) const { - vector<uint8_t> expect_data; - +Rdata_TSIG_Test::toWireCommonChecks(Output& output) { output.clear(); expect_data.clear(); rdata_tsig.toWire(output); diff --git a/src/lib/dns/tests/rdata_unittest.h b/src/lib/dns/tests/rdata_unittest.h index b2ba483170..20a376d7fa 100644 --- a/src/lib/dns/tests/rdata_unittest.h +++ b/src/lib/dns/tests/rdata_unittest.h @@ -55,13 +55,13 @@ protected: } std::stringstream ss(rdata_txt); - MasterLexer lexer; - lexer.pushSource(ss); + MasterLexer llexer; + llexer.pushSource(ss); if (throw_lexer_version) { - EXPECT_THROW(RdataType rdata(lexer, origin, MasterLoader::DEFAULT, + EXPECT_THROW(RdataType rdata(llexer, origin, MasterLoader::DEFAULT, loader_cb), ExForLexer); } else { - EXPECT_EQ(0, RdataType(lexer, origin, MasterLoader::DEFAULT, + EXPECT_EQ(0, RdataType(llexer, origin, MasterLoader::DEFAULT, loader_cb).compare(rdata_expected)); } } diff --git a/src/lib/log/tests/message_initializer_1_unittest.cc b/src/lib/log/tests/message_initializer_1_unittest.cc index c34139a01e..aa8ddbbc0e 100644 --- a/src/lib/log/tests/message_initializer_1_unittest.cc +++ b/src/lib/log/tests/message_initializer_1_unittest.cc @@ -225,8 +225,15 @@ TEST(MessageInitializerTest1, duplicates) { "DUPE", "dupe", NULL }; +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wshadow" +#endif const MessageInitializer init_message_initializer_unittest_1(dupe); const MessageInitializer init_message_initializer_unittest_2(dupe); +#if defined(__GNUC__) || defined(__clang__) +#pragma GCC diagnostic pop +#endif MessageInitializer::loadDictionary(); // Should be a dupe now diff --git a/src/lib/tcp/tcp_stream_msg.cc b/src/lib/tcp/tcp_stream_msg.cc index 439ac8382d..ebc1232d8c 100644 --- a/src/lib/tcp/tcp_stream_msg.cc +++ b/src/lib/tcp/tcp_stream_msg.cc @@ -74,7 +74,7 @@ TcpStreamRequest::logFormatRequest(const size_t limit) const { << ", data: " << isc::util::str::dumpAsHex(wire_data_.data(), max); } catch (const std::exception& ex) { - std::stringstream output; + output = std::stringstream(); output << "logFormatRequest error: " << ex.what(); } |