]> git.sur5r.net Git - cc65/blobdiff - src/cc65/datatype.c
Fixed two compiler warnings.
[cc65] / src / cc65 / datatype.c
index fdc242d9b5dd4c360e79192e73eca6941e0b8dc9..0d7b27c6021b0aec761a2cfd340b9b15117fe1fc 100644 (file)
@@ -187,7 +187,7 @@ Type* GetImplicitFuncType (void)
     F->TagTab = &EmptySymTab;
 
     /* Fill the type string */
-    T[0].C   = T_FUNC;
+    T[0].C   = T_FUNC | CodeAddrSizeQualifier ();
     T[0].A.P = F;
     T[1].C   = T_INT;
     T[2].C   = T_END;
@@ -249,6 +249,7 @@ void PrintType (FILE* F, const Type* T)
         C = PrintTypeComp (F, C, T_QUAL_NEAR, "__near__");
         C = PrintTypeComp (F, C, T_QUAL_FAR, "__far__");
         C = PrintTypeComp (F, C, T_QUAL_FASTCALL, "__fastcall__");
+        C = PrintTypeComp (F, C, T_QUAL_CDECL, "__cdecl__");
 
        /* Signedness. Omit the signedness specifier for long and int */
                if ((C & T_MASK_TYPE) != T_TYPE_INT && (C & T_MASK_TYPE) != T_TYPE_LONG) {
@@ -333,6 +334,9 @@ void PrintFuncSig (FILE* F, const char* Name, Type* T)
     if (IsQualFastcall (T)) {
        fprintf (F, " __fastcall__");
     }
+    if (IsQualCDecl (T)) {
+       fprintf (F, " __cdecl__");
+    }
     fprintf (F, " %s (", Name);
 
     /* Parameters */
@@ -548,14 +552,11 @@ Type* Indirect (Type* T)
 
 
 
-Type* ArrayToPtr (const Type* T)
+Type* ArrayToPtr (Type* T)
 /* Convert an array to a pointer to it's first element */
 {
-    /* Function must only be called for an array */
-    CHECK (IsTypeArray (T));
-
     /* Return pointer to first element */
-    return PointerTo (T + 1);
+    return PointerTo (GetElementType (T));
 }
 
 
@@ -703,8 +704,10 @@ Type* PtrConversion (Type* T)
  * return T.
  */
 {
-    if (IsTypeFunc (T) || IsTypeArray (T)) {
+    if (IsTypeFunc (T)) {
                return PointerTo (T);
+    } else if (IsTypeArray (T)) {
+        return ArrayToPtr (T);
     } else {
         return T;
     }