diff options
author | Joel Brobecker <brobecker@gnat.com> | 2003-04-14 22:06:07 +0000 |
---|---|---|
committer | Richard Kenner <kenner@gcc.gnu.org> | 2003-04-14 18:06:07 -0400 |
commit | 39d658e3950054b6f18727d907a047a4dd6c10d4 (patch) | |
tree | ead26b5a5f141b19830e8affa8f24cc6b2541519 /gcc/dbxout.c | |
parent | 4694840a01cc4b82378fdfbbf7d7d8a5c7426b54 (diff) | |
download | gcc-39d658e3950054b6f18727d907a047a4dd6c10d4.zip gcc-39d658e3950054b6f18727d907a047a4dd6c10d4.tar.gz gcc-39d658e3950054b6f18727d907a047a4dd6c10d4.tar.bz2 |
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
Diffstat (limited to 'gcc/dbxout.c')
-rw-r--r-- | gcc/dbxout.c | 70 |
1 files changed, 44 insertions, 26 deletions
diff --git a/gcc/dbxout.c b/gcc/dbxout.c index e3af08c..dc89829 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. */ |