* dbxout.c (print_int_cst_bounds_in_octal_p): New function,
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 14 Apr 2003 22:06:07 +0000 (22:06 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 14 Apr 2003 22:06:07 +0000 (22:06 +0000)
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

gcc/ChangeLog
gcc/dbxout.c

index 41451aa..b7c4690 100644 (file)
 
 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.
 
index e3af08c..dc89829 100644 (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.  */