Fix gcc -Wall warnings. See ChangeLog for details.
[deliverable/binutils-gdb.git] / gdb / ch-typeprint.c
index f06a85cca79baa2b6aed401561eddcd212e5c1fd..a6b1944d3870f8886ec06a3d75a22792e0ad57a0 100644 (file)
@@ -15,7 +15,7 @@ GNU General Public License for more details.
 
 You should have received a copy of the GNU General Public License
 along with this program; if not, write to the Free Software
-Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
 #include "obstack.h"
@@ -33,7 +33,7 @@ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
 #include "ch-lang.h"
 #include "typeprint.h"
 
-#include <string.h>
+#include "gdb_string.h"
 #include <errno.h>
 
 static void
@@ -99,10 +99,14 @@ chill_type_print_base (type, stream, show, level)
       return;
     }
 
-  check_stub_type (type);
+  if (TYPE_CODE (type) != TYPE_CODE_TYPEDEF)
+    CHECK_TYPEDEF (type);
 
   switch (TYPE_CODE (type))
     {
+      case TYPE_CODE_TYPEDEF:
+        chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
+       break;
       case TYPE_CODE_PTR:
        if (TYPE_CODE (TYPE_TARGET_TYPE (type)) == TYPE_CODE_VOID)
          {
@@ -111,7 +115,7 @@ chill_type_print_base (type, stream, show, level)
            break;
          }
        fprintf_filtered (stream, "REF ");
-       chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+       chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
        break;
 
       case TYPE_CODE_BOOL:
@@ -124,16 +128,21 @@ chill_type_print_base (type, stream, show, level)
        break;
 
       case TYPE_CODE_ARRAY:
-       range_type = TYPE_FIELD_TYPE (type, 0);
-       index_type = TYPE_TARGET_TYPE (range_type);
-       low_bound = TYPE_FIELD_BITPOS (range_type, 0);
-       high_bound = TYPE_FIELD_BITPOS (range_type, 1);
         fputs_filtered ("ARRAY (", stream);
-       print_type_scalar (index_type, low_bound, stream);
-       fputs_filtered (":", stream);
-       print_type_scalar (index_type, high_bound, stream);
+       range_type = TYPE_FIELD_TYPE (type, 0);
+       if (TYPE_CODE (range_type) != TYPE_CODE_RANGE)
+         chill_print_type (range_type, "", stream, 0, level);
+       else
+         {
+           index_type = TYPE_TARGET_TYPE (range_type);
+           low_bound = TYPE_FIELD_BITPOS (range_type, 0);
+           high_bound = TYPE_FIELD_BITPOS (range_type, 1);
+           print_type_scalar (index_type, low_bound, stream);
+           fputs_filtered (":", stream);
+           print_type_scalar (index_type, high_bound, stream);
+         }
        fputs_filtered (") ", stream);
-       chill_print_type (TYPE_TARGET_TYPE (type), "", stream, show, level);
+       chill_print_type (TYPE_TARGET_TYPE (type), "", stream, 0, level);
        break;
 
       case TYPE_CODE_BITSTRING:
@@ -158,7 +167,7 @@ chill_type_print_base (type, stream, show, level)
 
       case TYPE_CODE_MEMBER:
        fprintf_filtered (stream, "MEMBER ");
-        chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+        chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
        break;
       case TYPE_CODE_REF:
        fprintf_filtered (stream, "/*LOC*/ ");
@@ -178,7 +187,7 @@ chill_type_print_base (type, stream, show, level)
            if (TYPE_CODE (param_type) == TYPE_CODE_REF)
              {
                chill_type_print_base (TYPE_TARGET_TYPE (param_type),
-                                      stream, show, level);
+                                      stream, 0, level);
                fputs_filtered (" LOC", stream);
              }
            else
@@ -188,7 +197,7 @@ chill_type_print_base (type, stream, show, level)
        if (TYPE_CODE (TYPE_TARGET_TYPE (type)) != TYPE_CODE_VOID)
          {
            fputs_filtered (" RETURNS (", stream);
-           chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
+           chill_type_print_base (TYPE_TARGET_TYPE (type), stream, 0, level);
            fputs_filtered (")", stream);
          }
        break;
@@ -197,7 +206,7 @@ chill_type_print_base (type, stream, show, level)
        if (chill_varying_type (type))
          {
            chill_type_print_base (TYPE_FIELD_TYPE (type, 1),
-                                  stream, show, level);
+                                  stream, 0, level);
            fputs_filtered (" VARYING", stream);
          }
        else
@@ -251,7 +260,8 @@ chill_type_print_base (type, stream, show, level)
                                fputs_filtered ("\n", stream);
                              }
                          }
-                       fputs_filtered ("ESAC\n", stream);
+                       print_spaces_filtered (level + 4, stream);
+                       fputs_filtered ("ESAC", stream);
                      }
                    else
                      chill_print_type (field_type,
@@ -269,9 +279,6 @@ chill_type_print_base (type, stream, show, level)
        break;
 
       case TYPE_CODE_RANGE:
-       if (TYPE_DUMMY_RANGE (type) > 0)
-         chill_type_print_base (TYPE_TARGET_TYPE (type), stream, show, level);
-       else
          {
            struct type *target = TYPE_TARGET_TYPE (type);
            if (target && TYPE_NAME (target))
This page took 0.02596 seconds and 4 git commands to generate.