aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Pinski <pinskia@physics.uc.edu>2005-12-11 06:28:35 +0000
committerAndrew Pinski <pinskia@gcc.gnu.org>2005-12-10 22:28:35 -0800
commit153b4898d243846931a06682cd06ce16b826d755 (patch)
tree420342e937a38ecbfb6c217f8abd0a9f255e7a29
parentb91365538ab86873619628d4f8e2ea692ea5b212 (diff)
downloadgcc-153b4898d243846931a06682cd06ce16b826d755.zip
gcc-153b4898d243846931a06682cd06ce16b826d755.tar.gz
gcc-153b4898d243846931a06682cd06ce16b826d755.tar.bz2
re PR libobjc/25346 (objc_sizeof_type does not handle _Bool at all)
2005-12-11 Andrew Pinski <pinskia@physics.uc.edu> 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 <pinskia@physics.uc.edu> PR libobjc/25346 * objc.dg/encode-7.m: New test. From-SVN: r108378
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/objc.dg/encode-7.m18
-rw-r--r--libobjc/ChangeLog8
-rw-r--r--libobjc/encoding.c9
-rw-r--r--libobjc/objc/objc-api.h1
5 files changed, 41 insertions, 0 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 28b6eda..71286b1 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2005-12-11 Andrew Pinski <pinskia@physics.uc.edu>
+
+ PR libobjc/25346
+ * objc.dg/encode-7.m: New test.
+
2005-12-10 Mark Mitchell <mark@codesourcery.com>
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 0000000..0b49a41
--- /dev/null
+++ b/gcc/testsuite/objc.dg/encode-7.m
@@ -0,0 +1,18 @@
+/* { dg-options "-fgnu-runtime" } */
+/* { dg-do run } */
+
+#include <objc/encoding.h>
+#include <stdlib.h>
+
+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 809bcc0..56f1ef8 100644
--- a/libobjc/ChangeLog
+++ b/libobjc/ChangeLog
@@ -1,3 +1,11 @@
+2005-12-11 Andrew Pinski <pinskia@physics.uc.edu>
+
+ 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 <d.ayers@inode.at>
PR libobjc/19024
diff --git a/libobjc/encoding.c b/libobjc/encoding.c
index efdc2f0..7f6004f 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 1f5b519..e393c39 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 '^'