import gdb-1999-06-21 snapshot
[external/binutils.git] / binutils / prdbg.c
index c8c2bab..958cbd2 100644 (file)
@@ -1,5 +1,5 @@
 /* prdbg.c -- Print out generic debugging information.
-   Copyright (C) 1995 Free Software Foundation, Inc.
+   Copyright (C) 1995, 1996 Free Software Foundation, Inc.
    Written by Ian Lance Taylor <ian@cygnus.com>.
 
    This file is part of GNU Binutils.
@@ -78,24 +78,27 @@ static boolean pr_int_type PARAMS ((PTR, unsigned int, boolean));
 static boolean pr_float_type PARAMS ((PTR, unsigned int));
 static boolean pr_complex_type PARAMS ((PTR, unsigned int));
 static boolean pr_bool_type PARAMS ((PTR, unsigned int));
-static boolean pr_enum_type PARAMS ((PTR, const char **, bfd_signed_vma *));
+static boolean pr_enum_type
+  PARAMS ((PTR, const char *, const char **, bfd_signed_vma *));
 static boolean pr_pointer_type PARAMS ((PTR));
-static boolean pr_function_type PARAMS ((PTR));
+static boolean pr_function_type PARAMS ((PTR, int, boolean));
 static boolean pr_reference_type PARAMS ((PTR));
 static boolean pr_range_type PARAMS ((PTR, bfd_signed_vma, bfd_signed_vma));
 static boolean pr_array_type
   PARAMS ((PTR, bfd_signed_vma, bfd_signed_vma, boolean));
 static boolean pr_set_type PARAMS ((PTR, boolean));
 static boolean pr_offset_type PARAMS ((PTR));
-static boolean pr_method_type PARAMS ((PTR, boolean, int));
+static boolean pr_method_type PARAMS ((PTR, boolean, int, boolean));
 static boolean pr_const_type PARAMS ((PTR));
 static boolean pr_volatile_type PARAMS ((PTR));
-static boolean pr_start_struct_type PARAMS ((PTR, boolean, unsigned int));
+static boolean pr_start_struct_type
+  PARAMS ((PTR, const char *, unsigned int, boolean, unsigned int));
 static boolean pr_struct_field
   PARAMS ((PTR, const char *, bfd_vma, bfd_vma, enum debug_visibility));
 static boolean pr_end_struct_type PARAMS ((PTR));
 static boolean pr_start_class_type
-  PARAMS ((PTR, boolean, unsigned int, boolean, boolean));
+  PARAMS ((PTR, const char *, unsigned int, boolean, unsigned int, boolean,
+          boolean));
 static boolean pr_class_static_member
   PARAMS ((PTR, const char *, const char *, enum debug_visibility));
 static boolean pr_class_baseclass
@@ -109,7 +112,8 @@ static boolean pr_class_static_method_variant
 static boolean pr_class_end_method PARAMS ((PTR));
 static boolean pr_end_class_type PARAMS ((PTR));
 static boolean pr_typedef_type PARAMS ((PTR, const char *));
-static boolean pr_tag_type PARAMS ((PTR, const char *, enum debug_type_kind));
+static boolean pr_tag_type
+  PARAMS ((PTR, const char *, unsigned int, enum debug_type_kind));
 static boolean pr_typdef PARAMS ((PTR, const char *));
 static boolean pr_tag PARAMS ((PTR, const char *));
 static boolean pr_int_constant PARAMS ((PTR, const char *, bfd_vma));
@@ -121,9 +125,9 @@ static boolean pr_start_function PARAMS ((PTR, const char *, boolean));
 static boolean pr_function_parameter
   PARAMS ((PTR, const char *, enum debug_parm_kind, bfd_vma));
 static boolean pr_start_block PARAMS ((PTR, bfd_vma));
-static boolean pr_lineno PARAMS ((PTR, const char *, unsigned long, bfd_vma));
 static boolean pr_end_block PARAMS ((PTR, bfd_vma));
 static boolean pr_end_function PARAMS ((PTR));
+static boolean pr_lineno PARAMS ((PTR, const char *, unsigned long, bfd_vma));
 
 static const struct debug_write_fns pr_fns =
 {
@@ -168,9 +172,9 @@ static const struct debug_write_fns pr_fns =
   pr_start_function,
   pr_function_parameter,
   pr_start_block,
-  pr_lineno,
   pr_end_block,
-  pr_end_function
+  pr_end_function,
+  pr_lineno
 };
 \f
 /* Print out the generic debugging information recorded in dhandle.  */
