Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [rfa/testsuite/threads] fix gcc signed/unsigned warning
@ 2004-08-26 17:03 Michael Chastain
  2004-08-27  2:41 ` Michael Snyder
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Chastain @ 2004-08-26 17:03 UTC (permalink / raw)
  To: msnyder; +Cc: gdb-patches

This patch takes care of one set of gcc HEAD warnings in
schedlock.c and thread-specific.c.

The code uses "unsigned int" and "signed int" for the same data, but I'm
not into changing that right now.  I'm just killing the compiler warning
so the code can keep doing what it's doing.

Tested on native i686-pc-linux-gnu with gcc 2.95.3, gcc 3.3.4,
gcc 3.4.1, and gcc HEAD 20040824, dwarf-2 and stabs+.

Okay to commit?

2004-08-26  Michael Chastain  <mec.gnu@mindspring.com>

	Fix PR testsuite/1735.
	* gdb.threads/schedlock.c (thread_function): Add a cast
	to suppress a gcc warning.
	* gdb.threads/thread-specific.c (thread_function): Likewise.

Index: gdb.threads/schedlock.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/schedlock.c,v
retrieving revision 1.4
diff -c -3 -p -r1.4 schedlock.c
*** gdb.threads/schedlock.c	26 Aug 2004 13:10:19 -0000	1.4
--- gdb.threads/schedlock.c	26 Aug 2004 16:40:48 -0000
***************
*** 1,6 ****
  /* This testcase is part of GDB, the GNU debugger.
  
!    Copyright 2002, 2003 Free Software Foundation, Inc.
  
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
--- 1,6 ----
  /* This testcase is part of GDB, the GNU debugger.
  
!    Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
  
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
*************** int main() {
*** 52,58 ****
  
  void *thread_function(void *arg) {
      int my_number =  (long) arg;
!     int *myp = &args[my_number];
  
      /* Don't run forever.  Run just short of it :)  */
      while (*myp > 0)
--- 52,58 ----
  
  void *thread_function(void *arg) {
      int my_number =  (long) arg;
!     int *myp = (int *) &args[my_number];
  
      /* Don't run forever.  Run just short of it :)  */
      while (*myp > 0)
Index: gdb.threads/thread-specific.c
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/thread-specific.c,v
retrieving revision 1.1
diff -c -3 -p -r1.1 thread-specific.c
*** gdb.threads/thread-specific.c	1 Feb 2004 18:04:37 -0000	1.1
--- gdb.threads/thread-specific.c	26 Aug 2004 16:40:48 -0000
*************** int main() {
*** 53,59 ****
  
  void *thread_function(void *arg) {
      int my_number =  (long) arg;
!     int *myp = &args[my_number];
  
      /* Don't run forever.  Run just short of it :)  */
      while (*myp > 0)
--- 53,59 ----
  
  void *thread_function(void *arg) {
      int my_number =  (long) arg;
!     int *myp = (int *) &args[my_number];
  
      /* Don't run forever.  Run just short of it :)  */
      while (*myp > 0)


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

* Re: [rfa/testsuite/threads] fix gcc signed/unsigned warning
  2004-08-26 17:03 [rfa/testsuite/threads] fix gcc signed/unsigned warning Michael Chastain
@ 2004-08-27  2:41 ` Michael Snyder
  2004-08-27 11:23   ` Michael Chastain
  0 siblings, 1 reply; 3+ messages in thread
From: Michael Snyder @ 2004-08-27  2:41 UTC (permalink / raw)
  To: Michael Chastain; +Cc: gdb-patches

Michael Chastain wrote:
> This patch takes care of one set of gcc HEAD warnings in
> schedlock.c and thread-specific.c.
> 
> The code uses "unsigned int" and "signed int" for the same data, but I'm
> not into changing that right now.  I'm just killing the compiler warning
> so the code can keep doing what it's doing.
> 
> Tested on native i686-pc-linux-gnu with gcc 2.95.3, gcc 3.3.4,
> gcc 3.4.1, and gcc HEAD 20040824, dwarf-2 and stabs+.
> 
> Okay to commit?

Well, it really looks to me as if either args should be
signed, or myp should be unsigned.  The test will work
either way, although signed would "feel" safer.

But if you want to just do this, it's OK with me.

> 
> 2004-08-26  Michael Chastain  <mec.gnu@mindspring.com>
> 
> 	Fix PR testsuite/1735.
> 	* gdb.threads/schedlock.c (thread_function): Add a cast
> 	to suppress a gcc warning.
> 	* gdb.threads/thread-specific.c (thread_function): Likewise.
> 
> Index: gdb.threads/schedlock.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/schedlock.c,v
> retrieving revision 1.4
> diff -c -3 -p -r1.4 schedlock.c
> *** gdb.threads/schedlock.c	26 Aug 2004 13:10:19 -0000	1.4
> --- gdb.threads/schedlock.c	26 Aug 2004 16:40:48 -0000
> ***************
> *** 1,6 ****
>   /* This testcase is part of GDB, the GNU debugger.
>   
> !    Copyright 2002, 2003 Free Software Foundation, Inc.
>   
>      This program is free software; you can redistribute it and/or modify
>      it under the terms of the GNU General Public License as published by
> --- 1,6 ----
>   /* This testcase is part of GDB, the GNU debugger.
>   
> !    Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
>   
>      This program is free software; you can redistribute it and/or modify
>      it under the terms of the GNU General Public License as published by
> *************** int main() {
> *** 52,58 ****
>   
>   void *thread_function(void *arg) {
>       int my_number =  (long) arg;
> !     int *myp = &args[my_number];
>   
>       /* Don't run forever.  Run just short of it :)  */
>       while (*myp > 0)
> --- 52,58 ----
>   
>   void *thread_function(void *arg) {
>       int my_number =  (long) arg;
> !     int *myp = (int *) &args[my_number];
>   
>       /* Don't run forever.  Run just short of it :)  */
>       while (*myp > 0)
> Index: gdb.threads/thread-specific.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.threads/thread-specific.c,v
> retrieving revision 1.1
> diff -c -3 -p -r1.1 thread-specific.c
> *** gdb.threads/thread-specific.c	1 Feb 2004 18:04:37 -0000	1.1
> --- gdb.threads/thread-specific.c	26 Aug 2004 16:40:48 -0000
> *************** int main() {
> *** 53,59 ****
>   
>   void *thread_function(void *arg) {
>       int my_number =  (long) arg;
> !     int *myp = &args[my_number];
>   
>       /* Don't run forever.  Run just short of it :)  */
>       while (*myp > 0)
> --- 53,59 ----
>   
>   void *thread_function(void *arg) {
>       int my_number =  (long) arg;
> !     int *myp = (int *) &args[my_number];
>   
>       /* Don't run forever.  Run just short of it :)  */
>       while (*myp > 0)
> 



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

* Re: [rfa/testsuite/threads] fix gcc signed/unsigned warning
  2004-08-27  2:41 ` Michael Snyder
