From: Joel Brobecker <brobecker@adacore.com>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch] Fix Sun compiler compat. for empty structs (PR build/14003)
Date: Tue, 12 Jun 2012 21:24:00 -0000 [thread overview]
Message-ID: <20120612212413.GS2687@adacore.com> (raw)
In-Reply-To: <20120612204751.GA13700@host2.jankratochvil.net>
> Tom suggested putting there 'char dummy;' but this degrade normal systems
> because of some worse systems.
Actually, the compiler is somewhat correct in this case. In C89,
it's really fuzzy whether empty structs are allowed or not, but
my understanding is that it is forbidden with C99:
A structure type describes a sequentially allocated nonempty
set of member objects [...]
So I think that we shouldn't be defining empty structs anyway
(to my dismay - I don't know what would be wrong with empty
structures, but ISTR seeing a discussion about something similar
with Ada, whereby two distinct objects must have distinct addresses,
and thus must have a non-zero size).
> Providing autoconf check for it seems excessive for me.
In light of the above, agreed.
> 2012-06-12 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.
Just my 2 cents: Given the number of such structs being allocated,
I'd rather waste the few bytes than making the code uglier. But
it's not a strong opinion, and I'd accept this patch too. Perhaps
using #if 0 instead might make it looks like a little less unusual,
not sure...
--
Joel
next prev parent reply other threads:[~2012-06-12 21:24 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-06-12 20:48 Jan Kratochvil
2012-06-12 21:24 ` Joel Brobecker [this message]
2012-06-12 21:52 ` Jan Kratochvil
2012-06-13 6:51 ` [patchv2] " Jan Kratochvil
2012-06-13 8:30 ` Mark Kettenis
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=20120612212413.GS2687@adacore.com \
--to=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