This is the mail archive of the mailing list for the GDB project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Fix Sun compiler compat. for empty structs (PR build/14003)

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]