public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [patch] fix typo in sim_state documentation
@ 2010-02-04  7:05 Mike Frysinger
  2010-02-04 21:46 ` Doug Evans
  0 siblings, 1 reply; 2+ messages in thread
From: Mike Frysinger @ 2010-02-04  7:05 UTC (permalink / raw)
  To: gdb-patches

the sim-base.h suggests you declare cpu storage in sim_state, but the proposed 
code causes build failures in some files such as sim-core and sim-cpu.c (since 
STATE_CPU() is supposed to return an lvalue).

it also doesnt make sense with the common sim_cpu_alloc_all() which 
dynamically allocates the memory for each cpu.

2010-02-04  Mike Frysinger  <vapier@gentoo.org>

	* sim-base.h: Declare sim_state.cpu as a pointer in the comment.  Drop
	& from the STATE_CPU() examples.

RCS file: /cvs/src/src/sim/common/sim-base.h,v
retrieving revision 1.11
diff -u -p -r1.11 sim-base.h
--- sim/common/sim-base.h	1 Jan 2010 10:03:27 -0000	1.11
+++ sim/common/sim-base.h	4 Feb 2010 07:02:42 -0000
@@ -44,11 +44,11 @@ along with this program.  If not, see <h
      };
 
      struct sim_state {
-       sim_cpu cpu[MAX_NR_PROCESSORS];
+       sim_cpu *cpu[MAX_NR_PROCESSORS];
      #if (WITH_SMP)
-     #define STATE_CPU(sd,n) (&(sd)->cpu[n])
+     #define STATE_CPU(sd,n) ((sd)->cpu[n])
      #else
-     #define STATE_CPU(sd,n) (&(sd)->cpu[0])
+     #define STATE_CPU(sd,n) ((sd)->cpu[0])
      #endif
        ... simulator specific members ...
        sim_state_base base;

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

* Re: [patch] fix typo in sim_state documentation
  2010-02-04  7:05 [patch] fix typo in sim_state documentation Mike Frysinger
@ 2010-02-04 21:46 ` Doug Evans
  0 siblings, 0 replies; 2+ messages in thread
From: Doug Evans @ 2010-02-04 21:46 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: gdb-patches

On Wed, Feb 3, 2010 at 11:05 PM, Mike Frysinger <vapier@gentoo.org> wrote:
> the sim-base.h suggests you declare cpu storage in sim_state, but the proposed
> code causes build failures in some files such as sim-core and sim-cpu.c (since
> STATE_CPU() is supposed to return an lvalue).
>
> it also doesnt make sense with the common sim_cpu_alloc_all() which
> dynamically allocates the memory for each cpu.
>
> 2010-02-04  Mike Frysinger  <vapier@gentoo.org>
>
>        * sim-base.h: Declare sim_state.cpu as a pointer in the comment.  Drop
>        & from the STATE_CPU() examples.
>
> RCS file: /cvs/src/src/sim/common/sim-base.h,v
> retrieving revision 1.11
> diff -u -p -r1.11 sim-base.h
> --- sim/common/sim-base.h       1 Jan 2010 10:03:27 -0000       1.11
> +++ sim/common/sim-base.h       4 Feb 2010 07:02:42 -0000
> @@ -44,11 +44,11 @@ along with this program.  If not, see <h
>      };
>
>      struct sim_state {
> -       sim_cpu cpu[MAX_NR_PROCESSORS];
> +       sim_cpu *cpu[MAX_NR_PROCESSORS];
>      #if (WITH_SMP)
> -     #define STATE_CPU(sd,n) (&(sd)->cpu[n])
> +     #define STATE_CPU(sd,n) ((sd)->cpu[n])
>      #else
> -     #define STATE_CPU(sd,n) (&(sd)->cpu[0])
> +     #define STATE_CPU(sd,n) ((sd)->cpu[0])
>      #endif
>        ... simulator specific members ...
>        sim_state_base base;
>

This patch is ok.  Thanks.

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

end of thread, other threads:[~2010-02-04 21:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-02-04  7:05 [patch] fix typo in sim_state documentation Mike Frysinger
2010-02-04 21:46 ` Doug Evans

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).