Boost logo

Boost-Commit :

From: hartmut.kaiser_at_[hidden]
Date: 2007-10-07 10:51:46


Author: hkaiser
Date: 2007-10-07 10:51:46 EDT (Sun, 07 Oct 2007)
New Revision: 39760
URL: http://svn.boost.org/trac/boost/changeset/39760

Log:
Wave: Silenced a couple of pedantic gcc warnings.
Text files modified:
   trunk/boost/wave/util/flex_string.hpp | 39 ++++++++++++++++++++++++++-------------
   1 files changed, 26 insertions(+), 13 deletions(-)

Modified: trunk/boost/wave/util/flex_string.hpp
==============================================================================
--- trunk/boost/wave/util/flex_string.hpp (original)
+++ trunk/boost/wave/util/flex_string.hpp 2007-10-07 10:51:46 EDT (Sun, 07 Oct 2007)
@@ -1406,7 +1406,7 @@
     class Storage = AllocatorStringStorage<E, A> >
 class flex_string : private Storage
 {
-#if defined(THROW_ON_ENFORCE)
+#if defined(BOOST_WAVE_FLEXSTRING_THROW_ON_ENFORCE)
     template <typename Exception>
     static void Enforce(bool condition, Exception*, const char* msg)
     { if (!condition) boost::throw_exception(Exception(msg)); }
@@ -1414,8 +1414,9 @@
     template <typename Exception>
     static inline void Enforce(bool condition, Exception*, const char* msg)
     { BOOST_ASSERT(condition && msg); }
-#endif // defined(THROW_ON_ENFORCE)
+#endif // defined(BOOST_WAVE_FLEXSTRING_THROW_ON_ENFORCE)
 
+#ifndef NDEBUG
     bool Sane() const
     {
         return
@@ -1429,9 +1430,9 @@
 
     struct Invariant;
     friend struct Invariant;
+
     struct Invariant
     {
-#ifndef NDEBUG
         Invariant(const flex_string& s) : s_(s)
         {
             BOOST_ASSERT(s_.Sane());
@@ -1442,10 +1443,8 @@
         }
     private:
         const flex_string& s_;
-#else
- Invariant(const flex_string&) {}
-#endif
     };
+#endif
     
 public:
     // types
@@ -1645,7 +1644,9 @@
     
     flex_string& append(const value_type* s, const size_type n)
     {
- Invariant checker(*this); checker;
+#ifndef NDEBUG
+ Invariant checker(*this);
+#endif
         static std::less_equal<const value_type*> le;
         if (le(&*begin(), s) && le(s, &*end())) // aliasing
         {
@@ -1700,7 +1701,9 @@
     
     flex_string& assign(const value_type* s, size_type n)
     {
- Invariant checker(*this); checker;
+#ifndef NDEBUG
+ Invariant checker(*this);
+#endif
         if (size() >= n)
         {
             std::copy(s, s + n, begin());
@@ -1763,7 +1766,9 @@
     flex_string& InsertImplDiscr(iterator p,
         size_type n, value_type c, Selector<1>)
     {
- Invariant checker(*this); checker;
+#ifndef NDEBUG
+ Invariant checker(*this);
+#endif
         assert(p >= begin() && p <= end());
         if (capacity() - size() < n)
         {
@@ -1799,7 +1804,9 @@
     void InsertImpl(iterator i,
         FwdIterator s1, FwdIterator s2, std::forward_iterator_tag)
     {
- Invariant checker(*this); checker;
+#ifndef NDEBUG
+ Invariant checker(*this);
+#endif
         const size_type pos = i - begin();
         const typename std::iterator_traits<FwdIterator>::difference_type n2 =
             std::distance(s1, s2);
@@ -1861,7 +1868,9 @@
     
     flex_string& erase(size_type pos = 0, size_type n = npos)
     {
- Invariant checker(*this); checker;
+#ifndef NDEBUG
+ Invariant checker(*this);
+#endif
         Enforce(pos <= length(), (std::out_of_range*)0, "");
         Procust(n, length() - pos);
         std::copy(begin() + pos + n, end(), begin() + pos);
@@ -1910,7 +1919,9 @@
     flex_string& replace(size_type pos, size_type n1,
         StrOrLength s_or_n2, NumOrChar n_or_c)
     {
- Invariant checker(*this); checker;
+#ifndef NDEBUG
+ Invariant checker(*this);
+#endif
         Enforce(pos <= size(), (std::out_of_range*)0, "");
         Procust(n1, length() - pos);
         const iterator b = begin() + pos;
@@ -1963,7 +1974,9 @@
     void ReplaceImpl(iterator i1, iterator i2,
         FwdIterator s1, FwdIterator s2, std::forward_iterator_tag)
     {
- Invariant checker(*this); checker;
+#ifndef NDEBUG
+ Invariant checker(*this);
+#endif
         const typename std::iterator_traits<iterator>::difference_type n1 =
             i2 - i1;
         assert(n1 >= 0);


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