From 92345b4b64cfb6d2d38620dc1c8ac0210d9c105f Mon Sep 17 00:00:00 2001 From: Alexander Holler Date: Sat, 15 Nov 2014 13:45:14 +0100 Subject: [PATCH 1/4] [persistent-data/space_map.h] Make destructor for space_map_detail::damage public The compiler is unable to create a default desctructor for the derived class missing_counts if the virtual destructor for the class damage is private. This fixes compilation bugs with CXXFLAGS=-std=gnu++11 together with gcc 4.8.3 and boost 1.55. --- persistent-data/space_map.h | 1 + 1 file changed, 1 insertion(+) diff --git a/persistent-data/space_map.h b/persistent-data/space_map.h index 5395c90..823b4ba 100644 --- a/persistent-data/space_map.h +++ b/persistent-data/space_map.h @@ -119,6 +119,7 @@ namespace persistent_data { namespace space_map_detail { class damage { + public: virtual ~damage() {} }; From baa70ecfe4a465b3cbba204a025d859603bd2f35 Mon Sep 17 00:00:00 2001 From: Alexander Holler Date: Sat, 15 Nov 2014 14:17:22 +0100 Subject: [PATCH 2/4] [caching/hint_array.cc] Fix ambigious shared_ptr (C++11) Class shared_ptr exist in the namespace std for C++11 as well as in boost. Explicitly use the one from boost in order to be compatible. This fixes compilation bugs with CXXFLAGS=-std=gnu++11 together with gcc 4.8.3 and boost 1.55. --- caching/hint_array.cc | 46 +++++++++++++++++++++---------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/caching/hint_array.cc b/caching/hint_array.cc index cb9f2f1..7fccb82 100644 --- a/caching/hint_array.cc +++ b/caching/hint_array.cc @@ -38,16 +38,16 @@ namespace { xx(4); template - shared_ptr mk_array(transaction_manager &tm) { + boost::shared_ptr mk_array(transaction_manager &tm) { typedef hint_traits traits; typedef array ha; - shared_ptr r = typename ha::ptr(new ha(tm, typename traits::ref_counter())); + boost::shared_ptr r = typename ha::ptr(new ha(tm, typename traits::ref_counter())); return r; } - shared_ptr mk_array(transaction_manager &tm, uint32_t width) { + boost::shared_ptr mk_array(transaction_manager &tm, uint32_t width) { switch (width) { #define xx(n) case n: return mk_array(tm) @@ -58,15 +58,15 @@ namespace { } // never get here - return shared_ptr(); + return boost::shared_ptr(); } //-------------------------------- template - shared_ptr - downcast_array(shared_ptr base) { - shared_ptr a = dynamic_pointer_cast(base); + boost::shared_ptr + downcast_array(boost::shared_ptr base) { + boost::shared_ptr a = dynamic_pointer_cast(base); if (!a) throw runtime_error("internal error: couldn't cast hint array"); @@ -76,16 +76,16 @@ namespace { //-------------------------------- template - shared_ptr mk_array(transaction_manager &tm, block_address root, unsigned nr_entries) { + boost::shared_ptr mk_array(transaction_manager &tm, block_address root, unsigned nr_entries) { typedef hint_traits traits; typedef array ha; - shared_ptr r = typename ha::ptr(new ha(tm, typename traits::ref_counter(), root, nr_entries)); + boost::shared_ptr r = typename ha::ptr(new ha(tm, typename traits::ref_counter(), root, nr_entries)); return r; } - shared_ptr mk_array(transaction_manager &tm, uint32_t width, block_address root, unsigned nr_entries) { + boost::shared_ptr mk_array(transaction_manager &tm, uint32_t width, block_address root, unsigned nr_entries) { switch (width) { #define xx(n) case n: return mk_array(tm, root, nr_entries) all_widths @@ -95,21 +95,21 @@ namespace { } // never get here - return shared_ptr(); + return boost::shared_ptr(); } //-------------------------------- template - void get_hint(shared_ptr base, unsigned index, vector &data) { + void get_hint(boost::shared_ptr base, unsigned index, vector &data) { typedef hint_traits traits; typedef array ha; - shared_ptr a = downcast_array(base); + boost::shared_ptr a = downcast_array(base); data = a->get(index); } - void get_hint_(uint32_t width, shared_ptr base, unsigned index, vector &data) { + void get_hint_(uint32_t width, boost::shared_ptr base, unsigned index, vector &data) { switch (width) { #define xx(n) case n: return get_hint(base, index, data) all_widths @@ -120,15 +120,15 @@ namespace { //-------------------------------- template - void set_hint(shared_ptr base, unsigned index, vector const &data) { + void set_hint(boost::shared_ptr base, unsigned index, vector const &data) { typedef hint_traits traits; typedef array ha; - shared_ptr a = downcast_array(base); + boost::shared_ptr a = downcast_array(base); a->set(index, data); } - void set_hint_(uint32_t width, shared_ptr base, + void set_hint_(uint32_t width, boost::shared_ptr base, unsigned index, vector const &data) { switch (width) { #define xx(n) case n: return set_hint(base, index, data) @@ -140,15 +140,15 @@ namespace { //-------------------------------- template - void grow(shared_ptr base, unsigned new_nr_entries, vector const &value) { + void grow(boost::shared_ptr base, unsigned new_nr_entries, vector const &value) { typedef hint_traits traits; typedef array ha; - shared_ptr a = downcast_array(base); + boost::shared_ptr a = downcast_array(base); a->grow(new_nr_entries, value); } - void grow_(uint32_t width, shared_ptr base, + void grow_(uint32_t width, boost::shared_ptr base, unsigned new_nr_entries, vector const &value) { switch (width) { @@ -194,17 +194,17 @@ namespace { }; template - void walk_hints(shared_ptr base, hint_visitor &hv, damage_visitor &dv) { + void walk_hints(boost::shared_ptr base, hint_visitor &hv, damage_visitor &dv) { typedef hint_traits traits; typedef array ha; - shared_ptr a = downcast_array(base); + boost::shared_ptr a = downcast_array(base); value_adapter vv(hv); ll_damage_visitor ll(dv); a->visit_values(vv, ll); } - void walk_hints_(uint32_t width, shared_ptr base, + void walk_hints_(uint32_t width, boost::shared_ptr base, hint_visitor &hv, damage_visitor &dv) { switch (width) { #define xx(n) case n: walk_hints(base, hv, dv); break From 691ad882613ad061172095d881bb36b221a64d93 Mon Sep 17 00:00:00 2001 From: Alexander Holler Date: Sat, 15 Nov 2014 14:45:11 +0100 Subject: [PATCH 3/4] [caching/hint_array.cc] Fix ambigious array (C++11) Template array exist in the namespace persistent_data as well as in std of C++11. Explicitly use the one from persistent_data. This fixes compilation bugs with CXXFLAGS=-std=gnu++11 together with gcc 4.8.3 and boost 1.55. --- caching/hint_array.cc | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/caching/hint_array.cc b/caching/hint_array.cc index 7fccb82..66a3a27 100644 --- a/caching/hint_array.cc +++ b/caching/hint_array.cc @@ -40,7 +40,7 @@ namespace { template boost::shared_ptr mk_array(transaction_manager &tm) { typedef hint_traits traits; - typedef array ha; + typedef persistent_data::array ha; boost::shared_ptr r = typename ha::ptr(new ha(tm, typename traits::ref_counter())); @@ -78,7 +78,7 @@ namespace { template boost::shared_ptr mk_array(transaction_manager &tm, block_address root, unsigned nr_entries) { typedef hint_traits traits; - typedef array ha; + typedef persistent_data::array ha; boost::shared_ptr r = typename ha::ptr(new ha(tm, typename traits::ref_counter(), root, nr_entries)); @@ -103,7 +103,7 @@ namespace { template void get_hint(boost::shared_ptr base, unsigned index, vector &data) { typedef hint_traits traits; - typedef array ha; + typedef persistent_data::array ha; boost::shared_ptr a = downcast_array(base); data = a->get(index); @@ -122,7 +122,7 @@ namespace { template void set_hint(boost::shared_ptr base, unsigned index, vector const &data) { typedef hint_traits traits; - typedef array ha; + typedef persistent_data::array ha; boost::shared_ptr a = downcast_array(base); a->set(index, data); @@ -142,7 +142,7 @@ namespace { template void grow(boost::shared_ptr base, unsigned new_nr_entries, vector const &value) { typedef hint_traits traits; - typedef array ha; + typedef persistent_data::array ha; boost::shared_ptr a = downcast_array(base); a->grow(new_nr_entries, value); @@ -196,7 +196,7 @@ namespace { template void walk_hints(boost::shared_ptr base, hint_visitor &hv, damage_visitor &dv) { typedef hint_traits traits; - typedef array ha; + typedef persistent_data::array ha; boost::shared_ptr a = downcast_array(base); value_adapter vv(hv); From b56aec4d962f5f5ff17f2f1e42d0968c85aff098 Mon Sep 17 00:00:00 2001 From: Alexander Holler Date: Sat, 15 Nov 2014 15:42:58 +0100 Subject: [PATCH 4/4] [unit-tests/bloom_filter_t.cc] Fix ambigious uniform_int_distribution (C++11) uniform_int_distribution exist in the namespace boost as well as in std of C++11. Use the one provided by boost. This fixes compilation bugs with CXXFLAGS=-std=gnu++11 together with gcc 4.8.3 and boost 1.55. --- unit-tests/bloom_filter_t.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/unit-tests/bloom_filter_t.cc b/unit-tests/bloom_filter_t.cc index 032eb48..13c2418 100644 --- a/unit-tests/bloom_filter_t.cc +++ b/unit-tests/bloom_filter_t.cc @@ -40,7 +40,7 @@ namespace { using namespace boost::random; - uniform_int_distribution uniform_dist(0, max); + boost::random::uniform_int_distribution uniform_dist(0, max); while (r.size() < count) { block_address b = uniform_dist(rng_);