You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by se...@apache.org on 2007/05/25 02:45:10 UTC

svn commit: r541494 - /incubator/stdcxx/trunk/tests/include/alg_test.h

Author: sebor
Date: Thu May 24 17:45:08 2007
New Revision: 541494

URL: http://svn.apache.org/viewvc?view=rev&rev=541494
Log:
2007-05-24  Martin Sebor  <se...@roguewave.com>

	* alg_test.h (InputIter): Outlined member functions too big for
	the gcc inliner to handle (causing noise for -Winline warnings).
	(OutputIter): Ditto.

Modified:
    incubator/stdcxx/trunk/tests/include/alg_test.h

Modified: incubator/stdcxx/trunk/tests/include/alg_test.h
URL: http://svn.apache.org/viewvc/incubator/stdcxx/trunk/tests/include/alg_test.h?view=diff&rev=541494&r1=541493&r2=541494
==============================================================================
--- incubator/stdcxx/trunk/tests/include/alg_test.h (original)
+++ incubator/stdcxx/trunk/tests/include/alg_test.h Thu May 24 17:45:08 2007
@@ -409,56 +409,17 @@
     };
 
     // InputIterators are not default constructible
-    InputIter (const value_type *cur,
-               const value_type *beg,
-               const value_type *end)
-        : ptr_ (new Shared (cur, beg, end)), cur_ (cur) { }
+    InputIter (const value_type* /* current */,
+               const value_type* /* begin */,
+               const value_type* /* end */);
 
-    InputIter (const InputIter &rhs)
-        : ptr_ (rhs.ptr_), cur_ (rhs.cur_) {
-        RW_ASSERT (0 != ptr_);
-        ++ptr_->ref_;
-    }
-
-    ~InputIter () {
-        RW_ASSERT (0 != ptr_);
-
-        if (0 == --ptr_->ref_)   // decrement the reference count
-            delete ptr_;
-        ptr_ = 0;
-        cur_ = 0;
-    }
-
-    InputIter& operator= (const InputIter &rhs) {
-        RW_ASSERT (rhs == rhs);   // assert `rhs' is valid
-
-        RW_ASSERT (0 != ptr_);
-        if (0 == --ptr_->ref_)
-            delete ptr_;
+    InputIter (const InputIter&);
 
-        ptr_ = rhs.ptr_;
+    ~InputIter ();
 
-        RW_ASSERT (0 != ptr_);
-        ++ptr_->ref_;
-
-        cur_ = rhs.cur_;
-
-        return *this;
-    }
-
-    bool operator== (const InputIter &rhs) const {
-        // assert that both arguments are in the domain of operator==()
-        // i.e., that no copy of *this or `rhs' has been incremented
-        // and that no copy passed through this value of the iterator
-
-        RW_ASSERT (0 != ptr_);
-        RW_ASSERT (cur_ == ptr_->cur_);
+    InputIter& operator= (const InputIter&);
 
-        RW_ASSERT (0 != rhs.ptr_);
-        RW_ASSERT (rhs.cur_ == rhs.ptr_->cur_);
-
-        return cur_ == rhs.cur_;
-    }
+    bool operator== (const InputIter&) const;
 
     bool operator!= (const InputIter &rhs) const {
         return !(*this == rhs);
@@ -493,6 +454,84 @@
     const value_type *cur_;   // past-the-end
 };
 
+
+// "large" member functions outlined to prevent gcc -Winline warnings
+
+template <class T>
+InputIter<T>::
+InputIter (const value_type *cur,
+           const value_type *beg,
+           const value_type *end)
+    : ptr_ (new Shared (cur, beg, end)), cur_ (cur)
+{
+    // empty
+}
+
+
+template <class T>
+InputIter<T>::
+InputIter (const InputIter &rhs)
+    : ptr_ (rhs.ptr_), cur_ (rhs.cur_)
+{
+    RW_ASSERT (0 != ptr_);
+    ++ptr_->ref_;
+}
+
+
+template <class T>
+InputIter<T>::
+~InputIter ()
+{
+    RW_ASSERT (0 != ptr_);
+
+    if (0 == --ptr_->ref_)   // decrement the reference count
+        delete ptr_;
+
+    ptr_ = 0;
+    cur_ = 0;
+}
+
+
+template <class T>
+InputIter<T>&
+InputIter<T>::
+operator= (const InputIter &rhs)
+{
+    RW_ASSERT (rhs == rhs);   // assert `rhs' is valid
+
+    RW_ASSERT (0 != ptr_);
+    if (0 == --ptr_->ref_)
+        delete ptr_;
+
+    ptr_ = rhs.ptr_;
+
+    RW_ASSERT (0 != ptr_);
+    ++ptr_->ref_;
+
+    cur_ = rhs.cur_;
+
+    return *this;
+}
+
+
+template <class T>
+bool
+InputIter<T>::
+operator== (const InputIter &rhs) const
+{
+    // assert that both arguments are in the domain of operator==()
+    // i.e., that no copy of *this or `rhs' has been incremented
+    // and that no copy passed through this value of the iterator
+
+    RW_ASSERT (0 != ptr_);
+    RW_ASSERT (cur_ == ptr_->cur_);
+
+    RW_ASSERT (0 != rhs.ptr_);
+    RW_ASSERT (rhs.cur_ == rhs.ptr_->cur_);
+
+    return cur_ == rhs.cur_;
+}
+
 /**************************************************************************/
 
 // satisfies the requirements in 24.1.2 [lib.output.iterators]
@@ -567,24 +606,9 @@
         ++ptr_->ref_;   // increment the reference count
     }
 
-    ~OutputIter () {
-        if (0 == --ptr_->ref_)   // decrement the reference count
-            delete ptr_;
-        ptr_ = 0;
-        cur_ = 0;
-    }
-
-    OutputIter& operator= (const OutputIter &rhs) {
-        if (0 == --ptr_->ref_)
-            delete ptr_;
-
-        ptr_ = rhs.ptr_;
-        ++ptr_->ref_;
+    ~OutputIter ();
 
-        cur_ = rhs.cur_;
-
-        return *this;
-    }
+    OutputIter& operator= (const OutputIter&);
 
     void operator= (const value_type &rhs) const {
         **this = rhs;
@@ -619,6 +643,41 @@
     Shared  *ptr_;
     pointer  cur_;
 };
+
+
+// "large" member functions outlined to prevent gcc -Winline warnings
+
+template <class T>
+OutputIter<T>::
+~OutputIter ()
+{
+    RW_ASSERT (0 != ptr_);
+
+    if (0 == --ptr_->ref_)   // decrement the reference count
+        delete ptr_;
+
+    ptr_ = 0;
+    cur_ = 0;
+}
+
+
+template <class T>
+OutputIter<T>&
+OutputIter<T>::
+operator= (const OutputIter &rhs)
+{
+    RW_ASSERT (0 != ptr_);
+
+    if (0 == --ptr_->ref_)
+        delete ptr_;
+
+    ptr_ = rhs.ptr_;
+    ++ptr_->ref_;
+
+    cur_ = rhs.cur_;
+
+    return *this;
+}
 
 /**************************************************************************/