This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

libstdc++: Three new warnings while building the library (patchincluded)


While building the current libstdc++ library (gcc-3.1 20010301) there are three
new warnings. The first one is while compiling src/strstream.cc: 

../../../../gcc/libstdc++-v3/src/strstream.cc: In member function `virtual int 
   std::strstreambuf::pbackfail(int)':
../../../../gcc/libstdc++-v3/src/strstream.cc:178: warning: comparison between 
   signed and unsigned integer expressions

The second one is while compiling src/locale.cc:
../../../../gcc/libstdc++-v3/src/locale.cc: In function `static unsigned int 
   std::locale::_S_normalize_category(unsigned int)':
../../../../gcc/libstdc++-v3/src/locale.cc:480: warning: `int __ret' might be 
   used uninitialized in this function

The third one is while compiling src/misc-ins.c:
../../../../gcc/libstdc++-v3/include/bits/basic_string.h: In function 
   `std::basic_istream<_CharT, _Traits>& 
   std::operator>>(std::basic_istream<_CharT, _Traits>&, 
   std::basic_string<_CharT, _Traits, _Alloc>&) [with _CharT = char, _Traits = 
   std::char_traits<char>, _Alloc = std::allocator<char>]':
../../../../gcc/libstdc++-v3/src/misc-inst.cc:189:   instantiated from here
../../../../gcc/libstdc++-v3/include/bits/basic_string.h:1133: warning: comparison
   between signed and unsigned integer expressions

The appended patches try to squelch the first two messages. I
appologize if these are faulty. I am not shure if the second one
is correct. I ran the testsuite after applying the patches. There were no
regressions.

Since the third warning is generated by the line number 1133 of file
basic_string.h, which does not exisist, basic_string.h consists only
of 1029 line numbers, I do not know how to fix the problem.

2001-03-02  Peter Schmid  <schmid@snake.iap.physik.tu-darmstadt.de>

	* src/locale.cc: initialise __ret with zero
	* src/strstream.cc:cast gptr to int_type

*** libstdc++-v3/src/locale.cc.orig	Fri Mar  2 16:15:21 2001
--- libstdc++-v3/src/locale.cc	Fri Mar  2 16:15:27 2001
*************** namespace std 
*** 477,483 ****
    locale::category
    locale::_S_normalize_category(category __cat) 
    {
!     int __ret;
      if (__cat == none || (__cat & all) && !(__cat & ~all))
        __ret = __cat;
      else
--- 477,483 ----
    locale::category
    locale::_S_normalize_category(category __cat) 
    {
!     int __ret = 0;
      if (__cat == none || (__cat & all) && !(__cat & ~all))
        __ret = __cat;
      else

*** libstdc++-v3/src/strstream.cc.orig	Fri Mar  2 16:14:05 2001
--- libstdc++-v3/src/strstream.cc	Fri Mar  2 16:14:13 2001
*************** strstreambuf::int_type strstreambuf::pba
*** 175,181 ****
        gbump(-1);
        return _Traits::not_eof(c);
      }
!     else if (c == (unsigned int)(gptr()[-1])) {   // (u int) added KLUDGE
        gbump(-1);
        return c;
      }
--- 175,181 ----
        gbump(-1);
        return _Traits::not_eof(c);
      }
!     else if (c == (int_type)(gptr()[-1])) {   // (u int) added KLUDGE
        gbump(-1);
        return c;
      }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]