From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: jan.kratochvil@redhat.com
Cc: brobecker@adacore.com, gdb-patches@sourceware.org
Subject: Re: [patchv2] Fix Sun compiler compat. for empty structs (PR build/14003)
Date: Wed, 13 Jun 2012 08:30:00 -0000 [thread overview]
Message-ID: <201206130830.q5D8UBv8028230@glazunov.sibelius.xs4all.nl> (raw)
In-Reply-To: <20120613065059.GA11317@host2.jankratochvil.net> (message from Jan Kratochvil on Wed, 13 Jun 2012 08:50:59 +0200)
> Date: Wed, 13 Jun 2012 08:50:59 +0200
> From: Jan Kratochvil <jan.kratochvil@redhat.com>
>
> On Tue, 12 Jun 2012 23:51:16 +0200, Jan Kratochvil wrote:
> > On Tue, 12 Jun 2012 23:24:13 +0200, Joel Brobecker wrote:
> > > A structure type describes a sequentially allocated nonempty
> > > set of member objects [...]
> >
> > oops, OK.
>
> emptystruct.c:1:8: warning: struct has no members [-pedantic]
>
>
> > > Perhaps using #if 0 instead might make it looks like a little less unusual,
> > > not sure...
> >
> > While #if 0 is IIRC forbidden in general it would at least permit ctags to
> > work.
>
>
> Jan
>
>
> 2012-06-13 Jan Kratochvil <jan.kratochvil@redhat.com>
>
> PR build/14003
> * inferior.h (struct inferior_suspend_state): Comment out.
> (struct inferior): Comment out the field suspend.
> * infrun.c (struct infcall_suspend_state): Comment out the field
> inferior_suspend.
> (save_infcall_suspend_state, restore_infcall_suspend_state): Comment
> out its assignment.
>
> diff --git a/gdb/inferior.h b/gdb/inferior.h
> index dfcbda4..3945962 100644
> --- a/gdb/inferior.h
> +++ b/gdb/inferior.h
> @@ -397,9 +397,11 @@ struct inferior_control_state
>
> Inferior thread counterpart is `struct thread_suspend_state'. */
>
> +#if 0 /* Currently unused and empty structures are not valid C. */
> struct inferior_suspend_state
> {
> };
> +#endif
At the risk of turning this into a bikeshed:
Isn't it simpler to just put a dummy member inside that struct, and forget about the #if 0 stuff?
struct inferior_suspend_state
{
/* Empty structures are not valid C. */
int unused;
};
> /* GDB represents the state of each program execution with an object
> called an inferior. An inferior typically corresponds to a process
> @@ -431,7 +433,9 @@ struct inferior
>
> /* State of inferior process to restore after GDB is done with an inferior
> call. See `struct inferior_suspend_state'. */
> +#if 0 /* Currently unused and empty structures are not valid C. */
> struct inferior_suspend_state suspend;
> +#endif
>
> /* True if this was an auto-created inferior, e.g. created from
> following a fork; false, if this inferior was manually added by
> diff --git a/gdb/infrun.c b/gdb/infrun.c
> index b98e379..e6b7a5e 100644
> --- a/gdb/infrun.c
> +++ b/gdb/infrun.c
> @@ -6639,7 +6639,9 @@ siginfo_make_value (struct gdbarch *gdbarch, struct internalvar *var,
> struct infcall_suspend_state
> {
> struct thread_suspend_state thread_suspend;
> +#if 0 /* Currently unused and empty structures are not valid C. */
> struct inferior_suspend_state inferior_suspend;
> +#endif
>
> /* Other fields: */
> CORE_ADDR stop_pc;
> @@ -6693,7 +6695,9 @@ save_infcall_suspend_state (void)
> }
>
> inf_state->thread_suspend = tp->suspend;
> +#if 0 /* Currently unused and empty structures are not valid C. */
> inf_state->inferior_suspend = inf->suspend;
> +#endif
>
> /* run_inferior_call will not use the signal due to its `proceed' call with
> GDB_SIGNAL_0 anyway. */
> @@ -6717,7 +6721,9 @@ restore_infcall_suspend_state (struct infcall_suspend_state *inf_state)
> struct gdbarch *gdbarch = get_regcache_arch (regcache);
>
> tp->suspend = inf_state->thread_suspend;
> +#if 0 /* Currently unused and empty structures are not valid C. */
> inf->suspend = inf_state->inferior_suspend;
> +#endif
>
> stop_pc = inf_state->stop_pc;
>
>
next prev parent reply other threads:[~2012-06-13 8:30 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-12 20:48 [patch] " Jan Kratochvil
2012-06-12 21:24 ` Joel Brobecker
2012-06-12 21:52 ` Jan Kratochvil
2012-06-13 6:51 ` [patchv2] " Jan Kratochvil
2012-06-13 8:30 ` Mark Kettenis [this message]
2012-06-13 8:49 ` Jan Kratochvil
2012-06-13 14:47 ` Joel Brobecker
2012-06-13 18:19 ` [commit] " Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201206130830.q5D8UBv8028230@glazunov.sibelius.xs4all.nl \
--to=mark.kettenis@xs4all.nl \
--cc=brobecker@adacore.com \
--cc=gdb-patches@sourceware.org \
--cc=jan.kratochvil@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox