Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r61640 - in branches/release: boost/unordered boost/unordered/detail libs/unordered libs/unordered/test/exception libs/unordered/test/helpers libs/unordered/test/unordered
From: daniel_james_at_[hidden]
Date: 2010-04-28 04:23:43


Author: danieljames
Date: 2010-04-28 04:23:41 EDT (Wed, 28 Apr 2010)
New Revision: 61640
URL: http://svn.boost.org/trac/boost/changeset/61640

Log:
Support for clang.

Properties modified:
   branches/release/boost/unordered/ (props changed)
   branches/release/libs/unordered/ (props changed)
Text files modified:
   branches/release/boost/unordered/detail/fwd.hpp | 23 +++++++++++++++++++++++
   branches/release/libs/unordered/test/exception/constructor_exception_tests.cpp | 14 ++++++++++++++
   branches/release/libs/unordered/test/exception/copy_exception_tests.cpp | 6 ++++++
   branches/release/libs/unordered/test/helpers/list.hpp | 2 +-
   branches/release/libs/unordered/test/unordered/compile_tests.hpp | 18 ++++++++++++++++++
   branches/release/libs/unordered/test/unordered/constructor_tests.cpp | 1 -
   6 files changed, 62 insertions(+), 2 deletions(-)

Modified: branches/release/boost/unordered/detail/fwd.hpp
==============================================================================
--- branches/release/boost/unordered/detail/fwd.hpp (original)
+++ branches/release/boost/unordered/detail/fwd.hpp 2010-04-28 04:23:41 EDT (Wed, 28 Apr 2010)
@@ -731,6 +731,7 @@
 
     // Iterator Access
 
+#if !defined(__clang__)
     class iterator_access
     {
     public:
@@ -741,6 +742,28 @@
             return it.base_;
         }
     };
+#else
+ class iterator_access
+ {
+ public:
+ // Note: we access Iterator::base here, rather than in the function
+ // signature to work around a bug in the friend support of an
+ // early version of clang.
+
+ template <class Iterator>
+ struct base
+ {
+ typedef BOOST_DEDUCED_TYPENAME Iterator::base type;
+ };
+
+ template <class Iterator>
+ static BOOST_DEDUCED_TYPENAME base<Iterator>::type const&
+ get(Iterator const& it)
+ {
+ return it.base_;
+ }
+ };
+#endif
 
     // Iterators
 

Modified: branches/release/libs/unordered/test/exception/constructor_exception_tests.cpp
==============================================================================
--- branches/release/libs/unordered/test/exception/constructor_exception_tests.cpp (original)
+++ branches/release/libs/unordered/test/exception/constructor_exception_tests.cpp 2010-04-28 04:23:41 EDT (Wed, 28 Apr 2010)
@@ -9,6 +9,8 @@
 #include "../helpers/random_values.hpp"
 #include "../helpers/input_iterator.hpp"
 
+template <typename T> inline void avoid_unused_warning(T const&) {}
+
 test::seed_t seed(91274);
 
 struct objects
@@ -24,6 +26,7 @@
 {
     void run() const {
         T x;
+ avoid_unused_warning(x);
     }
 };
 
@@ -32,6 +35,7 @@
 {
     void run() const {
         T x(300);
+ avoid_unused_warning(x);
     }
 };
 
@@ -40,6 +44,7 @@
 {
     void run() const {
         T x(0, hash);
+ avoid_unused_warning(x);
     }
 };
 
@@ -48,6 +53,7 @@
 {
     void run() const {
         T x(0, hash, equal_to);
+ avoid_unused_warning(x);
     }
 };
 
@@ -56,6 +62,7 @@
 {
     void run() const {
         T x(50, hash, equal_to, allocator);
+ avoid_unused_warning(x);
     }
 };
 
@@ -64,6 +71,7 @@
 {
     void run() const {
         T x(allocator);
+ avoid_unused_warning(x);
     }
 };
 
@@ -81,6 +89,7 @@
 {
     void run() const {
         T x(this->values.begin(), this->values.end());
+ avoid_unused_warning(x);
     }
 };
 
@@ -89,6 +98,7 @@
 {
     void run() const {
         T x(this->values.begin(), this->values.end(), 0);
+ avoid_unused_warning(x);
     }
 };
 
