public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* PATCH: fix warning in libstdc++/src/strstream.cc
@ 2007-01-04 23:43 Ben Elliston
  2007-01-04 23:45 ` Andrew Pinski
  2007-01-05  2:30 ` Ian Lance Taylor
  0 siblings, 2 replies; 6+ messages in thread
From: Ben Elliston @ 2007-01-04 23:43 UTC (permalink / raw)
  To: libstdc++; +Cc: gcc-patches, iant

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);
     else if (mode & ios_base::in)
       do_get = true;
     else if (mode & ios_base::out)


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: fix warning in libstdc++/src/strstream.cc
  2007-01-04 23:43 PATCH: fix warning in libstdc++/src/strstream.cc Ben Elliston
@ 2007-01-04 23:45 ` Andrew Pinski
  2007-01-04 23:50   ` Ian Lance Taylor
  2007-01-04 23:51   ` Paolo Carlini
  2007-01-05  2:30 ` Ian Lance Taylor
  1 sibling, 2 replies; 6+ messages in thread
From: Andrew Pinski @ 2007-01-04 23:45 UTC (permalink / raw)
  To: Ben Elliston; +Cc: libstdc++, gcc-patches, iant

> 
> 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?

Thanks,
Andrew Pinski

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: fix warning in libstdc++/src/strstream.cc
  2007-01-04 23:45 ` Andrew Pinski
@ 2007-01-04 23:50   ` Ian Lance Taylor
  2007-01-05  0:05     ` Ben Elliston
  2007-01-04 23:51   ` Paolo Carlini
  1 sibling, 1 reply; 6+ messages in thread
From: Ian Lance Taylor @ 2007-01-04 23:50 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: Ben Elliston, libstdc++, gcc-patches

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: fix warning in libstdc++/src/strstream.cc
  2007-01-04 23:45 ` Andrew Pinski
  2007-01-04 23:50   ` Ian Lance Taylor
@ 2007-01-04 23:51   ` Paolo Carlini
  1 sibling, 0 replies; 6+ messages in thread
From: Paolo Carlini @ 2007-01-04 23:51 UTC (permalink / raw)
  To: Andrew Pinski; +Cc: Ben Elliston, libstdc++, gcc-patches, iant

Andrew Pinski wrote:

>>-      do_get = do_put = true;
>>+      do_get = (do_put = true);
>>    
>>
>I don't think we should be warning here at all.
>  
>
I'm also rather puzzled by the warning...

Paolo.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: fix warning in libstdc++/src/strstream.cc
  2007-01-04 23:50   ` Ian Lance Taylor
@ 2007-01-05  0:05     ` Ben Elliston
  0 siblings, 0 replies; 6+ messages in thread
From: Ben Elliston @ 2007-01-05  0:05 UTC (permalink / raw)
  To: Ian Lance Taylor; +Cc: Andrew Pinski, Ben Elliston, libstdc++, gcc-patches

On Thu, 2007-01-04 at 15:50 -0800, Ian Lance Taylor wrote:

> 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've backed out my libstdc++ patch.  Thanks,

Ben


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: PATCH: fix warning in libstdc++/src/strstream.cc
  2007-01-04 23:43 PATCH: fix warning in libstdc++/src/strstream.cc Ben Elliston
  2007-01-04 23:45 ` Andrew Pinski
@ 2007-01-05  2:30 ` Ian Lance Taylor
  1 sibling, 0 replies; 6+ messages in thread
From: Ian Lance Taylor @ 2007-01-05  2:30 UTC (permalink / raw)
  To: Ben Elliston; +Cc: libstdc++, gcc-patches

Ben Elliston <bje@au1.ibm.com> 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);
>      else if (mode & ios_base::in)
>        do_get = true;
>      else if (mode & ios_base::out)

I thought I understood this, but I don't.  I don't get a warning about
this file.  I can't come up with a similar test case which causes a
warning.

Can you recreate this problem?  Can you send me the .ii file?

Ian

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2007-01-05  2:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-01-04 23:43 PATCH: fix warning in libstdc++/src/strstream.cc Ben Elliston
2007-01-04 23:45 ` Andrew Pinski
2007-01-04 23:50   ` Ian Lance Taylor
2007-01-05  0:05     ` Ben Elliston
2007-01-04 23:51   ` Paolo Carlini
2007-01-05  2:30 ` Ian Lance Taylor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).