dbxout.c (print_int_cst_bounds_in_octal_p): New function, extracted from dbxout_type.

* dbxout.c (print_int_cst_bounds_in_octal_p): New function,
	extracted from dbxout_type.
	(dbxout_range_type): print large bounds in octal format.
	(dbxout_type): Replace extracted code by call to
	print_int_cst_bounds_in_octal_p.

From-SVN: r65599
This commit is contained in:
Joel Brobecker 2003-04-14 22:06:07 +00:00 committed by Richard Kenner
parent 4694840a01
commit 39d658e395
2 changed files with 50 additions and 26 deletions

View File

@ -12,6 +12,12 @@
2003-04-14 Joel Brobecker <brobecker@gnat.com>
* dbxout.c (print_int_cst_bounds_in_octal_p): New function,
extracted from dbxout_type.
(dbxout_range_type): print large bounds in octal format.
(dbxout_type): Replace extracted code by call to
print_int_cst_bounds_in_octal_p.
* dwarf2out.c (gen_compile_unit_die): Emit DW_LANG_Ada95 instead
of DW_LANG_Ada83 for Ada units.

View File

@ -310,6 +310,7 @@ static void dbxout_type_method_1 PARAMS ((tree, const char *));
static void dbxout_type_methods PARAMS ((tree));
static void dbxout_range_type PARAMS ((tree));
static void dbxout_type PARAMS ((tree, int));
static bool print_int_cst_bounds_in_octal_p PARAMS ((tree));
static void print_int_cst_octal PARAMS ((tree));
static void print_octal PARAMS ((unsigned HOST_WIDE_INT, int));
static void print_wide_int PARAMS ((HOST_WIDE_INT));
@ -1098,7 +1099,10 @@ dbxout_range_type (type)
{
putc (';', asmfile);
CHARS (1);
print_wide_int (tree_low_cst (TYPE_MIN_VALUE (type), 0));
if (print_int_cst_bounds_in_octal_p (type))
print_int_cst_octal (TYPE_MIN_VALUE (type));
else
print_wide_int (tree_low_cst (TYPE_MIN_VALUE (type), 0));
}
else
{
@ -1111,7 +1115,10 @@ dbxout_range_type (type)
{
putc (';', asmfile);
CHARS (1);
print_wide_int (tree_low_cst (TYPE_MAX_VALUE (type), 0));
if (print_int_cst_bounds_in_octal_p (type))
print_int_cst_octal (TYPE_MAX_VALUE (type));
else
print_wide_int (tree_low_cst (TYPE_MAX_VALUE (type), 0));
putc (';', asmfile);
CHARS (1);
}
@ -1345,30 +1352,7 @@ dbxout_type (type, full)
CHARS (5);
}
/* If we can use GDB extensions and the size is wider than a
long (the size used by GDB to read them) or we may have
trouble writing the bounds the usual way, write them in
octal. Note the test is for the *target's* size of "long",
not that of the host. The host test is just to make sure we
can write it out in case the host wide int is narrower than the
target "long". */
/* For unsigned types, we use octal if they are the same size or
larger. This is because we print the bounds as signed decimal,
and hence they can't span same size unsigned types. */
if (use_gnu_debug_info_extensions
&& TYPE_MIN_VALUE (type) != 0
&& TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST
&& TYPE_MAX_VALUE (type) != 0
&& TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST
&& (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node)
|| ((TYPE_PRECISION (type)
== TYPE_PRECISION (integer_type_node))
&& TREE_UNSIGNED (type))
|| TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT
|| (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT
&& TREE_UNSIGNED (type))))
if (print_int_cst_bounds_in_octal_p (type))
{
fprintf (asmfile, "r");
CHARS (1);
@ -1833,6 +1817,40 @@ dbxout_type (type, full)
}
}
/* Return non-zero if the given type represents an integer whose bounds
should be printed in octal format. */
static bool
print_int_cst_bounds_in_octal_p (type)
tree type;
{
/* If we can use GDB extensions and the size is wider than a long
(the size used by GDB to read them) or we may have trouble writing
the bounds the usual way, write them in octal. Note the test is for
the *target's* size of "long", not that of the host. The host test
is just to make sure we can write it out in case the host wide int
is narrower than the target "long".
For unsigned types, we use octal if they are the same size or larger.
This is because we print the bounds as signed decimal, and hence they
can't span same size unsigned types. */
if (use_gnu_debug_info_extensions
&& TYPE_MIN_VALUE (type) != 0
&& TREE_CODE (TYPE_MIN_VALUE (type)) == INTEGER_CST
&& TYPE_MAX_VALUE (type) != 0
&& TREE_CODE (TYPE_MAX_VALUE (type)) == INTEGER_CST
&& (TYPE_PRECISION (type) > TYPE_PRECISION (integer_type_node)
|| ((TYPE_PRECISION (type) == TYPE_PRECISION (integer_type_node))
&& TREE_UNSIGNED (type))
|| TYPE_PRECISION (type) > HOST_BITS_PER_WIDE_INT
|| (TYPE_PRECISION (type) == HOST_BITS_PER_WIDE_INT
&& TREE_UNSIGNED (type))))
return TRUE;
else
return FALSE;
}
/* Print the value of integer constant C, in octal,
handling double precision. */