]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR objc/25360 (Complex types are not encoded)
authorAndrew Pinski <pinskia@physics.uc.edu>
Fri, 16 Dec 2005 20:19:37 +0000 (20:19 +0000)
committerAndrew Pinski <pinskia@gcc.gnu.org>
Fri, 16 Dec 2005 20:19:37 +0000 (12:19 -0800)
2005-12-14  Andrew Pinski  <pinskia@physics.uc.edu>

        PR objc/25360
        * objc/objc-act.c (encode_type): Encode Complex types as 'j' followed
        by the inner type.

2005-12-14  Andrew Pinski  <pinskia@physics.uc.edu>

        PR objc/25360
        * objc/objc-api.c (_C_COMPLEX): New define.
        * encoding.c (objc_sizeof_type): Handle _C_Complex.
        (objc_alignof_type): Likewise.
        (objc_skip_typespec): Likewise.

From-SVN: r108675

gcc/objc/ChangeLog
gcc/objc/objc-act.c
libobjc/ChangeLog
libobjc/encoding.c
libobjc/objc/objc-api.h

index 5f7951f82db4bd98c19e648fe9733a4348c751d7..466ff50ca26cd9be1854e49fff4c0d4c9ae60020 100644 (file)
@@ -1,3 +1,9 @@
+2005-12-14  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR objc/25360
+        * objc/objc-act.c (encode_type): Encode Complex types as 'j' followed
+        by the inner type.
+
 2005-12-12  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR objc/25348
index 201a722c2321376129845bafd3b9b2ecad345174..526dec6144b706dc8e9dff979905e3879d95b2f8 100644 (file)
@@ -8119,6 +8119,12 @@ encode_type (tree type, int curtype, int format)
 
   else if (code == FUNCTION_TYPE) /* '?' */
     obstack_1grow (&util_obstack, '?');
+    
+  else if (code == COMPLEX_TYPE)
+    {
+      obstack_1grow (&util_obstack, 'j');
+      encode_type (TREE_TYPE (type), curtype, format);
+    }
 }
 
 static void
index 3ac957d3baf24996e4deb529c7cde7b5cf640cba..27378fbd79bb5580f3576f0ca4a4d010b7d95e63 100644 (file)
@@ -1,3 +1,11 @@
+2005-12-14  Andrew Pinski  <pinskia@physics.uc.edu>
+
+       PR objc/25360
+        * objc/objc-api.c (_C_COMPLEX): New define.
+        * encoding.c (objc_sizeof_type): Handle _C_Complex.
+        (objc_alignof_type): Likewise.
+        (objc_skip_typespec): Likewise.
+
 2005-12-15  David Ayers  <d.ayers@inode.at>
 
        PR libobjc/14382
index af6b93d4498c92f5efd10c9d52945bdf4a6a1277..21a785814dc8d51a82e6cf3b037b0089cf3cf29d 100644 (file)
@@ -248,6 +248,68 @@ objc_sizeof_type (const char *type)
 
       return size;
     }
+    
+  case _C_COMPLEX:
+    {
+      type++; /* Skip after the 'j'. */
+      switch (*type)
+        {
+           case _C_CHR:
+             return sizeof (_Complex char);
+             break;
+
+           case _C_UCHR:
+             return sizeof (_Complex unsigned char);
+             break;
+
+           case _C_SHT:
+             return sizeof (_Complex short);
+             break;
+
+           case _C_USHT:
+             return sizeof (_Complex unsigned short);
+             break;
+
+           case _C_INT:
+             return sizeof (_Complex int);
+             break;
+
+           case _C_UINT:
+             return sizeof (_Complex unsigned int);
+             break;
+
+           case _C_LNG:
+             return sizeof (_Complex long);
+             break;
+
+           case _C_ULNG:
+             return sizeof (_Complex unsigned long);
+             break;
+
+           case _C_LNG_LNG:
+             return sizeof (_Complex long long);
+             break;
+
+           case _C_ULNG_LNG:
+             return sizeof (_Complex unsigned long long);
+             break;
+
+           case _C_FLT:
+             return sizeof (_Complex float);
+             break;
+
+           case _C_DBL:
+             return sizeof (_Complex double);
+             break;
+           
+           default:
+             {
+               objc_error (nil, OBJC_ERR_BAD_TYPE, "unknown complex type %s\n",
+                           type);
+               return 0;
+             }
+       }
+    }
 
   default:
     {
@@ -360,6 +422,69 @@ objc_alignof_type (const char *type)
 
       return align;
     }
+    
+    
+  case _C_COMPLEX:
+    {
+      type++; /* Skip after the 'j'. */
+      switch (*type)
+        {
+           case _C_CHR:
+             return __alignof__ (_Complex char);
+             break;
+
+           case _C_UCHR:
+             return __alignof__ (_Complex unsigned char);
+             break;
+
+           case _C_SHT:
+             return __alignof__ (_Complex short);
+             break;
+
+           case _C_USHT:
+             return __alignof__ (_Complex unsigned short);
+             break;
+
+           case _C_INT:
+             return __alignof__ (_Complex int);
+             break;
+
+           case _C_UINT:
+             return __alignof__ (_Complex unsigned int);
+             break;
+
+           case _C_LNG:
+             return __alignof__ (_Complex long);
+             break;
+
+           case _C_ULNG:
+             return __alignof__ (_Complex unsigned long);
+             break;
+
+           case _C_LNG_LNG:
+             return __alignof__ (_Complex long long);
+             break;
+
+           case _C_ULNG_LNG:
+             return __alignof__ (_Complex unsigned long long);
+             break;
+
+           case _C_FLT:
+             return __alignof__ (_Complex float);
+             break;
+
+           case _C_DBL:
+             return __alignof__ (_Complex double);
+             break;
+           
+           default:
+             {
+               objc_error (nil, OBJC_ERR_BAD_TYPE, "unknown complex type %s\n",
+                           type);
+               return 0;
+             }
+       }
+    }
 
   default:
     {
@@ -491,6 +616,10 @@ objc_skip_typespec (const char *type)
   case _C_UNDEF:
     return ++type;
     break;
+    
+  case _C_COMPLEX:
+    return type + 2;
+    break;
 
   case _C_ARY_B:
     /* skip digits, typespec and closing ']' */
index e393c3952190ea45356a0f5954388013a3f385d8..e0e49e21fdfc89f86f424978b39802069951e5a4 100644 (file)
@@ -82,6 +82,7 @@ struct objc_method_description
 #define _C_STRUCT_B '{'
 #define _C_STRUCT_E '}'
 #define _C_VECTOR   '!'
+#define _C_COMPLEX   'j'
 
 
 /*