@@ -337,7 +341,7 @@ pop_type (info)
      struct pr_handle *info;
 {
   struct pr_stack *o;
-  char *ret, *s;
+  char *ret;
 
   assert (info->stack != NULL);
 
@@ -346,10 +350,6 @@ pop_type (info)
   ret = o->type;
   free (o);
 
-  s = strchr (ret, '+');
-  if (s != NULL)
-    memmove (s, s + 2, strlen (s + 2) + 1);
-
   return ret;
 }
 
@@ -500,8 +500,9 @@ pr_bool_type (p, size)
 /* Push an enum type onto the type stack.  */
 
 static boolean
-pr_enum_type (p, names, values)
+pr_enum_type (p, tag, names, values)
      PTR p;
+     const char *tag;
      const char **names;
      bfd_signed_vma *values;
 {
@@ -509,34 +510,49 @@ pr_enum_type (p, names, values)
   unsigned int i;
   bfd_signed_vma val;
 
-  /* The + indicates where the tag goes, if there is one.  */
-  if (! push_type (info, "enum + { "))
+  if (! push_type (info, "enum "))
+    return false;
+  if (tag != NULL)
+    {
+      if (! append_type (info, tag)
+         || ! append_type (info, " "))
+       return false;
+    }
+  if (! append_type (info, "{ "))
     return false;
 
-  val = 0;
-  for (i = 0; names[i] != NULL; i++)
+  if (names == NULL)
     {
-      if (i > 0)
+      if (! append_type (info, "/* undefined */"))
+       return false;
+    }
+  else
+    {
+      val = 0;
+      for (i = 0; names[i] != NULL; i++)
        {
-         if (! append_type (info, ", "))
+         if (i > 0)
+           {
+             if (! append_type (info, ", "))
+               return false;
+           }
+
+         if (! append_type (info, names[i]))
            return false;
-       }
 
-      if (! append_type (info, names[i]))
-       return false;
+         if (values[i] != val)
+           {
+             char ab[20];
 
-      if (values[i] != val)
-       {
-         char ab[20];
+             print_vma (values[i], ab, false, false);
+             if (! append_type (info, " = ")
+                 || ! append_type (info, ab))
+               return false;
+             val = values[i];
+           }
 
-         print_vma (values[i], ab, false, false);
-         if (! append_type (info, " = ")
-             || ! append_type (info, ab))
-           return false;
-         val = values[i];
+         ++val;
        }
-
-      ++val;
     }
 
   return append_type (info, " }");
@@ -549,23 +565,91 @@ pr_pointer_type (p)
      PTR p;
 {
   struct pr_handle *info = (struct pr_handle *) p;
+  char *s;
 
   assert (info->stack != NULL);
 
+  s = strchr (info->stack->type, '|');
+  if (s != NULL && s[1] == '[')
+    return substitute_type (info, "(*|)");
   return substitute_type (info, "*|");
 }
 
 /* Turn the top type on the stack into a function returning that type.  */
 
 static boolean
-pr_function_type (p)
+pr_function_type (p, argcount, varargs)
      PTR p;
+     int argcount;
+     boolean varargs;
 {
   struct pr_handle *info = (struct pr_handle *) p;
+  char **arg_types;
+  unsigned int len;
+  char *s;
 
   assert (info->stack != NULL);
 
-  return substitute_type (info, "(|) ()");
+  len = 10;
+
+  if (argcount <= 0)
+    {
+      arg_types = NULL;
+      len += 15;
+    }
+  else
+    {
+      int i;
+
+      arg_types = (char **) xmalloc (argcount * sizeof *arg_types);
+      for (i = argcount - 1; i >= 0; i--)
+       {
+         if (! substitute_type (info, ""))
+           return false;
+         arg_types[i] = pop_type (info);
+         if (arg_types[i] == NULL)
+           return false;
+         len += strlen (arg_types[i]) + 2;
+       }
+      if (varargs)
+       len += 5;
+    }
+
+  /* Now the return type is on the top of the stack.  */
+
+  s = (char *) xmalloc (len);
+  strcpy (s, "(|) (");
+
+  if (argcount < 0)
+    strcat (s, "/* unknown */");
+  else
+    {
+      int i;
+
+      for (i = 0; i < argcount; i++)
+       {
+         if (i > 0)
+           strcat (s, ", ");
+         strcat (s, arg_types[i]);
+       }
+      if (varargs)
+       {
+         if (i > 0)
+           strcat (s, ", ");
+         strcat (s, "...");
+       }
+      if (argcount > 0)
+       free (arg_types);
+    }
+
+  strcat (s, ")");
+
+  if (! substitute_type (info, s))
+    return false;
+
+  free (s);
+
+  return true;
 }
 
 /* Turn the top type on the stack into a reference to that type.  */
@@ -712,10 +796,11 @@ pr_offset_type (p)
 /* Make a method type.  */
 
 static boolean
-pr_method_type (p, domain, argcount)
+pr_method_type (p, domain, argcount, varargs)
      PTR p;
      boolean domain;
      int argcount;
+     boolean varargs;
 {
   struct pr_handle *info = (struct pr_handle *) p;
   unsigned int len;
@@ -764,6 +849,8 @@ pr_method_type (p, domain, argcount)
            return false;
          len += strlen (arg_types[i]) + 2;
        }
+      if (varargs)
+       len += 5;
     }
 
   /* Now the return type is on the top of the stack.  */
