]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR libstdc++/34105 (Confusing error message with missing #include <algorithm>)
authorPaolo Carlini <pcarlini@suse.de>
Thu, 15 Nov 2007 19:05:17 +0000 (19:05 +0000)
committerPaolo Carlini <paolo@gcc.gnu.org>
Thu, 15 Nov 2007 19:05:17 +0000 (19:05 +0000)
2007-11-15  Paolo Carlini  <pcarlini@suse.de>

PR libstdc++/34105
* include/bits/stl_algobase.h: Do not include <bits/algorithmfwd.h>.
(lexicographical_compare(const unsigned char*, const unsigned char*,
const unsigned char*, const unsigned char*),
lexicographical_compare(const char*, const char*, const char*,
const char*)): Move to namespace (std, _GLIBCXX_STD_P).
* include/parallel/algobase.h: Do not include <bits/algorithmfwd.h>.
(equal): Move after mismatch.
* include/bits/stl_heap.h (is_heap, is_heap_until): Reorder.
* include/bits/char_traits.h: Include <bits/stl_algobase.h> instead
of <bits/algorithmfwd.h>.
* include/bits/stl_algo.h: Include first <bits/algorithmfwd.h>.
* include/bits/algorithmfwd.h (lexicographical_compare): Do not
declare overloads.
* include/parallel/partition.h: Include <parallel/random_number.h>.
* testsuite/util/testsuite_abi.cc: Include <algorithm>.

From-SVN: r130207

libstdc++-v3/ChangeLog
libstdc++-v3/include/bits/algorithmfwd.h
libstdc++-v3/include/bits/char_traits.h
libstdc++-v3/include/bits/stl_algo.h
libstdc++-v3/include/bits/stl_algobase.h
libstdc++-v3/include/bits/stl_heap.h
libstdc++-v3/include/parallel/algobase.h
libstdc++-v3/include/parallel/partition.h
libstdc++-v3/testsuite/util/testsuite_abi.cc

index 466c8f169de3f1f73e6ed69eb0be12b27661899a..3165b3ea651f171ec60fdb1c8dd0163cab2beb20 100644 (file)
@@ -1,3 +1,22 @@
+2007-11-15  Paolo Carlini  <pcarlini@suse.de>
+
+       PR libstdc++/34105
+       * include/bits/stl_algobase.h: Do not include <bits/algorithmfwd.h>.
+       (lexicographical_compare(const unsigned char*, const unsigned char*,
+       const unsigned char*, const unsigned char*),
+       lexicographical_compare(const char*, const char*, const char*,
+       const char*)): Move to namespace (std, _GLIBCXX_STD_P).
+       * include/parallel/algobase.h: Do not include <bits/algorithmfwd.h>.
+       (equal): Move after mismatch.
+       * include/bits/stl_heap.h (is_heap, is_heap_until): Reorder.
+       * include/bits/char_traits.h: Include <bits/stl_algobase.h> instead
+       of <bits/algorithmfwd.h>.
+       * include/bits/stl_algo.h: Include first <bits/algorithmfwd.h>.
+       * include/bits/algorithmfwd.h (lexicographical_compare): Do not
+       declare overloads.
+       * include/parallel/partition.h: Include <parallel/random_number.h>.
+       * testsuite/util/testsuite_abi.cc: Include <algorithm>.
+
 2007-11-14  Johannes Singler  <singler@ira.uka.de>
 
       * include/parallel/multiway_merge.h: More robust finding of an
@@ -5,7 +24,6 @@
       * include/bits/stl_algo.h: Fix typo to actually call appropriate
         sequential version.
 
-
 2007-11-13  Benjamin Kosnik  <bkoz@redhat.com>
 
        * docs/html/documentation.html: First pass at unified table of contents.
index 2e874040b88015af05f6881aaa4c3b6291fbcae5..cd9250e50aaffc0d18012c6937e7c6bcc6f936d1 100644 (file)
@@ -223,14 +223,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     void 
     iter_swap(_FIter1, _FIter2);
 
-  // Specializations for char and unsigned char.
-  inline bool
-  lexicographical_compare(const unsigned char*, const unsigned char*, 
-                         const unsigned char*, const unsigned char*);
-
-  inline bool
-  lexicographical_compare(const char*, const char*, const char*, const char*);
-
   template<typename _FIter, typename _Tp>
     _FIter 
     lower_bound(_FIter, _FIter, const _Tp&);
index daa13b7558cceb5d685553b83c8aadf6ca6c6c7b..86277a0940a48acd3e0b12c6b7b48153a3907b91 100644 (file)
@@ -43,7 +43,7 @@
 
 #pragma GCC system_header
 
-#include <bits/algorithmfwd.h>   // std::copy, std::fill_n
+#include <bits/stl_algobase.h>  // std::copy, std::fill_n
 #include <bits/postypes.h>      // For streampos
 #include <cstdio>               // For EOF
 #include <cwchar>               // For WEOF, wmemmove, wmemset, etc.
index 3765dc0be39bdb24d1e08d37da2b71e1156c869d..b81a4a354cbd50cdd3f51e9f13cfb76de2fbee95 100644 (file)
@@ -63,9 +63,9 @@
 #define _STL_ALGO_H 1
 
 #include <cstdlib>             // for rand
+#include <bits/algorithmfwd.h>
 #include <bits/stl_heap.h>
 #include <bits/stl_tempbuf.h>  // for _Temporary_buffer
-#include <bits/algorithmfwd.h>
 #include <debug/debug.h>
 
 // See concept_check.h for the __glibcxx_*_requires macros.
index 358983566c308e07c3ea404b9661c6f76567c5b1..0c3f1b21c23d69bfbbdec0caaa04eae075e9679f 100644 (file)
@@ -68,7 +68,8 @@
 #include <bits/cpp_type_traits.h>
 #include <ext/type_traits.h>
 #include <ext/numeric_traits.h>
-#include <bits/algorithmfwd.h>
+#include <bits/stl_pair.h>
+#include <bits/stl_iterator_base_types.h>
 #include <bits/stl_iterator_base_funcs.h>
 #include <bits/stl_iterator.h>
 #include <bits/concept_check.h>
@@ -814,50 +815,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
         { return true; }
     };
 
