]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
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 28b6eda6d56b4ea81bc2398ade3c84a7bcf8738a..71286b1cb8ac4dc39edd346eb876c8602a47b77f 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 809bcc0abe53a6ad63401db041e4448300d178b4..56f1ef8a8569fbee13d311de4097cc75520ef5e3 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 efdc2f0a1614b6d66d882bd177f78cf87a86453f..7f6004fb9ca436711ed1e33c05be7198abedbb95 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 1f5b5191ff8d282172d26a1381914cf356f478bb..e393c3952190ea45356a0f5954388013a3f385d8 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      '^'