@@ -787,6 +874,14 @@ pr_method_type (p, domain, argcount)
            strcat (s, ", ");
          strcat (s, arg_types[i]);
        }
+      if (varargs)
+       {
+         if (i > 0)
+           strcat (s, ", ");
+         strcat (s, "...");
+       }
+      if (argcount > 0)
+       free (arg_types);
     }
 
   strcat (s, ")");
@@ -824,28 +919,62 @@ pr_volatile_type (p)
 /* Start accumulating a struct type.  */
 
 static boolean
-pr_start_struct_type (p, structp, size)
+pr_start_struct_type (p, tag, id, structp, size)
      PTR p;
+     const char *tag;
+     unsigned int id;
      boolean structp;
      unsigned int size;
 {
   struct pr_handle *info = (struct pr_handle *) p;
-  const char *t;
-  char ab[30];
 
   info->indent += 2;
 
-  if (structp)
-    t = "struct";
-  else
-    t = "union";
-  if (size != 0)
-    sprintf (ab, "%s + { /* size %u */\n", t, size);
+  if (! push_type (info, structp ? "struct " : "union "))
+    return false;
+  if (tag != NULL)
+    {
+      if (! append_type (info, tag))
+       return false;
+    }
   else
-    sprintf (ab, "%s + {\n", t);
-  if (! push_type (info, ab))
+    {
+      char idbuf[20];
+
+      sprintf (idbuf, "%%anon%u", id);
+      if (! append_type (info, idbuf))
+       return false;
+    }
+
+  if (! append_type (info, " {"))
+    return false;
+  if (size != 0 || tag != NULL)
+    {
+      char ab[30];
+
+      if (! append_type (info, " /*"))
+       return false;
+
+      if (size != 0)
+       {
+         sprintf (ab, " size %u", size);
+         if (! append_type (info, ab))
+           return false;
+       }
+      if (tag != NULL)
+       {
+         sprintf (ab, " id %u", id);
+         if (! append_type (info, ab))
+           return false;
+       }
+      if (! append_type (info, " */"))
+       return false;
+    }
+  if (! append_type (info, "\n"))
     return false;
+
   info->stack->visibility = DEBUG_VISIBILITY_PUBLIC;
+
   return indent_type (info);
 }
 
@@ -857,16 +986,15 @@ pr_fix_visibility (info, visibility)
      enum debug_visibility visibility;
 {
   const char *s;
-  struct pr_stack *top;
   char *t;
   unsigned int len;
 
-  assert (info->stack != NULL && info->stack->next != NULL);
+  assert (info->stack != NULL);
 
-  if (info->stack->next->visibility == visibility)
+  if (info->stack->visibility == visibility)
     return true;
 
-  assert (info->stack->next->visibility != DEBUG_VISIBILITY_IGNORE);
+  assert (info->stack->visibility != DEBUG_VISIBILITY_IGNORE);
 
   switch (visibility)
     {
@@ -879,18 +1007,16 @@ pr_fix_visibility (info, visibility)
     case DEBUG_VISIBILITY_PROTECTED:
       s = "protected";
       break;
+    case DEBUG_VISIBILITY_IGNORE:
+      s = "/* ignore */";
+      break;
     default:
       abort ();
       return false;
     }
 
   /* Trim off a trailing space in the struct string, to make the
-     output look a bit better, then stick on the visibility string.
-     Pop the stack temporarily to make the string manipulation
-     simpler.  */
-
-  top = info->stack;
-  info->stack = top->next;
+     output look a bit better, then stick on the visibility string.  */
 
   t = info->stack->type;
   len = strlen (t);
@@ -904,8 +1030,6 @@ pr_fix_visibility (info, visibility)
 
   info->stack->visibility = visibility;
 
-  info->stack = top;
-
   return true;
 }
 