@@ -97,6 +107,7 @@
 {
     void run() const {
         T x(this->values.begin(), this->values.end(), 0, hash);
+ avoid_unused_warning(x);
     }
 };
 
@@ -105,6 +116,7 @@
 {
     void run() const {
         T x(this->values.begin(), this->values.end(), 100, hash, equal_to);
+ avoid_unused_warning(x);
     }
 };
 
@@ -118,6 +130,7 @@
     void run() const {
         T x(this->values.begin(), this->values.end(), 0,
             hash, equal_to, allocator);
+ avoid_unused_warning(x);
     }
 };
 
@@ -131,6 +144,7 @@
             begin = this->values.begin(), end = this->values.end();
         T x(test::input_iterator(begin), test::input_iterator(end),
                 0, hash, equal_to, allocator);
+ avoid_unused_warning(x);
     }
 };
 

Modified: branches/release/libs/unordered/test/exception/copy_exception_tests.cpp
==============================================================================
--- branches/release/libs/unordered/test/exception/copy_exception_tests.cpp (original)
+++ branches/release/libs/unordered/test/exception/copy_exception_tests.cpp 2010-04-28 04:23:41 EDT (Wed, 28 Apr 2010)
@@ -8,6 +8,8 @@
 #include "./containers.hpp"
 #include "../helpers/random_values.hpp"
 
+template <typename T> inline void avoid_unused_warning(T const&) {}
+
 test::seed_t seed(73041);
 
 template <class T>
@@ -17,6 +19,7 @@
 
     void run() const {
         T y(x);
+ avoid_unused_warning(y);
     }
 };
 
@@ -30,6 +33,7 @@
 
     void run() const {
         T y(x);
+ avoid_unused_warning(y);
     }
 };
 
@@ -43,6 +47,7 @@
 
     void run() const {
         T y(x);
+ avoid_unused_warning(y);
     }
 };
 
@@ -57,6 +62,7 @@
 
     void run() const {
         T y(x, allocator);
+ avoid_unused_warning(y);
     }
 };
 

Modified: branches/release/libs/unordered/test/helpers/list.hpp
==============================================================================
--- branches/release/libs/unordered/test/helpers/list.hpp (original)
+++ branches/release/libs/unordered/test/helpers/list.hpp 2010-04-28 04:23:41 EDT (Wed, 28 Apr 2010)
@@ -94,7 +94,7 @@
 
             node* ptr_;
         public:
- list_iterator() : ptr_(0) {};
+ list_iterator() : ptr_(0) {}
             explicit list_iterator(node* x) : ptr_(x) {}
 
             T& operator*() const { return ptr_->value_; }

Modified: branches/release/libs/unordered/test/unordered/compile_tests.hpp
==============================================================================
--- branches/release/libs/unordered/test/unordered/compile_tests.hpp (original)
+++ branches/release/libs/unordered/test/unordered/compile_tests.hpp 2010-04-28 04:23:41 EDT (Wed, 28 Apr 2010)
@@ -138,6 +138,12 @@
 
     typedef BOOST_DEDUCED_TYPENAME X::allocator_type allocator_type;
     test::check_return_type<allocator_type>::equals(a_const.get_allocator());
+
+ // Avoid unused variable warnings:
+
+ sink(u);
+ sink(u2);
+ sink(u3);
 }
 
 template <class X, class Key>
@@ -375,4 +381,16 @@
     test::check_return_type<float>::equals(b.max_load_factor());
     a.max_load_factor((float) 2.0);
     a.rehash(100);
+
+ // Avoid unused variable warnings:
+
+ sink(a);
+ sink(a2);
+ sink(a3);
+ sink(a4);
+ sink(a5);
+ sink(a6);
+ sink(a7);
+ sink(a8);
+ sink(a9);
 }

Modified: branches/release/libs/unordered/test/unordered/constructor_tests.cpp
==============================================================================
--- branches/release/libs/unordered/test/unordered/constructor_tests.cpp (original)
+++ branches/release/libs/unordered/test/unordered/constructor_tests.cpp 2010-04-28 04:23:41 EDT (Wed, 28 Apr 2010)
@@ -142,7 +142,6 @@
 
     std::cerr<<"Construct 11\n";
     {
- test::random_values<T> v(1000, generator);
         T x(al);
         BOOST_TEST(x.empty());
         BOOST_TEST(test::equivalent(x.hash_function(), hf));


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk