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]
Other format: [Raw text]

Re: PATCH: fix warning in libstdc++/src/strstream.cc


Andrew Pinski <pinskia@physics.uc.edu> writes:

> > This new warning popped up as a result of some diagnostics work that I
> > think I saw mentioned in list traffic.  Committed as obvious.
> > 
> > 2007-01-05  Ben Elliston  <bje@au.ibm.com>
> > 
> >         * src/strstream.cc (strstreambuf::seekoff): Add parentheses around
> >         truth expression to eliminate a new warning from g++.
> > 
> > Index: src/strstream.cc
> > ===================================================================
> > --- src/strstream.cc    (revision 120450)
> > +++ src/strstream.cc    (working copy)
> > @@ -235,7 +235,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std)
> >      if ((mode & (ios_base::in | ios_base::out)) 
> >         == (ios_base::in | ios_base::out) &&
> >         (dir == ios_base::beg || dir == ios_base::end))
> > -      do_get = do_put = true;
> > +      do_get = (do_put = true);
> 
> I don't think we should be warning here at all.
> Ian? what do you think?

This looks like a bug, probably in the code I added recently.  We
shouldn't need and don't want the parentheses in this case.  I'll try
to eliminate the warning.

I added a warning for
   a = b == true
but I didn't intend to change
   a = b = true

Ian


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