-  // XXX should these be enabled-if'd for signed/unsigned types instead?
-  inline bool
-  lexicographical_compare(const unsigned char* __first1,
-                         const unsigned char* __last1,
-                         const unsigned char* __first2,
-                         const unsigned char* __last2)
-  {
-    __glibcxx_requires_valid_range(__first1, __last1);
-    __glibcxx_requires_valid_range(__first2, __last2);
-
-    const size_t __len1 = __last1 - __first1;
-    const size_t __len2 = __last2 - __first2;
-    const int __result = __builtin_memcmp(__first1, __first2,
-                                         std::min(__len1, __len2));
-    return __result != 0 ? __result < 0 : __len1 < __len2;
-  }
-
-  inline bool
-  lexicographical_compare(const char* __first1, const char* __last1,
-                         const char* __first2, const char* __last2)
-  {
-    __glibcxx_requires_valid_range(__first1, __last1);
-    __glibcxx_requires_valid_range(__first2, __last2);
-
-    if (__gnu_cxx::__numeric_traits<char>::__is_signed)
-      {
-       typedef const signed char* value_type;
-       value_type __f1 = reinterpret_cast<value_type>(__first1);
-       value_type __l1 = reinterpret_cast<value_type>(__last1);
-       value_type __f2 = reinterpret_cast<value_type>(__first2);
-       value_type __l2 = reinterpret_cast<value_type>(__last2);        
-       return _GLIBCXX_STD_P::lexicographical_compare(__f1, __l1, __f2, __l2);
-      }
-    else
-      {
-       typedef const unsigned char* value_type;
-       value_type __f1 = reinterpret_cast<value_type>(__first1);
-       value_type __l1 = reinterpret_cast<value_type>(__last1);
-       value_type __f2 = reinterpret_cast<value_type>(__first2);
-       value_type __l2 = reinterpret_cast<value_type>(__last2);        
-       return _GLIBCXX_STD_P::lexicographical_compare(__f1, __l1, __f2, __l2);
-      }
-  }
-
 _GLIBCXX_END_NAMESPACE
 
 _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
@@ -941,7 +898,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
     {
       typedef typename iterator_traits<_II1>::iterator_category _Category1;
       typedef typename iterator_traits<_II2>::iterator_category _Category2;
-      typedef __lc_rai<_Category1, _Category2>         __rai_type;
+      typedef std::__lc_rai<_Category1, _Category2>    __rai_type;
 
       // concept requirements
       typedef typename iterator_traits<_II1>::value_type _ValueType1;
@@ -965,6 +922,50 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
       return __first1 == __last1 && __first2 != __last2;
     }
 
