From: Francis Dupont Date: Thu, 25 Jan 2018 10:13:17 +0000 (+0100) Subject: [5487] Spelling, missing override, more C++11 feature checks X-Git-Tag: trac5502_base~5^2~1^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f81e8464aef5f824c98d5c4ac289f985f7a9b2a2;p=thirdparty%2Fkea.git [5487] Spelling, missing override, more C++11 feature checks --- diff --git a/m4macros/ax_cpp11.m4 b/m4macros/ax_cpp11.m4 index cf6b2ba6d6..9f3025ebff 100644 --- a/m4macros/ax_cpp11.m4 +++ b/m4macros/ax_cpp11.m4 @@ -58,6 +58,24 @@ for retry in "none" "--std=c++11" "--std=c++0x" "--std=c++1x" "fail"; do [AC_MSG_RESULT([no]) continue]) + AC_MSG_CHECKING(override method support) + feature="override method" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [class Foo { + public: + virtual ~Foo() {}; + virtual void foobar(); + }; + class Bar : public Foo { + public: + virtual ~Bar() {}; + virtual void foobar() override; + };],[])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + continue]) + AC_MSG_CHECKING(aggregate initialization support) feature="aggregate initialization" AC_COMPILE_IFELSE( @@ -107,6 +125,19 @@ for retry in "none" "--std=c++11" "--std=c++0x" "--std=c++1x" "fail"; do [AC_MSG_RESULT([no]) continue]) + AC_MSG_CHECKING(constexpr support) + feature="constexpr" + AC_COMPILE_IFELSE( + [AC_LANG_PROGRAM( + [#include + typedef char const* const Tag; + constexpr Tag FOOBAR = "FOOBAR";], + [const std::string foobar(FOOBAR); + return static_cast(foobar.length());])], + [AC_MSG_RESULT([yes])], + [AC_MSG_RESULT([no]) + continue]) + AC_MSG_CHECKING(lambda support) feature="lambda" AC_COMPILE_IFELSE( diff --git a/src/lib/dhcpsrv/Makefile.am b/src/lib/dhcpsrv/Makefile.am index a9c5ea7c36..5dd692fb9c 100644 --- a/src/lib/dhcpsrv/Makefile.am +++ b/src/lib/dhcpsrv/Makefile.am @@ -17,7 +17,7 @@ if HAVE_PGSQL AM_CPPFLAGS += $(PGSQL_CPPFLAGS) endif if HAVE_CQL -AM_CPPFLAGS += $(CQL_CPPFLAGS) +AM_CPPFLAGS += $(CQL_CPPFLAGS) $(CRYPTO_INCLUDES) endif AM_CXXFLAGS = $(KEA_CXXFLAGS) diff --git a/src/lib/dhcpsrv/cql_host_data_source.cc b/src/lib/dhcpsrv/cql_host_data_source.cc index 13c1a594cc..0ef556591e 100644 --- a/src/lib/dhcpsrv/cql_host_data_source.cc +++ b/src/lib/dhcpsrv/cql_host_data_source.cc @@ -1,4 +1,4 @@ -// Copyright (C) 2016-2017 Deutsche Telekom AG. +// Copyright (C) 2016-2018 Deutsche Telekom AG. // // Author: Andrei Pavel // @@ -142,8 +142,7 @@ public: /// @brief Constructor /// /// Specifies table columns. - /// @param connection specifies the connection to conduct this exchange on - CqlHostExchange(CqlConnection& connection); + CqlHostExchange(); /// @brief Virtual destructor. virtual ~CqlHostExchange(); @@ -272,9 +271,6 @@ private: /// Pointer to Host object holding information being inserted into database. HostPtr host_; - /// @brief Connection to the Cassandra database - CqlConnection& connection_; - /// @brief Primary key. Aggregates: host_identifier, host_identifier_type, /// reserved_ipv6_prefix_address, reserved_ipv6_prefix_length, option_code, /// option_space. @@ -602,9 +598,9 @@ StatementMap CqlHostExchange::tagged_statements_ = { }; -CqlHostExchange::CqlHostExchange(CqlConnection& connection) - : host_(NULL), connection_(connection), id_(0), host_identifier_type_(0), - host_ipv4_subnet_id_(0), host_ipv6_subnet_id_(0), host_ipv4_address_(0), +CqlHostExchange::CqlHostExchange() + : host_(NULL), id_(0), host_identifier_type_(0), host_ipv4_subnet_id_(0), + host_ipv6_subnet_id_(0), host_ipv4_address_(0), reserved_ipv6_prefix_length_(NULL_RESERVED_IPV6_PREFIX_LENGTH), reserved_ipv6_prefix_address_type_(NULL_RESERVED_IPV6_PREFIX_ADDRESS_TYPE), iaid_(NULL_IAID), option_universe_(NULL_OPTION_UNIVERSE), @@ -1731,7 +1727,7 @@ CqlHostDataSourceImpl::getHostCollection(StatementTag statement_tag, AnyArray& where_values) const { // Run statement. - std::unique_ptr host_exchange(new CqlHostExchange(dbconn_)); + std::unique_ptr host_exchange(new CqlHostExchange()); AnyArray collection = host_exchange->executeSelect(dbconn_, where_values, statement_tag, false); @@ -1772,7 +1768,7 @@ CqlHostDataSourceImpl::insertHost(const HostPtr& host, const OptionDescriptor& option_descriptor) { AnyArray assigned_values; - std::unique_ptr host_exchange(new CqlHostExchange(dbconn_)); + std::unique_ptr host_exchange(new CqlHostExchange()); try { host_exchange->createBindForMutation( diff --git a/src/lib/dhcpsrv/cql_host_data_source.h b/src/lib/dhcpsrv/cql_host_data_source.h index 60ea0a805c..3b062b4037 100644 --- a/src/lib/dhcpsrv/cql_host_data_source.h +++ b/src/lib/dhcpsrv/cql_host_data_source.h @@ -1,4 +1,4 @@ -// Copyright (C) 2016-2017 Deutsche Telekom AG. +// Copyright (C) 2016-2018 Deutsche Telekom AG. // // Author: Andrei Pavel // @@ -274,7 +274,7 @@ public: /// there. /// @throw various exceptions in case of errors virtual bool del(const SubnetID& subnet_id, - const asiolink::IOAddress& addr); + const asiolink::IOAddress& addr) override; /// @brief Attempts to delete a host by (subnet-id4, identifier-type, /// identifier). @@ -292,7 +292,7 @@ public: virtual bool del4(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type, const uint8_t* identifier_begin, - const size_t identifier_len); + const size_t identifier_len) override; /// @brief Attempts to delete a host by (subnet-id6, identifier-type, /// identifier). @@ -310,7 +310,7 @@ public: virtual bool del6(const SubnetID& subnet_id, const Host::IdentifierType& identifier_type, const uint8_t* identifier_begin, - const size_t identifier_len); + const size_t identifier_len) override; /// @brief Returns textual description of the backend. /// diff --git a/src/lib/dhcpsrv/cql_lease_mgr.cc b/src/lib/dhcpsrv/cql_lease_mgr.cc index e40638e514..54db1a3c43 100644 --- a/src/lib/dhcpsrv/cql_lease_mgr.cc +++ b/src/lib/dhcpsrv/cql_lease_mgr.cc @@ -1447,7 +1447,7 @@ class CqlLeaseStatsQuery : public LeaseStatsQuery { public: /// @brief Constructor /// - /// @param conn A open connection to the database housing the lease data + /// @param conn An open connection to the database housing the lease data /// @param statement The lease data SQL prepared statement tag to execute /// @param fetch_type Indicates whether or not lease_type should be /// fetched from the result set (should be true for v6) diff --git a/src/lib/dhcpsrv/cql_lease_mgr.h b/src/lib/dhcpsrv/cql_lease_mgr.h index 03c68938d0..5bcc193229 100644 --- a/src/lib/dhcpsrv/cql_lease_mgr.h +++ b/src/lib/dhcpsrv/cql_lease_mgr.h @@ -203,12 +203,12 @@ public: /// @param subnet_id subnet identifier. /// /// @return Lease collection (may be empty if no IPv4 lease found). - virtual Lease4Collection getLeases4(SubnetID subnet_id) const; + virtual Lease4Collection getLeases4(SubnetID subnet_id) const override; /// @brief Returns all IPv4 leases. /// /// @return Lease collection (may be empty if no IPv4 lease found). - virtual Lease4Collection getLeases4() const; + virtual Lease4Collection getLeases4() const override; /// @brief Returns existing IPv6 lease for a given IPv6 address. /// @@ -330,7 +330,7 @@ public: /// /// @throw isc::dhcp::DbOperationError An operation on the open database has /// failed. - virtual bool deleteLease(const isc::asiolink::IOAddress& addr); + virtual bool deleteLease(const isc::asiolink::IOAddress& addr) override; /// @brief Deletes all expired and reclaimed DHCPv4 leases. /// @@ -360,7 +360,7 @@ public: /// The query object is then returned. /// /// @return The populated query as a pointer to an LeaseStatsQuery - virtual LeaseStatsQueryPtr startLeaseStatsQuery4(); + virtual LeaseStatsQueryPtr startLeaseStatsQuery4() override; /// @brief Creates and runs the IPv6 lease stats query /// @@ -370,7 +370,7 @@ public: /// The query object is then returned. /// /// @return The populated query as a pointer to an LeaseStatsQuery - virtual LeaseStatsQueryPtr startLeaseStatsQuery6(); + virtual LeaseStatsQueryPtr startLeaseStatsQuery6() override; /// @brief Removes specified IPv4 leases. /// @@ -381,7 +381,7 @@ public: /// /// @param subnet_id identifier of the subnet /// @return number of leases removed. - virtual size_t wipeLeases4(const SubnetID& subnet_id); + virtual size_t wipeLeases4(const SubnetID& subnet_id) override; /// @brief Removed specified IPv6 leases. /// @@ -392,7 +392,7 @@ public: /// /// @param subnet_id identifier of the subnet /// @return number of leases removed. - virtual size_t wipeLeases6(const SubnetID& subnet_id); + virtual size_t wipeLeases6(const SubnetID& subnet_id) override; /// @brief Return backend type /// diff --git a/src/lib/dhcpsrv/lease_mgr.h b/src/lib/dhcpsrv/lease_mgr.h index 7911be567b..3c60e09a22 100644 --- a/src/lib/dhcpsrv/lease_mgr.h +++ b/src/lib/dhcpsrv/lease_mgr.h @@ -134,7 +134,7 @@ struct LeaseStatsRow { /// @brief Base class for fulfilling a statistical lease data query /// /// LeaseMgr derivations implement this class such that it provides -/// upto date statistical lease data organized as rows of LeaseStatsRow +/// up to date statistical lease data organized as rows of LeaseStatsRow /// instances. The rows must be accessible in ascending order by subnet id. class LeaseStatsQuery { public: @@ -457,7 +457,7 @@ public: /// /// LeaseMgr derivations implement this method such that it creates and /// returns an instance of an LeaseStatsQuery whose result set has been - /// populated with upto date IPv4 lease statistical data. Each row of the + /// populated with up to date IPv4 lease statistical data. Each row of the /// result set is an LeaseStatRow which ordered ascending by subnet ID. /// /// @return A populated LeaseStatsQuery @@ -488,7 +488,7 @@ public: /// /// LeaseMgr derivations implement this method such that it creates and /// returns an instance of an LeaseStatsQuery whose result set has been - /// populated with upto date IPv6 lease statistical data. Each row of the + /// populated with up to date IPv6 lease statistical data. Each row of the /// result set is an LeaseStatRow which ordered ascending by subnet ID. /// /// @return A populated LeaseStatsQuery