[OB] Fix compilation error with clang in gdb/testsuite/gdb.trace/tspeed.c

Message ID 1587391684-8650-1-git-send-email-gbenson@redhat.com
State New
Headers show
Series
  • [OB] Fix compilation error with clang in gdb/testsuite/gdb.trace/tspeed.c
Related show

Commit Message

Rogerio Alves via Gdb-patches April 20, 2020, 2:08 p.m.
Clang fails to compile the above file, with the following error:
  warning: using the result of an assignment as a condition without
  parentheses [-Wparentheses]

This prevents the following testcase from executing:
  gdb.trace/tspeed.exp
---
 gdb/testsuite/ChangeLog          | 5 +++++
 gdb/testsuite/gdb.trace/tspeed.c | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)

-- 
1.8.3.1

Comments

Simon Marchi April 20, 2020, 2:11 p.m. | #1
On 2020-04-20 10:08 a.m., Gary Benson via Gdb-patches wrote:
> Clang fails to compile the above file, with the following error:

>   warning: using the result of an assignment as a condition without

>   parentheses [-Wparentheses]

> 

> This prevents the following testcase from executing:

>   gdb.trace/tspeed.exp

> ---

>  gdb/testsuite/ChangeLog          | 5 +++++

>  gdb/testsuite/gdb.trace/tspeed.c | 2 +-

>  2 files changed, 6 insertions(+), 1 deletion(-)

> 

> diff --git a/gdb/testsuite/gdb.trace/tspeed.c b/gdb/testsuite/gdb.trace/tspeed.c

> index b2c26bb..39a6646 100644

> --- a/gdb/testsuite/gdb.trace/tspeed.c

> +++ b/gdb/testsuite/gdb.trace/tspeed.c

> @@ -75,7 +75,7 @@

>  

>        /* Keep trying the speed test, with more iterations, until

>  	 we get to a reasonable number.  */

> -      while (problem = trace_speed_test())

> +      while ((problem = trace_speed_test()))

>  	{

>  	  /* If iteration isn't working, give up.  */

>  	  if (iters > max_iters)

> -- 

> 1.8.3.1

> 


Hi Gary,

For some reason, we don't see you ChangeLog entry in the patch (although
the diffstat shows changes to it), but it looks like:

+2020-04-20  Gary Benson <gbenson@redhat.com>
+
+       * gdb/testsuite/gdb.trace/tspeed.c: Fix compilation error with
+       clang.

The filename should not have the gdb/testsuite part.

Simon
Rogerio Alves via Gdb-patches April 20, 2020, 2:15 p.m. | #2
Simon Marchi wrote:
> On 2020-04-20 10:08 a.m., Gary Benson via Gdb-patches wrote:

> > Clang fails to compile the above file, with the following error:

> >   warning: using the result of an assignment as a condition without

> >   parentheses [-Wparentheses]

> > 

> > This prevents the following testcase from executing:

> >   gdb.trace/tspeed.exp

> > ---

> >  gdb/testsuite/ChangeLog          | 5 +++++

> >  gdb/testsuite/gdb.trace/tspeed.c | 2 +-

> >  2 files changed, 6 insertions(+), 1 deletion(-)

> > 

> > diff --git a/gdb/testsuite/gdb.trace/tspeed.c b/gdb/testsuite/gdb.trace/tspeed.c

> > index b2c26bb..39a6646 100644

> > --- a/gdb/testsuite/gdb.trace/tspeed.c

> > +++ b/gdb/testsuite/gdb.trace/tspeed.c

> > @@ -75,7 +75,7 @@

> >  

> >        /* Keep trying the speed test, with more iterations, until

> >  	 we get to a reasonable number.  */

> > -      while (problem = trace_speed_test())

> > +      while ((problem = trace_speed_test()))

> >  	{

> >  	  /* If iteration isn't working, give up.  */

> >  	  if (iters > max_iters)

> > -- 

> > 1.8.3.1

> 

> For some reason, we don't see you ChangeLog entry in the patch

> (although the diffstat shows changes to it), but it looks like:

> 

> +2020-04-20  Gary Benson <gbenson@redhat.com>

> +

> +       * gdb/testsuite/gdb.trace/tspeed.c: Fix compilation error with

> +       clang.

> 

> The filename should not have the gdb/testsuite part.


It's not my day today!  Should I commit a fix to the ChangeLog, or
should I leave it alone?

Thanks,
Gary
Simon Marchi April 20, 2020, 2:16 p.m. | #3
On 2020-04-20 10:15 a.m., Gary Benson via Gdb-patches wrote:
> It's not my day today!  Should I commit a fix to the ChangeLog, or

> should I leave it alone?


Yes, just push a simple fix to the ChangeLog (this fix shouldn't have a ChangeLog entry of its own :)).

Simon
Rogerio Alves via Gdb-patches April 20, 2020, 4:05 p.m. | #4
Simon Marchi wrote:
> On 2020-04-20 10:15 a.m., Gary Benson via Gdb-patches wrote:

> > It's not my day today!  Should I commit a fix to the ChangeLog, or

> > should I leave it alone?

> 

> Yes, just push a simple fix to the ChangeLog (this fix shouldn't

> have a ChangeLog entry of its own :)).


Done.

Thanks,
Gary

Patch

diff --git a/gdb/testsuite/gdb.trace/tspeed.c b/gdb/testsuite/gdb.trace/tspeed.c
index b2c26bb..39a6646 100644
--- a/gdb/testsuite/gdb.trace/tspeed.c
+++ b/gdb/testsuite/gdb.trace/tspeed.c
@@ -75,7 +75,7 @@ 
 
       /* Keep trying the speed test, with more iterations, until
 	 we get to a reasonable number.  */
-      while (problem = trace_speed_test())
+      while ((problem = trace_speed_test()))
 	{
 	  /* If iteration isn't working, give up.  */
 	  if (iters > max_iters)