summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-14 22:06:07 +0000
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>2003-04-14 22:06:07 +0000
commit0989224fdf636077ab2db1f9e28265eefdfecfcf (patch)
treeead26b5a5f141b19830e8affa8f24cc6b2541519 /gcc
parentddb425f34207d6efd0425a9bfc5a9340c7d73931 (diff)
downloadgcc-0989224fdf636077ab2db1f9e28265eefdfecfcf.tar.gz
* 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@65599 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/dbxout.c70
2 files changed, 50 insertions, 26 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 41451aa9c4a..b7c46908861 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -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.
diff --git a/gcc/dbxout.c b/gcc/dbxout.c
index e3af08cf24a..dc898290e8e 100644
--- a/gcc/dbxout.c
+++ b/gcc/dbxout.c
@@ -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. */