BIND 10 trac2304, updated. 9a52c2a5a52c35056f650594216366cac5560af1 [2304] Fixed build issues on Mac and BSD systems.
BIND 10 source code commits
bind10-changes at lists.isc.org
Mon Oct 22 13:02:22 UTC 2012
The branch, trac2304 has been updated
via 9a52c2a5a52c35056f650594216366cac5560af1 (commit)
from c974d3a5e481c63242f128f630b9e7e5ac4f1359 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 9a52c2a5a52c35056f650594216366cac5560af1
Author: Marcin Siodelski <marcin at isc.org>
Date: Mon Oct 22 14:40:12 2012 +0200
[2304] Fixed build issues on Mac and BSD systems.
-----------------------------------------------------------------------
Summary of changes:
src/lib/dhcp/option6_int.h | 10 ++++++---
src/lib/dhcp/option6_int_array.h | 10 ++++++---
src/lib/dhcp/tests/option_definition_unittest.cc | 25 +++++++++++-----------
3 files changed, 27 insertions(+), 18 deletions(-)
-----------------------------------------------------------------------
diff --git a/src/lib/dhcp/option6_int.h b/src/lib/dhcp/option6_int.h
index 02df9ab..5fd5c19 100644
--- a/src/lib/dhcp/option6_int.h
+++ b/src/lib/dhcp/option6_int.h
@@ -21,7 +21,6 @@
#include <util/io_utilities.h>
#include <stdint.h>
-#include <limits>
namespace isc {
namespace dhcp {
@@ -131,7 +130,8 @@ public:
// order from the provided buffer. The same functions can be safely used
// for either unsiged or signed integers so there is not need to create
// special cases for intX_t types.
- switch (OptionDataTypes<T>::len) {
+ int data_size_len = OptionDataTypes<T>::len;
+ switch (data_size_len) {
case 1:
value_ = *begin;
break;
@@ -144,7 +144,11 @@ public:
default:
isc_throw(dhcp::InvalidDataType, "non-integer type");
}
- begin += OptionDataTypes<T>::len;
+ // Use local variable to set a new value for this iterator.
+ // When using OptionDataTypes<T>::len directly some versions
+ // of clang complain about unresolved reference to
+ // OptionDataTypes structure during linking.
+ begin += data_size_len;
LibDHCP::unpackOptions6(OptionBuffer(begin, end), options_);
}
diff --git a/src/lib/dhcp/option6_int_array.h b/src/lib/dhcp/option6_int_array.h
index b6b2369..57aad1e 100644
--- a/src/lib/dhcp/option6_int_array.h
+++ b/src/lib/dhcp/option6_int_array.h
@@ -21,7 +21,6 @@
#include <util/io_utilities.h>
#include <stdint.h>
-#include <limits>
namespace isc {
namespace dhcp {
@@ -167,7 +166,8 @@ public:
// order from the provided buffer. The same functions can be safely used
// for either unsiged or signed integers so there is not need to create
// special cases for intX_t types.
- switch (OptionDataTypes<T>::len) {
+ int data_size_len = OptionDataTypes<T>::len;
+ switch (data_size_len) {
case 1:
values_.push_back(*begin);
break;
@@ -180,7 +180,11 @@ public:
default:
isc_throw(dhcp::InvalidDataType, "non-integer type");
}
- begin += sizeof(T);
+ // Use local variable to set a new value for this iterator.
+ // When using OptionDataTypes<T>::len directly some versions
+ // of clang complain about unresolved reference to
+ // OptionDataTypes structure during linking.
+ begin += data_size_len;
}
// We do not unpack sub-options here because we have array-type option.
// Such option have variable number of data fields, thus there is no
diff --git a/src/lib/dhcp/tests/option_definition_unittest.cc b/src/lib/dhcp/tests/option_definition_unittest.cc
index f688956..692bfa9 100644
--- a/src/lib/dhcp/tests/option_definition_unittest.cc
+++ b/src/lib/dhcp/tests/option_definition_unittest.cc
@@ -176,7 +176,7 @@ TEST_F(OptionDefinitionTest, factoryAddrList6) {
ASSERT_NO_THROW(
option_v6 = factory(Option::V6, D6O_NIS_SERVERS, buf);
);
- ASSERT_EQ(typeid(*option_v6), typeid(Option6AddrLst));
+ ASSERT_TRUE(typeid(*option_v6) == typeid(Option6AddrLst));
boost::shared_ptr<Option6AddrLst> option_cast_v6 =
boost::static_pointer_cast<Option6AddrLst>(option_v6);
ASSERT_TRUE(option_cast_v6);
@@ -185,7 +185,7 @@ TEST_F(OptionDefinitionTest, factoryAddrList6) {
option_cast_v6->getAddresses();
// The list of addresses must exactly match addresses that we
// stored in the buffer to create the option from it.
- EXPECT_EQ(addrs, addrs_returned);
+ EXPECT_TRUE(std::equal(addrs.begin(), addrs.end(), addrs_returned.begin()));
// The provided buffer's length must be a multiple of V6 address length.
// Let's extend the buffer by one byte so as this condition is not
@@ -226,7 +226,7 @@ TEST_F(OptionDefinitionTest, factoryAddrList4) {
ASSERT_NO_THROW(
option_v4 = factory(Option::V4, DHO_NAME_SERVERS, buf)
);
- ASSERT_EQ(typeid(*option_v4), typeid(Option4AddrLst));
+ ASSERT_TRUE(typeid(*option_v4) == typeid(Option4AddrLst));
// Get the list of parsed addresses from the option object.
boost::shared_ptr<Option4AddrLst> option_cast_v4 =
boost::static_pointer_cast<Option4AddrLst>(option_v4);
@@ -234,7 +234,7 @@ TEST_F(OptionDefinitionTest, factoryAddrList4) {
option_cast_v4->getAddresses();
// The list of addresses must exactly match addresses that we
// stored in the buffer to create the option from it.
- EXPECT_EQ(addrs, addrs_returned);
+ EXPECT_TRUE(std::equal(addrs.begin(), addrs.end(), addrs_returned.begin()));
// The provided buffer's length must be a multiple of V4 address length.
// Let's extend the buffer by one byte so as this condition is not
@@ -255,7 +255,7 @@ TEST_F(OptionDefinitionTest, factoryEmpty) {
ASSERT_NO_THROW(
option_v6 = factory(Option::V6, D6O_RAPID_COMMIT, OptionBuffer())
);
- ASSERT_EQ(typeid(*option_v6), typeid(Option));
+ ASSERT_TRUE(typeid(*option_v6) == typeid(Option));
// Expect 'empty' DHCPv6 option.
EXPECT_EQ(Option::V6, option_v6->getUniverse());
EXPECT_EQ(4, option_v6->getHeaderLen());
@@ -298,7 +298,7 @@ TEST_F(OptionDefinitionTest, factoryIA6) {
}
OptionPtr option_v6;
ASSERT_NO_THROW(option_v6 = factory(Option::V6, D6O_IA_NA, buf));
- ASSERT_EQ(typeid(*option_v6), typeid(Option6IA));
+ ASSERT_TRUE(typeid(*option_v6) == typeid(Option6IA));
boost::shared_ptr<Option6IA> option_cast_v6 =
boost::static_pointer_cast<Option6IA>(option_v6);
EXPECT_EQ(0x00010203, option_cast_v6->getIAID());
@@ -353,7 +353,7 @@ TEST_F(OptionDefinitionTest, factoryIAAddr6) {
} catch (const Exception& e) {
std::cout << e.what() << std::endl;
}
- ASSERT_EQ(typeid(*option_v6), typeid(Option6IAAddr));
+ ASSERT_TRUE(typeid(*option_v6) == typeid(Option6IAAddr));
boost::shared_ptr<Option6IAAddr> option_cast_v6 =
boost::static_pointer_cast<Option6IAAddr>(option_v6);
EXPECT_EQ(addr_v6, option_cast_v6->getAddress());
@@ -399,7 +399,8 @@ TEST_F(OptionDefinitionTest, factoryUint8) {
ASSERT_NO_THROW(
option_v6 = factory(Option::V6, D6O_PREFERENCE, OptionBuffer(1, 1));
);
- ASSERT_EQ(typeid(*option_v6), typeid(Option6Int<uint8_t>)); // Validate the value.
+ ASSERT_TRUE(typeid(*option_v6) == typeid(Option6Int<uint8_t>));
+ // Validate the value.
boost::shared_ptr<Option6Int<uint8_t> > option_cast_v6 =
boost::static_pointer_cast<Option6Int<uint8_t> >(option_v6);
EXPECT_EQ(1, option_cast_v6->getValue());
@@ -433,7 +434,7 @@ TEST_F(OptionDefinitionTest, factoryUint16) {
ASSERT_NO_THROW(
option_v6 = factory(Option::V6, D6O_ELAPSED_TIME, buf);
);
- ASSERT_EQ(typeid(*option_v6), typeid(Option6Int<uint16_t>));
+ ASSERT_TRUE(typeid(*option_v6) == typeid(Option6Int<uint16_t>));
// Validate the value.
boost::shared_ptr<Option6Int<uint16_t> > option_cast_v6 =
boost::static_pointer_cast<Option6Int<uint16_t> >(option_v6);
@@ -468,7 +469,7 @@ TEST_F(OptionDefinitionTest, factoryUint32) {
ASSERT_NO_THROW(
option_v6 = factory(Option::V6, D6O_CLT_TIME, buf);
);
- ASSERT_EQ(typeid(*option_v6), typeid(Option6Int<uint32_t>));
+ ASSERT_TRUE(typeid(*option_v6) == typeid(Option6Int<uint32_t>));
// Validate the value.
boost::shared_ptr<Option6Int<uint32_t> > option_cast_v6 =
boost::static_pointer_cast<Option6Int<uint32_t> >(option_v6);
@@ -508,7 +509,7 @@ TEST_F(OptionDefinitionTest, factoryUint16Array) {
EXPECT_NO_THROW(
option_v6 = factory(Option::V6, opt_code, buf);
);
- ASSERT_EQ(typeid(*option_v6), typeid(Option6IntArray<uint16_t>));
+ ASSERT_TRUE(typeid(*option_v6) == typeid(Option6IntArray<uint16_t>));
boost::shared_ptr<Option6IntArray<uint16_t> > option_cast_v6 =
boost::static_pointer_cast<Option6IntArray<uint16_t> >(option_v6);
// Get the values from the initiated options and validate.
@@ -555,7 +556,7 @@ TEST_F(OptionDefinitionTest, factoryUint32Array) {
EXPECT_NO_THROW(
option_v6 = factory(Option::V6, opt_code, buf);
);
- ASSERT_EQ(typeid(*option_v6), typeid(Option6IntArray<uint32_t>));
+ ASSERT_TRUE(typeid(*option_v6) == typeid(Option6IntArray<uint32_t>));
boost::shared_ptr<Option6IntArray<uint32_t> > option_cast_v6 =
boost::static_pointer_cast<Option6IntArray<uint32_t> >(option_v6);
// Get the values from the initiated options and validate.
More information about the bind10-changes
mailing list