Hi Jason.
Is there a reason we pass a collapsible option to add_subscript_info?
It seems like it's value is always !is_ada(). Can we just get rid of
the argument, and calculate its value within the function, or was it
there for some future flexibility?
I'd like to queue this patch for GCC 6, if it's ok with you. It can
live in the debug-early work if you approve.
Aldy
commit eb0b7b1e769d3ea17cf4663d9fc1cb90fb406e59
Author: Aldy Hernandez <al...@redhat.com>
Date: Thu Mar 26 09:03:51 2015 -0700
Remove redundant argument to add_subscript_info.
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 1928846..b771fd9 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -3257,7 +3257,7 @@ static void add_scalar_info (dw_die_ref, enum
dwarf_attribute, tree, int,
const struct loc_descr_context *);
static void add_bound_info (dw_die_ref, enum dwarf_attribute, tree,
const struct loc_descr_context *);
-static void add_subscript_info (dw_die_ref, tree, bool);
+static void add_subscript_info (dw_die_ref, tree);
static void add_byte_size_attribute (dw_die_ref, tree);
static void add_bit_offset_attribute (dw_die_ref, tree);
static void add_bit_size_attribute (dw_die_ref, tree);
@@ -16920,16 +16920,18 @@ add_bound_info (dw_die_ref subrange_die, enum
dwarf_attribute bound_attr,
}
/* Add subscript info to TYPE_DIE, describing an array TYPE, collapsing
- possibly nested array subscripts in a flat sequence if COLLAPSE_P is true.
- Note that the block of subscript information for an array type also
- includes information about the element type of the given array type.
+ possibly nested array subscripts in a flat sequence for non-Ada
+ languages. Note that the block of subscript information for an
+ array type also includes information about the element type of the
+ given array type.
This function reuses previously set type and bound information if
available. */
static void
-add_subscript_info (dw_die_ref type_die, tree type, bool collapse_p)
+add_subscript_info (dw_die_ref type_die, tree type)
{
+ bool collapse_p = !is_ada ();
unsigned dimension_number;
tree lower, upper;
dw_die_ref child = type_die->die_child;
@@ -17637,7 +17639,7 @@ fill_variable_array_bounds (tree type)
dw_die_ref array_die = lookup_type_die (type);
if (!array_die)
return false;
- add_subscript_info (array_die, type, !is_ada ());
+ add_subscript_info (array_die, type);
return true;
}
return false;
@@ -17652,18 +17654,6 @@ gen_array_type_die (tree type, dw_die_ref context_die)
{
dw_die_ref array_die;
- /* GNU compilers represent multidimensional array types as sequences of one
- dimensional array types whose element types are themselves array types.
- We sometimes squish that down to a single array_type DIE with multiple
- subscripts in the Dwarf debugging info. The draft Dwarf specification
- say that we are allowed to do this kind of compression in C, because
- there is no difference between an array of arrays and a multidimensional
- array. We don't do this for Ada to remain as close as possible to the
- actual representation, which is especially important against the language
- flexibilty wrt arrays of variable size. */
-
- bool collapse_nested_arrays = !is_ada ();
-
if (fill_variable_array_bounds (type))
return;
@@ -17737,7 +17727,18 @@ gen_array_type_die (tree type, dw_die_ref context_die)
size_int (TYPE_VECTOR_SUBPARTS (type) - 1), NULL);
}
else
- add_subscript_info (array_die, type, collapse_nested_arrays);
+ add_subscript_info (array_die, type);
+
+ /* GNU compilers represent multidimensional array types as sequences of one
+ dimensional array types whose element types are themselves array types.
+ We sometimes squish that down to a single array_type DIE with multiple
+ subscripts in the Dwarf debugging info. The draft Dwarf specification
+ say that we are allowed to do this kind of compression in C, because
+ there is no difference between an array of arrays and a multidimensional
+ array. We don't do this for Ada to remain as close as possible to the
+ actual representation, which is especially important against the language
+ flexibilty wrt arrays of variable size. */
+ bool collapse_nested_arrays = !is_ada ();
/* Add representation of the type of the elements of this array type and
emit the corresponding DIE if we haven't done it already. */