[libstdc++]: Proposed patch for libstdc++/2694

Peter Schmid schmid@snake.iap.physik.tu-darmstadt.de
Mon Apr 30 10:51:00 GMT 2001


The following patch fixes the bogos warning described in
libstdc++/2694. After applying the patch, both testcases compile without
the "unsigned expression >= 0 is always true warning" message.

Hope this helps,

Peter Schmid

2001-04-30  Peter Schmid  <schmid@snake.iap.physik.tu-darmstadt.de>

        * include/bits/stl_iterator_base_funcs.h: Avoid signedness
          warning in __advance 


*** libstdc++-v3/include/bits/stl_iterator_base_funcs.h.orig	Mon Apr 30 19:40:38 2001
--- libstdc++-v3/include/bits/stl_iterator_base_funcs.h	Mon Apr 30 19:41:02 2001
*************** inline void __advance(_BidirectionalIter
*** 120,126 ****
  {
    // concept requirements
  __glibcpp_function_requires(_BidirectionalIteratorConcept<_BidirectionalIterator>);
!   if (__n >= 0)
      while (__n--) ++__i;
    else
      while (__n++) --__i;
--- 120,129 ----
  {
    // concept requirements
  __glibcpp_function_requires(_BidirectionalIteratorConcept<_BidirectionalIterator>);
! 
!   if (__n == 0)
!     return;
!   else if (__n > 0)
      while (__n--) ++__i;
    else
      while (__n++) --__i;



More information about the Gcc-patches mailing list