+  // XXX should these be enabled-if'd for signed/unsigned types instead?
+  inline bool
+  lexicographical_compare(const unsigned char* __first1,
+                         const unsigned char* __last1,
+                         const unsigned char* __first2,
+                         const unsigned char* __last2)
+  {
+    __glibcxx_requires_valid_range(__first1, __last1);
+    __glibcxx_requires_valid_range(__first2, __last2);
+
+    const size_t __len1 = __last1 - __first1;
+    const size_t __len2 = __last2 - __first2;
+    const int __result = __builtin_memcmp(__first1, __first2,
+                                         std::min(__len1, __len2));
+    return __result != 0 ? __result < 0 : __len1 < __len2;
+  }
+
+  inline bool
+  lexicographical_compare(const char* __first1, const char* __last1,
+                         const char* __first2, const char* __last2)
+  {
+    __glibcxx_requires_valid_range(__first1, __last1);
+    __glibcxx_requires_valid_range(__first2, __last2);
+
+    if (__gnu_cxx::__numeric_traits<char>::__is_signed)
+      {
+       typedef const signed char* value_type;
+       value_type __f1 = reinterpret_cast<value_type>(__first1);
+       value_type __l1 = reinterpret_cast<value_type>(__last1);
+       value_type __f2 = reinterpret_cast<value_type>(__first2);
+       value_type __l2 = reinterpret_cast<value_type>(__last2);        
+       return _GLIBCXX_STD_P::lexicographical_compare(__f1, __l1, __f2, __l2);
+      }
+    else
+      {
+       typedef const unsigned char* value_type;
+       value_type __f1 = reinterpret_cast<value_type>(__first1);
+       value_type __l1 = reinterpret_cast<value_type>(__last1);
+       value_type __f2 = reinterpret_cast<value_type>(__first2);
+       value_type __l2 = reinterpret_cast<value_type>(__last2);        
+       return _GLIBCXX_STD_P::lexicographical_compare(__f1, __l1, __f2, __l2);
+      }
+  }
+
   /**
    *  @brief Performs "dictionary" comparison on ranges.
    *  @param  first1  An input iterator.
@@ -984,7 +985,7 @@ _GLIBCXX_BEGIN_NESTED_NAMESPACE(std, _GLIBCXX_STD_P)
     {
       typedef typename iterator_traits<_II1>::iterator_category _Category1;
       typedef typename iterator_traits<_II2>::iterator_category _Category2;
-      typedef __lc_rai<_Category1, _Category2>         __rai_type;
+      typedef std::__lc_rai<_Category1, _Category2>    __rai_type;
 
       // concept requirements
       __glibcxx_function_requires(_InputIteratorConcept<_II1>)
index e800f65c28960a34fd1bf0e8124d737e4c2bd768..bbe76e796348279e47d70ee3d6ac218a12475c17 100644 (file)
@@ -487,32 +487,6 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
     }
 
 #ifdef __GXX_EXPERIMENTAL_CXX0X__
-  /**
-   *  @brief  Determines whether a range is a heap.
-   *  @param  first  Start of range.
-   *  @param  last   End of range.
-   *  @return  True if range is a heap, false otherwise.
-   *  @ingroup heap
-  */
-  template<typename _RandomAccessIterator>
-    inline bool
-    is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
-    { return std::is_heap_until(__first, __last) == __last; }
-
-  /**
-   *  @brief  Determines whether a range is a heap using comparison functor.
-   *  @param  first  Start of range.
-   *  @param  last   End of range.
-   *  @param  comp   Comparison functor to use.
-   *  @return  True if range is a heap, false otherwise.
-   *  @ingroup heap
-  */
-  template<typename _RandomAccessIterator, typename _Compare>
-    inline bool
-    is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
-           _Compare __comp)
-    { return std::is_heap_until(__first, __last, __comp) == __last; }
-
   /**
    *  @brief  Search the end of a heap.
    *  @param  first  Start of range.
@@ -563,6 +537,32 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
                                                                   __last),
                                            __comp);
     }
+
+  /**
+   *  @brief  Determines whether a range is a heap.
+   *  @param  first  Start of range.
+   *  @param  last   End of range.
+   *  @return  True if range is a heap, false otherwise.
+   *  @ingroup heap
+  */
+  template<typename _RandomAccessIterator>
+    inline bool
+    is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last)
+    { return std::is_heap_until(__first, __last) == __last; }
+
+  /**
+   *  @brief  Determines whether a range is a heap using comparison functor.
+   *  @param  first  Start of range.
+   *  @param  last   End of range.
+   *  @param  comp   Comparison functor to use.
+   *  @return  True if range is a heap, false otherwise.
+   *  @ingroup heap
+  */
+  template<typename _RandomAccessIterator, typename _Compare>
+    inline bool
+    is_heap(_RandomAccessIterator __first, _RandomAccessIterator __last,
+           _Compare __comp)
+    { return std::is_heap_until(__first, __last, __comp) == __last; }
 #endif
 
 _GLIBCXX_END_NAMESPACE
