]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[#2617] fixed warnings on macos clang c++20
authorRazvan Becheriu <razvan@isc.org>
Mon, 5 Dec 2022 16:03:55 +0000 (18:03 +0200)
committerAndrei Pavel <andrei@isc.org>
Tue, 6 Dec 2022 13:28:49 +0000 (15:28 +0200)
15 files changed:
src/bin/d2/tests/d2_queue_mgr_unittests.cc
src/bin/netconf/tests/control_socket_unittests.cc
src/lib/dhcp_ddns/ncr_msg.cc
src/lib/dhcp_ddns/ncr_msg.h
src/lib/dhcpsrv/shared_network.cc
src/lib/dhcpsrv/tests/cfg_shared_networks4_unittest.cc
src/lib/dhcpsrv/tests/cfg_shared_networks6_unittest.cc
src/lib/dhcpsrv/tests/client_class_def_parser_unittest.cc
src/lib/dhcpsrv/tests/memfile_lease_extended_info_unittest.cc
src/lib/log/logger_impl.h
src/lib/process/config_ctl_info.cc
src/lib/process/config_ctl_info.h
src/lib/tcp/tcp_listener.cc
src/lib/tcp/tests/mt_tcp_listener_mgr_unittests.cc
src/lib/yang/translator.h

index 42177e6f6a67909b0a56cc9772877b09a68acb1b..f855c2e8b72351f56ec88c1ac9231a03e0860434 100644 (file)
@@ -156,7 +156,7 @@ TEST(D2QueueMgrBasicTest, basicQueue) {
 
         // Verify the peeked entry is the one it should be.
         ASSERT_TRUE(ncr);
-        EXPECT_TRUE (*(ref_msgs[i]) == *ncr);
+        EXPECT_EQ(*(ref_msgs[i]), *ncr);
 
         // Verify that peek did not alter the queue size.
         EXPECT_EQ(VALID_MSG_CNT - i, queue_mgr->getQueueSize());
@@ -181,13 +181,13 @@ TEST(D2QueueMgrBasicTest, basicQueue) {
 
     // Verify that peekAt returns the correct entry.
     EXPECT_NO_THROW(ncr = queue_mgr->peekAt(1));
-    EXPECT_TRUE (*(ref_msgs[1]) == *ncr);
+    EXPECT_EQ(*(ref_msgs[1]), *ncr);
 
     // Verify that dequeueAt removes the correct entry.
     // Removing it, this should shift the queued entries forward by one.
     EXPECT_NO_THROW(queue_mgr->dequeueAt(1));
     EXPECT_NO_THROW(ncr = queue_mgr->peekAt(1));
-    EXPECT_TRUE (*(ref_msgs[2]) == *ncr);
+    EXPECT_EQ(*(ref_msgs[2]), *ncr);
 
     // Verify the peekAt and dequeueAt throw when given indexes beyond the end.
     EXPECT_THROW(queue_mgr->peekAt(VALID_MSG_CNT + 1), D2QueueMgrInvalidIndex);
index 8a95d9bb4b3583f1bad0fbe128f24c86f3e2ff99..f0abe133d4fd17263af169665e03aecdf40bad1d 100644 (file)
@@ -455,7 +455,7 @@ protected:
     /// @param request Pointer to the HTTP request.
     /// @return Pointer to an object representing HTTP response.
     virtual HttpResponsePtr
-    createDynamicHttpResponse(HttpRequestPtr request) {
+    createDynamicHttpResponse(HttpRequestPtr request) override {
         // Request must always be JSON.
         PostHttpRequestJsonPtr request_json =
             boost::dynamic_pointer_cast<PostHttpRequestJson>(request);
index cc595b4dc8e252518d59357f3685b82fb0f25191..ddc01e89d815aecdbf8731269ddc6cf6c1afc8ce 100644 (file)
@@ -674,7 +674,7 @@ NameChangeRequest::toText() const {
 }
 
 bool
-NameChangeRequest::operator == (const NameChangeRequest& other) {
+NameChangeRequest::operator == (const NameChangeRequest& other) const {
     return ((change_type_ == other.change_type_) &&
             (forward_change_ == other.forward_change_) &&
             (reverse_change_ == other.reverse_change_) &&
@@ -687,7 +687,7 @@ NameChangeRequest::operator == (const NameChangeRequest& other) {
 }
 
 bool
-NameChangeRequest::operator != (const NameChangeRequest& other) {
+NameChangeRequest::operator != (const NameChangeRequest& other) const {
     return (!(*this == other));
 }
 
index e3a708fb3f93430c31e69be7995f222cc57d8d96..fe8dbb16cd140f460f06cfe351e484f73308ff57 100644 (file)
@@ -709,8 +709,8 @@ public:
     /// @return a string containing the text.
     std::string toText() const;
 
-    bool operator == (const NameChangeRequest& b);
-    bool operator != (const NameChangeRequest& b);
+    bool operator == (const NameChangeRequest& b) const;
+    bool operator != (const NameChangeRequest& b) const;
 
 private:
     /// @brief Denotes the type of this change as either an Add or a Remove.
index d63fc023616d6e31a9142f63785b2c8ef01144b6..61e5e3aa15fb1c05e3e7ba4f3037f40145a1e245 100644 (file)
@@ -304,7 +304,7 @@ public:
 
         auto preferred_subnet = selected_subnet;
         for (auto s = subnets.begin(); s != subnets.end(); ++s) {
-            if ((*s)->getClientClass() != selected_subnet->getClientClass()) {
+            if ((*s)->getClientClass().get() != selected_subnet->getClientClass().get()) {
                 continue;
             }
             auto current_subnet_state = (*s)->getAllocationState();
index d81be1e2e541fbbbccd924d2fdf0d9b85ecff170..4c49218f2ca4c551be42323deec7d9e17dadb7b3 100644 (file)
@@ -31,7 +31,7 @@ void checkMergedNetwork(const CfgSharedNetworks4& networks, const std::string& n
                        const std::vector<SubnetID>& exp_subnets) {
     auto network = networks.getByName(name);
     ASSERT_TRUE(network) << "expected network: " << name << " not found";
-    ASSERT_EQ(exp_valid, network->getValid()) << " network valid lifetime wrong";
+    ASSERT_EQ(exp_valid, network->getValid().get()) << " network valid lifetime wrong";
     const Subnet4SimpleCollection* subnets = network->getAllSubnets();
     ASSERT_EQ(exp_subnets.size(), subnets->size()) << " wrong number of subnets";
     for (auto exp_id : exp_subnets) {
index a9a45d9a91f56577b43dde920cb90470849b13e7..53a2fa8bb116eef1b7e270421fdb98fabf36eca8 100644 (file)
@@ -31,7 +31,7 @@ void checkMergedNetwork(const CfgSharedNetworks6& networks, const std::string& n
                         const std::vector<SubnetID>& exp_subnets) {
     auto network = networks.getByName(name);
     ASSERT_TRUE(network) << "expected network: " << name << " not found";
-    ASSERT_EQ(exp_valid, network->getValid()) << " network valid lifetime wrong";
+    ASSERT_EQ(exp_valid, network->getValid().get()) << " network valid lifetime wrong";
     const Subnet6SimpleCollection* subnets = network->getAllSubnets();
     ASSERT_EQ(exp_subnets.size(), subnets->size()) << " wrong number of subnets";
     for (auto exp_id : exp_subnets) {
index 9b3da681340da36e6eca925d24c0e0ccf59e5a17..a97b1c88471ade3821ba021ee2316d4b8f2f4e97 100644 (file)
@@ -1968,7 +1968,7 @@ TEST_F(ClientClassDefParserTest, validLifetimeTests) {
             if (scenario.exp_triplet_.unspecified()) {
                 EXPECT_TRUE(class_def->getValid().unspecified());
             } else {
-                EXPECT_EQ(class_def->getValid(), scenario.exp_triplet_);
+                EXPECT_EQ(class_def->getValid().unspecified(), scenario.exp_triplet_.unspecified());
                 EXPECT_EQ(class_def->getValid().getMin(), scenario.exp_triplet_.getMin());
                 EXPECT_EQ(class_def->getValid().get(), scenario.exp_triplet_.get());
                 EXPECT_EQ(class_def->getValid().getMax(), scenario.exp_triplet_.getMax());
@@ -2031,7 +2031,7 @@ TEST_F(ClientClassDefParserTest, preferredLifetimeTests) {
             if (scenario.exp_triplet_.unspecified()) {
                 EXPECT_TRUE(class_def->getPreferred().unspecified());
             } else {
-                EXPECT_EQ(class_def->getPreferred(), scenario.exp_triplet_);
+                EXPECT_EQ(class_def->getPreferred().unspecified(), scenario.exp_triplet_.unspecified());
                 EXPECT_EQ(class_def->getPreferred().getMin(), scenario.exp_triplet_.getMin());
                 EXPECT_EQ(class_def->getPreferred().get(), scenario.exp_triplet_.get());
                 EXPECT_EQ(class_def->getPreferred().getMax(), scenario.exp_triplet_.getMax());
index f9e26d2f6134d2660ecc95c7876cd21cab88d7fc..198fefe22551fa4649e71daa483952106bea3bc6 100644 (file)
@@ -1066,7 +1066,7 @@ TEST_F(MemfileExtendedInfoTest, deleteLease6) {
     EXPECT_NE(lease_addr, lease->addr_);
     // Put a value different of the expected one.
     lease->extended_info_action_ = Lease::ACTION_UPDATE;
-    bool ret;
+    bool ret = false;
     EXPECT_NO_THROW(ret = lease_mgr_->deleteLease(lease));
     EXPECT_TRUE(ret);
     EXPECT_EQ(Lease::ACTION_IGNORE, lease->extended_info_action_);
@@ -1108,7 +1108,7 @@ TEST_F(MemfileExtendedInfoTest, deleteLease6disabled) {
     EXPECT_EQ(lease_addr, lease->addr_);
     // Put a value different from the expected one.
     lease->extended_info_action_ = Lease::ACTION_UPDATE;
-    bool ret;
+    bool ret = false;
     EXPECT_NO_THROW(ret = lease_mgr_->deleteLease(lease));
     EXPECT_TRUE(ret);
     EXPECT_EQ(Lease::ACTION_IGNORE, lease->extended_info_action_);
@@ -1141,7 +1141,7 @@ TEST_F(MemfileExtendedInfoTest, addLease6) {
     lease->setContext(user_context);
     // Put a value different of the expected one.
     lease->extended_info_action_ = Lease::ACTION_DELETE;
-    bool ret;
+    bool ret = false;
     EXPECT_NO_THROW(ret = lease_mgr_->addLease(lease));
     EXPECT_TRUE(ret);
     EXPECT_EQ(Lease::ACTION_IGNORE, lease->extended_info_action_);
@@ -1191,7 +1191,7 @@ TEST_F(MemfileExtendedInfoTest, addLease6disabled) {
     ASSERT_NO_THROW(user_context = Element::fromJSON(user_context_txt));
     lease->setContext(user_context);
     lease->extended_info_action_ = Lease::ACTION_UPDATE;
-    bool ret;
+    bool ret = false;
     EXPECT_NO_THROW(ret = lease_mgr_->addLease(lease));
     EXPECT_TRUE(ret);
     EXPECT_EQ(Lease::ACTION_IGNORE, lease->extended_info_action_);
@@ -1214,7 +1214,7 @@ TEST_F(MemfileExtendedInfoTest, updateLease6ignore) {
                                            123, 1000, 2000, 1)));
 
     // Add the lease.
-    bool ret;
+    bool ret = false;
     EXPECT_NO_THROW(ret = lease_mgr_->addLease(lease));
     EXPECT_TRUE(ret);
 
@@ -1269,7 +1269,7 @@ TEST_F(MemfileExtendedInfoTest, updateLease6delete) {
     lease->setContext(user_context);
 
     // Add the lease.
-    bool ret;
+    bool ret = false;
     EXPECT_NO_THROW(ret = lease_mgr_->addLease(lease));
     EXPECT_TRUE(ret);
     EXPECT_EQ(1, lease_mgr_->relay_id6_.size());
@@ -1310,7 +1310,7 @@ TEST_F(MemfileExtendedInfoTest, updateLease6deleteDisabled) {
     lease->setContext(user_context);
 
     // Add the lease.
-    bool ret;
+    bool ret = false;
     EXPECT_NO_THROW(ret = lease_mgr_->addLease(lease));
     EXPECT_TRUE(ret);
     EXPECT_EQ(1, lease_mgr_->relay_id6_.size());
@@ -1347,7 +1347,7 @@ TEST_F(MemfileExtendedInfoTest, updateLease6update) {
                                            123, 1000, 2000, 1)));
 
     // Add the lease.
-    bool ret;
+    bool ret = false;
     EXPECT_NO_THROW(ret = lease_mgr_->addLease(lease));
     EXPECT_TRUE(ret);
     EXPECT_TRUE(lease_mgr_->relay_id6_.empty());
@@ -1407,7 +1407,7 @@ TEST_F(MemfileExtendedInfoTest, updateLease6updateDisabled) {
                                            123, 1000, 2000, 1)));
 
     // Add the lease.
-    bool ret;
+    bool ret = false;
     EXPECT_NO_THROW(ret = lease_mgr_->addLease(lease));
     EXPECT_TRUE(ret);
 
@@ -1459,7 +1459,7 @@ TEST_F(MemfileExtendedInfoTest, updateLease6update2) {
     lease->setContext(user_context);
 
     // Add the lease.
-    bool ret;
+    bool ret = false;
     EXPECT_NO_THROW(ret = lease_mgr_->addLease(lease));
     EXPECT_TRUE(ret);
 
index 25e61572a52592389acbb982508d0cd71bec298c..d7dad452aedef8079fe31dd7eb84801f202c50fa 100644 (file)
@@ -191,7 +191,7 @@ public:
     /// (This method is principally for testing.)
     ///
     /// \return true if the logger objects are instances of the same logger.
-    bool operator==(const LoggerImpl& other) {
+    bool operator==(const LoggerImpl& other) const {
         return (name_ == other.name_);
     }
 
index 4b1d9fa98e68f9d8375d66edd36adcb1d1141930..5c6aca7ca6eae9bc24285671eba0821692f65db6 100644 (file)
@@ -36,11 +36,11 @@ bool
 ConfigDbInfo::getParameterValue(const std::string& name, std::string& value) const {
     auto param = access_params_.find(name);
     if (param == access_params_.end()) {
-        return(false);
+        return (false);
     }
 
     value = param->second;
-    return(true);
+    return (true);
 }
 
 //******** ConfigControlInfo ********//
@@ -117,13 +117,13 @@ ConfigControlInfo::toElement() const {
                     Element::create(static_cast<int>(config_fetch_wait_time_)));
     }
 
-    return(result);
+    return (result);
 }
 
 bool
 ConfigControlInfo::equals(const ConfigControlInfo& other) const {
-   return ((db_infos_ == other.db_infos_) &&
-           (config_fetch_wait_time_ == other.config_fetch_wait_time_));
+    return ((db_infos_ == other.db_infos_) &&
+            (config_fetch_wait_time_.get() == other.config_fetch_wait_time_.get()));
 }
 
 } // end of namespace isc::process
index 2c53d59fcffb2cd2242c593f96fe4963e5c65105..a4fbedb7414a1a558cceb9e4864c6874508c23f3 100644 (file)
@@ -50,7 +50,7 @@ public:
     ///
     /// @return database access string with password redacted.
     std::string redactedAccessString() const {
-        return(db::DatabaseConnection::redactedAccessString(access_params_));
+        return (db::DatabaseConnection::redactedAccessString(access_params_));
     }
 
     /// @brief Retrieve the map of parameter values.
index c63ea18c89a2e766ee2f3b00c043a89af83fd3d8..dd327ae994c32b4fa8f2b1d6189229249032054b 100644 (file)
@@ -45,7 +45,6 @@ TcpListener::TcpListener(IOService& io_service,
     }
 }
 
-
 TcpListener::~TcpListener() {
     stop();
 }
index 0052942342dfc36a316ec6a2662cf93ab41b962c..b5d805f38245f5539f7f93f857663b7f84ad10a5 100644 (file)
@@ -454,7 +454,6 @@ public:
 
         // Iterate over the clients, checking their outcomes.
         size_t total_responses = 0;
-        size_t connection_id = 1;
         for (auto const& client : clients_) {
             // Client should have completed its receive successfully.
             ASSERT_TRUE(client->receiveDone());
index 5413824b40c0dfed20f016bee7997032ac68ca42..5bbaa7d1022fc6e70edca3266ec1c1a66a9cd7c8 100644 (file)
@@ -13,6 +13,8 @@
 #include <sysrepo-cpp/Connection.hpp>
 #include <sysrepo-cpp/Session.hpp>
 
+#include <unordered_map>
+
 namespace isc {
 namespace yang {