[Ada] move some variables to scope where they are used
[deliverable/binutils-gdb.git] / gdb / p-typeprint.c
index 5c482e6a5fec8b4404f24dc748818ad4b535a278..0d476cec206791bbaa112687f3a90c7b05012a85 100644 (file)
@@ -1,5 +1,5 @@
 /* Support for printing Pascal types for GDB, the GNU debugger.
-   Copyright (C) 2000, 2001, 2002, 2006, 2007, 2008
+   Copyright (C) 2000, 2001, 2002, 2006, 2007, 2008, 2009, 2010
    Free Software Foundation, Inc.
 
    This file is part of GDB.
@@ -46,8 +46,8 @@ void pascal_type_print_varspec_prefix (struct type *, struct ui_file *, int, int
 /* LEVEL is the depth to indent lines by.  */
 
 void
-pascal_print_type (struct type *type, char *varstring, struct ui_file *stream,
-                  int show, int level)
+pascal_print_type (struct type *type, const char *varstring,
+                  struct ui_file *stream, int show, int level)
 {
   enum type_code code;
   int demangled_args;
@@ -165,14 +165,15 @@ pascal_type_print_method_args (char *physname, char *methodname,
 
   if (physname && (*physname != 0))
     {
-      int i = 0;
-      int len = 0;
-      char storec;
-      char *argname;
       fputs_filtered (" (", stream);
       /* we must demangle this */
       while (isdigit (physname[0]))
        {
+         int len = 0;
+         int i;
+         char storec;
+         char *argname;
+
          while (isdigit (physname[len]))
            {
              len++;
@@ -205,7 +206,6 @@ void
 pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
                                  int show, int passed_a_ptr)
 {
-  char *name;
   if (type == 0)
     return;
 
@@ -267,10 +267,9 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
       fprintf_filtered (stream, "array ");
       if (TYPE_LENGTH (TYPE_TARGET_TYPE (type)) > 0
        && !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
-       fprintf_filtered (stream, "[%d..%d] ",
-                         TYPE_ARRAY_LOWER_BOUND_VALUE (type),
-                         TYPE_ARRAY_UPPER_BOUND_VALUE (type)
-         );
+       fprintf_filtered (stream, "[%s..%s] ",
+                         plongest (TYPE_ARRAY_LOWER_BOUND_VALUE (type)),
+                         plongest (TYPE_ARRAY_UPPER_BOUND_VALUE (type)));
       fprintf_filtered (stream, "of ");
       break;
 
@@ -290,7 +289,6 @@ pascal_type_print_varspec_prefix (struct type *type, struct ui_file *stream,
     case TYPE_CODE_BITSTRING:
     case TYPE_CODE_COMPLEX:
     case TYPE_CODE_TYPEDEF:
-    case TYPE_CODE_TEMPLATE:
       /* These types need no prefix.  They are listed here so that
          gcc -Wall will reveal any types that haven't been handled.  */
       break;
@@ -304,6 +302,7 @@ static void
 pascal_print_func_args (struct type *type, struct ui_file *stream)
 {
   int i, len = TYPE_NFIELDS (type);
+
   if (len)
     {
       fprintf_filtered (stream, "(");
@@ -405,7 +404,6 @@ pascal_type_print_varspec_suffix (struct type *type, struct ui_file *stream,
     case TYPE_CODE_BITSTRING:
     case TYPE_CODE_COMPLEX:
     case TYPE_CODE_TYPEDEF:
-    case TYPE_CODE_TEMPLATE:
       /* These types do not need a suffix.  They are listed so that
          gcc -Wall will report types that may not have been considered.  */
       break;
@@ -443,8 +441,8 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
       s_none, s_public, s_private, s_protected
     }
   section_type;
-  QUIT;
 
+  QUIT;
   wrap_here ("    ");
   if (type == NULL)
     {
@@ -590,14 +588,12 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
                }
 
              print_spaces_filtered (level + 4, stream);
-             if (TYPE_FIELD_STATIC (type, i))
-               {
-                 fprintf_filtered (stream, "static ");
-               }
+             if (field_is_static (&TYPE_FIELD (type, i)))
+               fprintf_filtered (stream, "static ");
              pascal_print_type (TYPE_FIELD_TYPE (type, i),
                                 TYPE_FIELD_NAME (type, i),
                                 stream, show - 1, level + 4);
-             if (!TYPE_FIELD_STATIC (type, i)
+             if (!field_is_static (&TYPE_FIELD (type, i))
                  && TYPE_FIELD_PACKED (type, i))
                {
                  /* It is a bitfield.  This code does not attempt
@@ -623,7 +619,7 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
              struct fn_field *f = TYPE_FN_FIELDLIST1 (type, i);
              int j, len2 = TYPE_FN_FIELDLIST_LENGTH (type, i);
              char *method_name = TYPE_FN_FIELDLIST_NAME (type, i);
-             char *name = type_name_no_tag (type);
+
              /* this is GNU C++ specific
                 how can we know constructor/destructor?
                 It might work for GNU pascal */
@@ -763,15 +759,14 @@ pascal_type_print_base (struct type *type, struct ui_file *stream, int show,
       break;
 
     case TYPE_CODE_ERROR:
-      fprintf_filtered (stream, "<unknown type>");
+      fprintf_filtered (stream, "%s", TYPE_ERROR_NAME (type));
       break;
 
       /* this probably does not work for enums */
     case TYPE_CODE_RANGE:
       {
        struct type *target = TYPE_TARGET_TYPE (type);
-       if (target == NULL)
-         target = builtin_type_int32;
+
        print_type_scalar (target, TYPE_LOW_BOUND (type), stream);
        fputs_filtered ("..", stream);
        print_type_scalar (target, TYPE_HIGH_BOUND (type), stream);
This page took 0.02549 seconds and 4 git commands to generate.