2012-12-11 Pedro Alves <pedro@codesourcery.com>
[binutils-gdb.git] / gdb / printcmd.c
index 9e8cd659cad25071ba9499a7bba2353649227a94..25b14e1ccb86a877092e2da46ba1c590d45c37b5 100644 (file)
@@ -145,7 +145,7 @@ struct display
     struct program_space *pspace;
 
     /* Innermost block required by this expression when evaluated.  */
-    struct block *block;
+    const struct block *block;
 
     /* Status of this display (enabled or disabled).  */
     int enabled_p;
@@ -346,13 +346,12 @@ float_type_from_length (struct type *type)
 {
   struct gdbarch *gdbarch = get_type_arch (type);
   const struct builtin_type *builtin = builtin_type (gdbarch);
-  unsigned int len = TYPE_LENGTH (type);
 
-  if (len == TYPE_LENGTH (builtin->builtin_float))
+  if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_float))
     type = builtin->builtin_float;
-  else if (len == TYPE_LENGTH (builtin->builtin_double))
+  else if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_double))
     type = builtin->builtin_double;
-  else if (len == TYPE_LENGTH (builtin->builtin_long_double))
+  else if (TYPE_LENGTH (type) == TYPE_LENGTH (builtin->builtin_long_double))
     type = builtin->builtin_long_double;
 
   return type;
@@ -2222,7 +2221,7 @@ ui_printf (char *arg, struct ui_file *stream)
            error (_("long double not supported in printf"));
 #endif
          case long_long_arg:
-#if defined (CC_HAS_LONG_LONG) && defined (PRINTF_HAS_LONG_LONG)
+#ifdef PRINTF_HAS_LONG_LONG
            {
              long long val = value_as_long (val_args[i]);
 
@@ -2267,7 +2266,6 @@ ui_printf (char *arg, struct ui_file *stream)
 
              /* Parameter data.  */
              struct type *param_type = value_type (val_args[i]);
-             unsigned int param_len = TYPE_LENGTH (param_type);
              struct gdbarch *gdbarch = get_type_arch (param_type);
              enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
 
@@ -2329,8 +2327,8 @@ ui_printf (char *arg, struct ui_file *stream)
 
              /* Conversion between different DFP types.  */
              if (TYPE_CODE (param_type) == TYPE_CODE_DECFLOAT)
-               decimal_convert (param_ptr, param_len, byte_order,
-                                dec, dfp_len, byte_order);
+               decimal_convert (param_ptr, TYPE_LENGTH (param_type),
+                                byte_order, dec, dfp_len, byte_order);
              else
                /* If this is a non-trivial conversion, just output 0.
                   A correct converted value can be displayed by explicitly
@@ -2358,7 +2356,7 @@ ui_printf (char *arg, struct ui_file *stream)
                 handle %p as glibc would: %#x or a literal "(nil)".  */
 
              char *p, *fmt, *fmt_p;
-#if defined (CC_HAS_LONG_LONG) && defined (PRINTF_HAS_LONG_LONG)
+#ifdef PRINTF_HAS_LONG_LONG
              long long val = value_as_long (val_args[i]);
 #else
              long val = value_as_long (val_args[i]);
@@ -2393,7 +2391,7 @@ ui_printf (char *arg, struct ui_file *stream)
              gdb_assert (*p == 'p' && *(p + 1) == '\0');
              if (val != 0)
                {
-#if defined (CC_HAS_LONG_LONG) && defined (PRINTF_HAS_LONG_LONG)
+#ifdef PRINTF_HAS_LONG_LONG
                  *fmt_p++ = 'l';
 #endif
                  *fmt_p++ = 'l';