OSDN Git Service

PR driver/15303
[pf3gnuchains/gcc-fork.git] / gcc / fortran / misc.c
index 85f982d..b5e6275 100644 (file)
@@ -1,5 +1,5 @@
 /* Miscellaneous stuff that doesn't fit anywhere else.
-   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+   Copyright (C) 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
    Free Software Foundation, Inc.
    Contributed by Andy Vaught
 
@@ -42,22 +42,15 @@ gfc_getmem (size_t n)
 }
 
 
-/* gfortran.h defines free to something that triggers a syntax error,
-   but we need free() here.  */
-
-#define temp free
-#undef free
-
 void
 gfc_free (void *p)
 {
+  /* The parentheses around free are needed in order to call not
+     the redefined free of gfortran.h.  */
   if (p != NULL)
-    free (p);
+    (free) (p);
 }
 
-#define free temp
-#undef temp
-
 
 /* Get terminal width.  */
 
@@ -74,9 +67,10 @@ void
 gfc_clear_ts (gfc_typespec *ts)
 {
   ts->type = BT_UNKNOWN;
+  ts->u.derived = NULL;
   ts->kind = 0;
-  ts->derived = NULL;
-  ts->cl = NULL;
+  ts->u.cl = NULL;
+  ts->interface = NULL;
   /* flag that says if the type is C interoperable */
   ts->is_c_interop = 0;
   /* says what f90 type the C kind interops with */
@@ -136,9 +130,15 @@ gfc_basic_typename (bt type)
     case BT_DERIVED:
       p = "DERIVED";
       break;
+    case BT_CLASS:
+      p = "CLASS";
+      break;
     case BT_PROCEDURE:
       p = "PROCEDURE";
       break;
+    case BT_VOID:
+      p = "VOID";
+      break;
     case BT_UNKNOWN:
       p = "UNKNOWN";
       break;
@@ -186,7 +186,11 @@ gfc_typename (gfc_typespec *ts)
       sprintf (buffer, "HOLLERITH");
       break;
     case BT_DERIVED:
-      sprintf (buffer, "TYPE(%s)", ts->derived->name);
+      sprintf (buffer, "TYPE(%s)", ts->u.derived->name);
+      break;
+    case BT_CLASS:
+      sprintf (buffer, "CLASS(%s)",
+              ts->u.derived->components->ts.u.derived->name);
       break;
     case BT_PROCEDURE:
       strcpy (buffer, "PROCEDURE");