This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
[rfc] Remove dead fall-back code from Pascal / Modula-2
- From: "Ulrich Weigand" <uweigand at de dot ibm dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 26 Jun 2009 17:55:18 +0200 (CEST)
- Subject: [rfc] Remove dead fall-back code from Pascal / Modula-2
Hello,
this patch eliminates some dead code from Pascal and Modula-2 code. Both
attempt to verify that the TYPE_TARGET_TYPE of a TYPE_CODE_RANGE type
is non-NULL and use builtin_type_int32 as fallback if it is.
But this can never happen today. The symbol readers will *always* set a
TYPE_TARGET_TYPE for every range type they create; if necessary, *they*
will use a default integer type as fallback already. Range types
created outside of the symbol readers will have a non-NULL target type
anyway.
Tested on amd64-linux.
Bye,
Ulrich
ChangeLog:
* m2-typeprint.c (m2_print_bounds, m2_is_long_set_of_type): Remove
redundant check for NULL TYPE_TARGET_TYPE.
* m2-valprint.c (m2_print_long_set): Likewise.
* p-valprint.c (pascal_type_print_base): Likewise.
Index: gdb-head/gdb/m2-typeprint.c
===================================================================
--- gdb-head.orig/gdb/m2-typeprint.c
+++ gdb-head/gdb/m2-typeprint.c
@@ -307,9 +307,6 @@ m2_print_bounds (struct type *type,
{
struct type *target = TYPE_TARGET_TYPE (type);
- if (target == NULL)
- target = builtin_type_int32;
-
if (TYPE_NFIELDS(type) == 0)
return;
@@ -414,8 +411,6 @@ m2_is_long_set_of_type (struct type *typ
return 0;
range = TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i));
target = TYPE_TARGET_TYPE (range);
- if (target == NULL)
- target = builtin_type_int32;
l1 = TYPE_LOW_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, i)));
h1 = TYPE_HIGH_BOUND (TYPE_INDEX_TYPE (TYPE_FIELD_TYPE (type, len-1)));
Index: gdb-head/gdb/m2-valprint.c
===================================================================
--- gdb-head.orig/gdb/m2-valprint.c
+++ gdb-head/gdb/m2-valprint.c
@@ -119,8 +119,6 @@ m2_print_long_set (struct type *type, co
}
target = TYPE_TARGET_TYPE (range);
- if (target == NULL)
- target = builtin_type_int32;
if (get_discrete_bounds (range, &field_low, &field_high) >= 0)
{
@@ -165,8 +163,6 @@ m2_print_long_set (struct type *type, co
if (get_discrete_bounds (range, &field_low, &field_high) < 0)
break;
target = TYPE_TARGET_TYPE (range);
- if (target == NULL)
- target = builtin_type_int32;
}
}
if (element_seen)
Index: gdb-head/gdb/p-typeprint.c
===================================================================
--- gdb-head.orig/gdb/p-typeprint.c
+++ gdb-head/gdb/p-typeprint.c
@@ -768,8 +768,6 @@ pascal_type_print_base (struct type *typ
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);
--
Dr. Ulrich Weigand
GNU Toolchain for Linux on System z and Cell BE
Ulrich.Weigand@de.ibm.com