@@ -921,9 +1045,7 @@ pr_struct_field (p, name, bitpos, bitsize, visibility)
 {
   struct pr_handle *info = (struct pr_handle *) p;
   char ab[20];
-
-  if (! pr_fix_visibility (info, visibility))
-    return false;
+  char *t;
 
   if (! substitute_type (info, name))
     return false;
@@ -947,7 +1069,14 @@ pr_struct_field (p, name, bitpos, bitsize, visibility)
       || ! indent_type (info))
     return false;
 
-  return append_type (info, pop_type (info));
+  t = pop_type (info);
+  if (t == NULL)
+    return false;
+
+  if (! pr_fix_visibility (info, visibility))
+    return false;
+
+  return append_type (info, t);
 }
 
 /* Finish a struct type.  */
@@ -966,7 +1095,7 @@ pr_end_struct_type (p)
 
   /* Change the trailing indentation to have a close brace.  */
   s = info->stack->type + strlen (info->stack->type) - 2;
-  assert (strcmp (s, "  ") == 0);
+  assert (s[0] == ' ' && s[1] == ' ' && s[2] == '\0');
 
   *s++ = '}';
   *s = '\0';
@@ -977,8 +1106,10 @@ pr_end_struct_type (p)
 /* Start a class type.  */
 
 static boolean
-pr_start_class_type (p, structp, size, vptr, ownvptr)
+pr_start_class_type (p, tag, id, structp, size, vptr, ownvptr)
      PTR p;
+     const char *tag;
+     unsigned int id;
      boolean structp;
      unsigned int size;
      boolean vptr;
@@ -996,10 +1127,25 @@ pr_start_class_type (p, structp, size, vptr, ownvptr)
        return false;
     }
 
-  if (! push_type (info, structp ? "class" : "union class")
-      || ! append_type (info, " + {"))
+  if (! push_type (info, structp ? "class " : "union class "))
     return false;
-  if (size != 0 || vptr || ownvptr)
+  if (tag != NULL)
+    {
+      if (! append_type (info, tag))
+       return false;
+    }
+  else
+    {
+      char idbuf[20];
+
+      sprintf (idbuf, "%%anon%u", id);
+      if (! append_type (info, idbuf))
+       return false;
+    }
+
+  if (! append_type (info, " {"))
+    return false;
+  if (size != 0 || vptr || ownvptr || tag != NULL)
     {
       if (! append_type (info, " /*"))
        return false;
@@ -1031,6 +1177,15 @@ pr_start_class_type (p, structp, size, vptr, ownvptr)
            }
        }
 
+      if (tag != NULL)
+       {
+         char ab[30];
+
+         sprintf (ab, " id %u", id);
+         if (! append_type (info, ab))
+           return false;
+       }
+
       if (! append_type (info, " */"))
        return false;
     }
@@ -1051,19 +1206,26 @@ pr_class_static_member (p, name, physname, visibility)
      enum debug_visibility visibility;
 {
   struct pr_handle *info = (struct pr_handle *) p;
+  char *t;
 
-  if (! pr_fix_visibility (info, visibility))
+  if (! substitute_type (info, name))
     return false;
 
-  if (! substitute_type (info, name))
+  if (! prepend_type (info, "static ")
+      || ! append_type (info, "; /* ")
+      || ! append_type (info, physname)
+      || ! append_type (info, " */\n")
+      || ! indent_type (info))
     return false;
 
-  return (prepend_type (info, "static ")
-         && append_type (info, "; /* physname ")
-         && append_type (info, physname)
-         && append_type (info, " */\n")
-         && indent_type (info)
-         && append_type (info, pop_type (info)));
+  t = pop_type (info);
+  if (t == NULL)
+    return false;
+
+  if (! pr_fix_visibility (info, visibility))
+    return false;
+
+  return append_type (info, t);
 }
 
 /* Add a base class to a class.  */
