From: Andrew Pinski Date: Sun, 11 Dec 2005 06:28:35 +0000 (+0000) Subject: re PR libobjc/25346 (objc_sizeof_type does not handle _Bool at all) X-Git-Tag: releases/gcc-4.2.0~5424 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=153b4898d243846931a06682cd06ce16b826d755;p=thirdparty%2Fgcc.git re PR libobjc/25346 (objc_sizeof_type does not handle _Bool at all) 2005-12-11 Andrew Pinski PR libobjc/25346 * objc/objc-api.h (_C_BOOL): New define. * encoding.c (objc_sizeof_type): Handle _C_BOOL. (objc_alignof_type): Likewise. (objc_skip_typespec): Likewise. 2005-12-11 Andrew Pinski PR libobjc/25346 * objc.dg/encode-7.m: New test. From-SVN: r108378 --- diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 28b6eda6d56b..71286b1cb8ac 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,8 @@ +2005-12-11 Andrew Pinski + + PR libobjc/25346 + * objc.dg/encode-7.m: New test. + 2005-12-10 Mark Mitchell PR c++/25010 diff --git a/gcc/testsuite/objc.dg/encode-7.m b/gcc/testsuite/objc.dg/encode-7.m new file mode 100644 index 000000000000..0b49a415c291 --- /dev/null +++ b/gcc/testsuite/objc.dg/encode-7.m @@ -0,0 +1,18 @@ +/* { dg-options "-fgnu-runtime" } */ +/* { dg-do run } */ + +#include +#include + +struct f +{ + _Bool a; +}; + + +int main(void) +{ + if (objc_sizeof_type (@encode (struct f)) != sizeof(struct f)) + abort (); + return 0; +} diff --git a/libobjc/ChangeLog b/libobjc/ChangeLog index 809bcc0abe53..56f1ef8a8569 100644 --- a/libobjc/ChangeLog +++ b/libobjc/ChangeLog @@ -1,3 +1,11 @@ +2005-12-11 Andrew Pinski + + PR libobjc/25346 + * objc/objc-api.h (_C_BOOL): New define. + * encoding.c (objc_sizeof_type): Handle _C_BOOL. + (objc_alignof_type): Likewise. + (objc_skip_typespec): Likewise. + 2005-11-20 David Ayers PR libobjc/19024 diff --git a/libobjc/encoding.c b/libobjc/encoding.c index efdc2f0a1614..7f6004fb9ca4 100644 --- a/libobjc/encoding.c +++ b/libobjc/encoding.c @@ -123,6 +123,10 @@ objc_sizeof_type (const char *type) } switch (*type) { + case _C_BOOL: + return sizeof (_Bool); + break; + case _C_ID: return sizeof (id); break; @@ -273,6 +277,10 @@ objc_alignof_type (const char *type) /* do nothing */; } switch (*type) { + case _C_BOOL: + return __alignof__ (_Bool); + break; + case _C_ID: return __alignof__ (id); break; @@ -496,6 +504,7 @@ objc_skip_typespec (const char *type) case _C_INT: case _C_UINT: case _C_LNG: + case _C_BOOL: case _C_ULNG: case _C_LNG_LNG: case _C_ULNG_LNG: diff --git a/libobjc/objc/objc-api.h b/libobjc/objc/objc-api.h index 1f5b5191ff8d..e393c3952190 100644 --- a/libobjc/objc/objc-api.h +++ b/libobjc/objc/objc-api.h @@ -69,6 +69,7 @@ struct objc_method_description #define _C_FLT 'f' #define _C_DBL 'd' #define _C_BFLD 'b' +#define _C_BOOL 'B' #define _C_VOID 'v' #define _C_UNDEF '?' #define _C_PTR '^'