This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fixup libobjc usage of PCC_BITFIELD_TYPE_MATTERS
- From: Jakub Jelinek <jakub at redhat dot com>
- To: Trevor Saunders <tbsaunde at tbsaunde dot org>
- Cc: tbsaunde+gcc at tbsaunde dot org, gcc-patches at gcc dot gnu dot org
- Date: Sat, 2 May 2015 15:26:09 +0200
- Subject: Re: [PATCH] fixup libobjc usage of PCC_BITFIELD_TYPE_MATTERS
- Authentication-results: sourceware.org; auth=none
- References: <1430537453-25556-1-git-send-email-tbsaunde+gcc at tbsaunde dot org> <20150502080313 dot GV1751 at tucnak dot redhat dot com> <20150502120846 dot GA32141 at tsaunders-iceball dot corp dot tor1 dot mozilla dot com>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Sat, May 02, 2015 at 09:08:21AM -0400, Trevor Saunders wrote:
> > > + AC_TRY_COMPILE(
> > > + [struct foo1 { char x; char :0; char y; };
> > > +struct foo2 { char x; int :0; char y; };
> > > +int foo1test[ sizeof (struct foo1) == 2 ? 1 : -1 ];
> > > +int foo2test[ sizeof (struct foo2) == 5 ? 1 : -1]; ],
> >
> > Shouldn't the 5 be sizeof (int) + 1? I mean, we have targets with 16-bit
> > ints. I hope no target sizeof (int) == 1, that would break this test too
> > (perhaps you could use long long :0; instead?).
>
> yeah, I just mindlessly ported the test program in tm.texi. I'm dubious
> anyone tries to use objective C on machines with 16 bit int, and doing
> it on a machine with 8 bit int sounds insane, but who knows, and maybe
> something else will need this test some day?
8-bit int isn't C compliant, generally, char has to be at least 8-bit,
short and int at least 16-bit, long at least 32-bit and long long at least
64-bit (this comes from the C requirements of minimum value for
U{CHAR,SHRT,INT,LONG,LLONG}_MAX). sizeof (int) == 1 was for the case
where e.g. char would be 16-bit and int as well, or 32-bit char and
32-bit int, etc.
Jakub