index a345b0f695a501e2697678a85b99a52f3cd9340f..8e9438d8a8d17e07fb61a0d996585811fdff223e 100644 (file)
 #ifndef _GLIBCXX_PARALLEL_ALGOBASE_H
 #define _GLIBCXX_PARALLEL_ALGOBASE_H 1
 
-#include <parallel/algorithmfwd.h>
 #include <bits/stl_algobase.h>
 #include <parallel/base.h>
 #include <parallel/tags.h>
 #include <parallel/settings.h>
 #include <parallel/find.h>
 #include <parallel/find_selectors.h>
-#include <parallel/for_each.h>
-#include <parallel/for_each_selectors.h>
 
 namespace std
 {
 namespace __parallel
 {
-  // Sequential fallback
-  template<typename InputIterator1, typename InputIterator2>
-  inline bool
-  equal(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, 
-       __gnu_parallel::sequential_tag)
-  { return _GLIBCXX_STD_P::equal(begin1, end1, begin2); }
-
-  // Sequential fallback
-  template<typename InputIterator1, typename InputIterator2, typename Predicate>
-  inline bool
-  equal(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, 
-       Predicate pred, __gnu_parallel::sequential_tag)
-  { return _GLIBCXX_STD_P::equal(begin1, end1, begin2, pred); }
-
-  // Public interface
-  template<typename InputIterator1, typename InputIterator2>
-  inline bool
-  equal(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2)
-  { return mismatch(begin1, end1, begin2).first == end1; }
-
-  // Public interface
-  template<typename InputIterator1, typename InputIterator2, typename Predicate>
-  inline bool
-  equal(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, 
-       Predicate pred)
-  { return mismatch(begin1, end1, begin2, pred).first == end1; }
-
-  // NB: lexicographical_compare equires mismatch.
+  // NB: equal and lexicographical_compare require mismatch.
 
   // Sequential fallback
   template<typename InputIterator1, typename InputIterator2>
@@ -156,6 +126,33 @@ namespace __parallel
                           iterator2_category());
   }
 
+  // Sequential fallback
+  template<typename InputIterator1, typename InputIterator2>
+  inline bool
+  equal(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, 
+       __gnu_parallel::sequential_tag)
+  { return _GLIBCXX_STD_P::equal(begin1, end1, begin2); }
+
+  // Sequential fallback
+  template<typename InputIterator1, typename InputIterator2, typename Predicate>
+  inline bool
+  equal(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, 
+       Predicate pred, __gnu_parallel::sequential_tag)
+  { return _GLIBCXX_STD_P::equal(begin1, end1, begin2, pred); }
+
+  // Public interface
+  template<typename InputIterator1, typename InputIterator2>
+  inline bool
+  equal(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2)
+  { return mismatch(begin1, end1, begin2).first == end1; }
+
+  // Public interface
+  template<typename InputIterator1, typename InputIterator2, typename Predicate>
+  inline bool
+  equal(InputIterator1 begin1, InputIterator1 end1, InputIterator2 begin2, 
+       Predicate pred)
+  { return mismatch(begin1, end1, begin2, pred).first == end1; }
+
   // Sequential fallback
   template<typename InputIterator1, typename InputIterator2>
   inline bool
index d21a615960e1301ef6d32867dac0f10dd2ac5f18..2b8631db73e720557c293a892972078998370306 100644 (file)
@@ -41,6 +41,7 @@
 
 #include <parallel/basic_iterator.h>
 #include <parallel/sort.h>
+#include <parallel/random_number.h>
 #include <bits/stl_algo.h>
 #include <parallel/parallel.h>
 
index 6efabecbe23c475054356793998017a802dcf97b..cec3ae2f3f9ca9f3ddc46db85255804489d7eeae 100644 (file)
@@ -35,6 +35,7 @@
 #include <fstream>
 #include <iostream>
 #include <vector>
+#include <algorithm>
 
 using namespace std;