@@ -1079,7 +1241,7 @@ pr_class_baseclass (p, bitpos, virtual, visibility)
   char *t;
   const char *prefix;
   char ab[20];
-  char *s, *n;
+  char *s, *l, *n;
 
   assert (info->stack != NULL && info->stack->next != NULL);
 
@@ -1134,27 +1296,19 @@ pr_class_baseclass (p, bitpos, virtual, visibility)
 
   /* Now the top of the stack is something like "public A / * bitpos
      10 * /".  The next element on the stack is something like "class
-     + { / * size 8 * /\n...".  We want to substitute the top of the
-     stack in after the +.  */
-  s = strchr (info->stack->next->type, '+');
+     xx { / * size 8 * /\n...".  We want to substitute the top of the
+     stack in before the {.  */
+  s = strchr (info->stack->next->type, '{');
   assert (s != NULL);
+  --s;
 
-  if (s[2] != ':')
-    {
-      ++s;
-      assert (s[1] == '{');
-      if (! prepend_type (info, " : "))
-       return false;
-    }
-  else
-    {
-      /* We already have a baseclass.  Append this one after a comma.  */
-      s = strchr (s, '{');
-      assert (s != NULL);
-      --s;
-      if (! prepend_type (info, ", "))
-       return false;
-    }
+  /* If there is already a ':', then we already have a baseclass, and
+     we must append this one after a comma.  */
+  for (l = info->stack->next->type; l != s; l++)
+    if (*l == ':')
+      break;
+  if (! prepend_type (info, l == s ? " : " : ", "))
+    return false;
 
   t = pop_type (info);
   if (t == NULL)
@@ -1182,8 +1336,7 @@ pr_class_start_method (p, name)
 {
   struct pr_handle *info = (struct pr_handle *) p;
 
-  if (! push_type (info, ""))
-    return false;
+  assert (info->stack != NULL);
   info->stack->method = name;
   return true;
 }
@@ -1191,10 +1344,10 @@ pr_class_start_method (p, name)
 /* Add a variant to a method.  */
 
 static boolean
-pr_class_method_variant (p, argtypes, visibility, constp, volatilep, voffset,
+pr_class_method_variant (p, physname, visibility, constp, volatilep, voffset,
                         context)
      PTR p;
-     const char *argtypes;
+     const char *physname;
      enum debug_visibility visibility;
      boolean constp;
      boolean volatilep;
@@ -1211,12 +1364,12 @@ pr_class_method_variant (p, argtypes, visibility, constp, volatilep, voffset,
   /* Put the const and volatile qualifiers on the type.  */
   if (volatilep)
     {
-      if (! prepend_type (info, "volatile "))
+      if (! append_type (info, " volatile"))
        return false;
     }
   if (constp)
     {
-      if (! prepend_type (info, "const "))
+      if (! append_type (info, " const"))
        return false;
     }
 
@@ -1242,15 +1395,15 @@ pr_class_method_variant (p, argtypes, visibility, constp, volatilep, voffset,
        return false;
     }
 
-  /* Now the top of the stack is the holder for the method, and the
-     second element on the stack is the class.  */
+  /* Now the top of the stack is the class.  */
 
   if (! pr_fix_visibility (info, visibility))
     return false;
 
   if (! append_type (info, method_type)
       || ! append_type (info, " /* ")
-      || ! append_type (info, argtypes))
+      || ! append_type (info, physname)
+      || ! append_type (info, " "))
     return false;
   if (context || voffset != 0)
     {
@@ -1276,9 +1429,9 @@ pr_class_method_variant (p, argtypes, visibility, constp, volatilep, voffset,
 /* Add a static variant to a method.  */
 
 static boolean
-pr_class_static_method_variant (p, argtypes, visibility, constp, volatilep)
+pr_class_static_method_variant (p, physname, visibility, constp, volatilep)
      PTR p;
-     const char *argtypes;
+     const char *physname;
      enum debug_visibility visibility;
      boolean constp;
      boolean volatilep;
@@ -1293,12 +1446,12 @@ pr_class_static_method_variant (p, argtypes, visibility, constp, volatilep)
   /* Put the const and volatile qualifiers on the type.  */
   if (volatilep)
     {
-      if (! prepend_type (info, "volatile "))
+      if (! append_type (info, " volatile"))
        return false;
     }
   if (constp)
     {
-      if (! prepend_type (info, "const "))
+      if (! append_type (info, " const"))
        return false;
     }
 
@@ -1315,15 +1468,14 @@ pr_class_static_method_variant (p, argtypes, visibility, constp, volatilep)
   if (method_type == NULL)
     return false;
 
-  /* Now the top of the stack is the holder for the method, and the
-     second element on the stack is the class.  */
+  /* Now the top of the stack is the class.  */
 
   if (! pr_fix_visibility (info, visibility))
     return false;
 
   return (append_type (info, method_type)
          && append_type (info, " /* ")
-         && append_type (info, argtypes)
+         && append_type (info, physname)
          && append_type (info, " */;\n")
          && indent_type (info));
 }
@@ -1336,11 +1488,8 @@ pr_class_end_method (p)
 {
   struct pr_handle *info = (struct pr_handle *) p;
 
-  /* The method variants have been appended to the string on top of
-     the stack with the correct indentation.  We just need the append
-     the string on top of the stack to the class string that is second
-     on the stack.  */
-  return append_type (info, pop_type (info));
+  info->stack->method = NULL;
+  return true;
 }
 
 /* Finish up a class.  */
@@ -1367,13 +1516,15 @@ pr_typedef_type (p, name)
 /* Push a type on the stack using a tag name.  */
 
 static boolean
-pr_tag_type (p, name, kind)
+pr_tag_type (p, name, id, kind)
      PTR p;
      const char *name;
+     unsigned int id;
      enum debug_type_kind kind;
 {
   struct pr_handle *info = (struct pr_handle *) p;
-  const char *t;
+  const char *t, *tag;
+  char idbuf[20];
 
   switch (kind)
     {
@@ -1397,8 +1548,26 @@ pr_tag_type (p, name, kind)
       return false;
     }
 
-  return (push_type (info, t)
-         && append_type (info, name));
+  if (! push_type (info, t))
+    return false;
+  if (name != NULL)
+    tag = name;
+  else
+    {
+      sprintf (idbuf, "%%anon%u", id);
+      tag = idbuf;
+    }
+
+  if (! append_type (info, tag))
+    return false;
+  if (name != NULL && kind != DEBUG_KIND_ENUM)
+    {
+      sprintf (idbuf, " /* id %u */", id);
+      if (! append_type (info, idbuf))
+       return false;
+    }
+
+  return true;
 }
 
 /* Output a typedef.  */
@@ -1426,31 +1595,17 @@ pr_typdef (p, name)
   return true;
 }
 
-/* Output a tag.  */
+/* Output a tag.  The tag should already be in the string on the
+   stack, so all we have to do here is print it out.  */
 
+/*ARGSUSED*/
 static boolean
 pr_tag (p, name)
      PTR p;
      const char *name;
 {
   struct pr_handle *info = (struct pr_handle *) p;
-  char *t, *s, *n;
-
-  assert (info->stack != NULL);
-
-  t = info->stack->type;
-
-  s = strchr (t, '+');
-  assert (s != NULL);
-
-  n = (char *) xmalloc (strlen (t) + strlen (name));
-
-  memcpy (n, t, s - t);
-  strcpy (n + (s - t), name);
-  strcat (n, s + 1);
-
-  free (t);
-  info->stack->type = n;
+  char *t;
 
   t = pop_type (info);
   if (t == NULL)
@@ -1459,7 +1614,7 @@ pr_tag (p, name)
   indent (info);
   fprintf (info->f, "%s;\n", t);
 
-  free (n);
+  free (t);
 
   return true;
 }
@@ -1472,7 +1627,7 @@ pr_int_constant (p, name, val)
      const char *name;
      bfd_vma val;
 {
-  struct pr_handle *info = (struct pr_handle *) info;
+  struct pr_handle *info = (struct pr_handle *) p;
   char ab[20];
 
   indent (info);
@@ -1489,7 +1644,7 @@ pr_float_constant (p, name, val)
      const char *name;
      double val;
 {
-  struct pr_handle *info = (struct pr_handle *) info;
+  struct pr_handle *info = (struct pr_handle *) p;
 
   indent (info);
   fprintf (info->f, "const double %s = %g;\n", name, val);