re PR libobjc/25346 (objc_sizeof_type does not handle _Bool at all)
authorAndrew Pinski <pinskia@physics.uc.edu>
Sun, 11 Dec 2005 06:28:35 +0000 (06:28 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Sun, 11 Dec 2005 06:28:35 +0000 (22:28 -0800)
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

gcc/testsuite/ChangeLog
gcc/testsuite/objc.dg/encode-7.m [new file with mode: 0644]
libobjc/ChangeLog
libobjc/encoding.c
libobjc/objc/objc-api.h

index 28b6eda..71286b1 100644 (file)
@@ -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 (file)
index 0000000..0b49a41
--- /dev/null
@@ -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;
+}
index 809bcc0..56f1ef8 100644 (file)
@@ -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
index efdc2f0..7f6004f 100644 (file)
@@ -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:
index 1f5b519..e393c39 100644 (file)
@@ -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      '^'