@ 2004-08-27 11:23   ` Michael Chastain
  0 siblings, 0 replies; 3+ messages in thread
From: Michael Chastain @ 2004-08-27 11:23 UTC (permalink / raw)
  To: msnyder; +Cc: gdb-patches

Michael Snyder <msnyder@redhat.com> wrote:
> But if you want to just do this, it's OK with me.

Yay, committed.

> Well, it really looks to me as if either args should be
> signed, or myp should be unsigned.  The test will work
> either way, although signed would "feel" safer.

I fooled around with this.  I couldn't find something that was type-safe
and felt exactly like the old test.  So I decided "one thing at a time"
-- first make it compile like it did with old compilers, then later, fix
the signed/unsigned muddle.

I've filed a PR for the signed/unsigned part.

===

2004-08-26  Michael Chastain  <mec.gnu@mindspring.com>

	Fix PR testsuite/1735.
	* gdb.threads/schedlock.c (thread_function): Add a cast
	to suppress a gcc warning.
	* gdb.threads/thread-specific.c (thread_function): Likewise.


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

end of thread, other threads:[~2004-08-27 11:23 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-08-26 17:03 [rfa/testsuite/threads] fix gcc signed/unsigned warning Michael Chastain
2004-08-27  2:41 ` Michael Snyder
2004-08-27 11:23   ` Michael Chastain

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox