Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFC: Killing some warnings
@ 2001-02-11  0:00 Paul Hilfinger
  2001-02-12 14:55 ` Kevin Buettner
  0 siblings, 1 reply; 3+ messages in thread
From: Paul Hilfinger @ 2001-02-11  0:00 UTC (permalink / raw)
  To: gdb-patches

While I was mucking around with hpux-thread.c, I happened to notice that
it contains an instance of make_cleanup that does not conform to the 
guidelines given in Cagney's comment in defs.h.  Doesn't happen to cause 
any problems here, except for warnings, but I don't trust warnings.  With
this change, there will be no warnings unless the size of void* or int 
changes, at which point there SHOULD be one.

Paul Hilfinger
Ada Core Technologies


2001-02-11  Paul Hilfinger  <hilfingr@nile.gnat.com>

	* hpux-thread.c (save_inferior_pid): Change call to make_cleanup
	to make arguments conform.
	(restore_inferior_pid): Change signature to that expected by
	make_cleanup.

Index: gdb/hpux-thread.c
===================================================================
RCS file: /cvs/src/src/gdb/hpux-thread.c,v
retrieving revision 1.5
diff -c -3 -p -r1.5 hpux-thread.c
*** hpux-thread.c	2000/09/05 22:46:57	1.5
--- hpux-thread.c	2001/02/10 23:28:12
*************** static CORE_ADDR P_cma__g_current_thread
*** 63,69 ****
  
  static struct cleanup *save_inferior_pid (void);
  
! static void restore_inferior_pid (int pid);
  
  static void hpux_thread_resume (int pid, int step, enum target_signal signo);
  
--- 63,69 ----
  
  static struct cleanup *save_inferior_pid (void);
  
! static void restore_inferior_pid (void* pid);
  
  static void hpux_thread_resume (int pid, int step, enum target_signal signo);
  
*************** static struct target_ops hpux_thread_ops
*** 81,87 ****
     SYNOPSIS
  
     struct cleanup *save_inferior_pid ()
!    void restore_inferior_pid (int pid)
  
     DESCRIPTION
  
--- 81,87 ----
     SYNOPSIS
  
     struct cleanup *save_inferior_pid ()
!    void restore_inferior_pid (void* pid)
  
     DESCRIPTION
  
*************** static struct target_ops hpux_thread_ops
*** 102,114 ****
  static struct cleanup *
  save_inferior_pid (void)
  {
!   return make_cleanup (restore_inferior_pid, inferior_pid);
  }
  
  static void
! restore_inferior_pid (int pid)
  {
!   inferior_pid = pid;
  }
  \f
  static int find_active_thread (void);
--- 102,114 ----
  static struct cleanup *
  save_inferior_pid (void)
  {
!   return make_cleanup (restore_inferior_pid, (void*) inferior_pid);
  }
  
  static void
! restore_inferior_pid (void* pid)
  {
!   inferior_pid = (int) pid;
  }
  \f
  static int find_active_thread (void);


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

* Re: RFC: Killing some warnings
  2001-02-11  0:00 RFC: Killing some warnings Paul Hilfinger
@ 2001-02-12 14:55 ` Kevin Buettner
  2001-02-13 14:28   ` Andrew Cagney
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2001-02-12 14:55 UTC (permalink / raw)
  To: Paul Hilfinger, gdb-patches

On Feb 11,  2:59am, Paul Hilfinger wrote:

> 	* hpux-thread.c (save_inferior_pid): Change call to make_cleanup
> 	to make arguments conform.
> 	(restore_inferior_pid): Change signature to that expected by
> 	make_cleanup.
[...]
> *************** static struct target_ops hpux_thread_ops
> *** 102,114 ****
>   static struct cleanup *
>   save_inferior_pid (void)
>   {
> !   return make_cleanup (restore_inferior_pid, inferior_pid);
>   }
>   
>   static void
> ! restore_inferior_pid (int pid)
>   {
> !   inferior_pid = pid;
>   }
>   \f
>   static int find_active_thread (void);
> --- 102,114 ----
>   static struct cleanup *
>   save_inferior_pid (void)
>   {
> !   return make_cleanup (restore_inferior_pid, (void*) inferior_pid);
>   }
>   
>   static void
> ! restore_inferior_pid (void* pid)
>   {
> !   inferior_pid = (int) pid;
>   }
>   \f
>   static int find_active_thread (void);

Personally, I'd prefer to see these changed to avoid the casts to (void *)
and (int).  See the implementation in lin-thread.c (and also elsewhere)
for an example.

(If we ever get around to merging my pid/tid/lwp megapatch, these are
cleaned up everywhere.  I.e, there is one implementation that all files
which need to do this sort of thing use.)

Kevin


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

* Re: RFC: Killing some warnings
  2001-02-12 14:55 ` Kevin Buettner
@ 2001-02-13 14:28   ` Andrew Cagney
  0 siblings, 0 replies; 3+ messages in thread
From: Andrew Cagney @ 2001-02-13 14:28 UTC (permalink / raw)
  To: Kevin Buettner; +Cc: Paul Hilfinger, gdb-patches

> Personally, I'd prefer to see these changed to avoid the casts to (void *)
> and (int).  See the implementation in lin-thread.c (and also elsewhere)
> for an example.

That is correct - you can't robustly cast (int) <-> (void*) on some
architectures.  Plenty of examples of how to handle this cleanly.  See
sol-thread.c:restore_inferior_thread() for instance.

> (If we ever get around to merging my pid/tid/lwp megapatch, these are
> cleaned up everywhere.  I.e, there is one implementation that all files
> which need to do this sort of thing use.)

Yes.  One way or the other I intend making it happen in the next few
months :-)

	Andrew


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

end of thread, other threads:[~2001-02-13 14:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-02-11  0:00 RFC: Killing some warnings Paul Hilfinger
2001-02-12 14:55 ` Kevin Buettner
2001-02-13 14:28   ` Andrew Cagney

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