OSDN Git Service

2005-12-14 Andrew Pinski <pinskia@physics.uc.edu>
authorpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Dec 2005 20:19:37 +0000 (20:19 +0000)
committerpinskia <pinskia@138bc75d-0d04-0410-961f-82ee72b054a4>
Fri, 16 Dec 2005 20:19:37 +0000 (20:19 +0000)
        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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@108675 138bc75d-0d04-0410-961f-82ee72b054a4

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

index 5f7951f..466ff50 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
 2005-12-12  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR objc/25348
index 201a722..526dec6 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 == 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
 }
 
 static void
index 3ac957d..27378fb 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
 2005-12-15  David Ayers  <d.ayers@inode.at>
 
        PR libobjc/14382
index af6b93d..21a7858 100644 (file)
@@ -248,6 +248,68 @@ objc_sizeof_type (const char *type)
 
       return size;
     }
 
       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:
     {
 
   default:
     {
@@ -360,6 +422,69 @@ objc_alignof_type (const char *type)
 
       return align;
     }
 
       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:
     {
 
   default:
     {
@@ -491,6 +616,10 @@ objc_skip_typespec (const char *type)
   case _C_UNDEF:
     return ++type;
     break;
   case _C_UNDEF:
     return ++type;
     break;
+    
+  case _C_COMPLEX:
+    return type + 2;
+    break;
 
   case _C_ARY_B:
     /* skip digits, typespec and closing ']' */
 
   case _C_ARY_B:
     /* skip digits, typespec and closing ']' */
index e393c39..e0e49e2 100644 (file)
@@ -82,6 +82,7 @@ struct objc_method_description
 #define _C_STRUCT_B '{'
 #define _C_STRUCT_E '}'
 #define _C_VECTOR   '!'
 #define _C_STRUCT_B '{'
 #define _C_STRUCT_E '}'
 #define _C_VECTOR   '!'
+#define _C_COMPLEX   'j'
 
 
 /*
 
 
 /*