diff options
author | Joel Brobecker <brobecker@gnat.com> | 2009-03-13 01:28:05 +0000 |
---|---|---|
committer | Joel Brobecker <brobecker@gnat.com> | 2009-03-13 01:28:05 +0000 |
commit | facc390f025eafceabfe087e0fb241a8f2d90e32 (patch) | |
tree | de296964bd1e4dcbb4a647d948b435a46ba43866 | |
parent | 5c20fa2ae3f71e8fbbfe8aac31bb4a3f5a7449ea (diff) | |
download | gdb-facc390f025eafceabfe087e0fb241a8f2d90e32.zip gdb-facc390f025eafceabfe087e0fb241a8f2d90e32.tar.gz gdb-facc390f025eafceabfe087e0fb241a8f2d90e32.tar.bz2 |
* ada-lang.c (ada_delta): Change the type of numerators and
denominators to DOUBLEST, as they may not fit into a long.
(scaling_factor): Ditto.
-rw-r--r-- | gdb/ChangeLog | 6 | ||||
-rw-r--r-- | gdb/ada-lang.c | 24 |
2 files changed, 23 insertions, 7 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index a8621f9..985f46d 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2009-03-12 Jerome Guitton <guitton@adacore.com> + * ada-lang.c (ada_delta): Change the type of numerators and + denominators to DOUBLEST, as they may not fit into a long. + (scaling_factor): Ditto. + +2009-03-12 Jerome Guitton <guitton@adacore.com> + * language.c (lang_bool_type): Set lai->bool_type_symbol to NULL. 2009-03-12 Joel Brobecker <brobecker@adacore.com> diff --git a/gdb/ada-lang.c b/gdb/ada-lang.c index 0ec724f..aa5dece 100644 --- a/gdb/ada-lang.c +++ b/gdb/ada-lang.c @@ -9296,12 +9296,16 @@ DOUBLEST ada_delta (struct type *type) { const char *encoding = fixed_type_info (type); - long num, den; + DOUBLEST num, den; - if (sscanf (encoding, "_%ld_%ld", &num, &den) < 2) + /* Strictly speaking, num and den are encoded as integer. However, + they may not fit into a long, and they will have to be converted + to DOUBLEST anyway. So scan them as DOUBLEST. */ + if (sscanf (encoding, "_%" DOUBLEST_SCAN_FORMAT "_%" DOUBLEST_SCAN_FORMAT, + &num, &den) < 2) return -1.0; else - return (DOUBLEST) num / (DOUBLEST) den; + return num / den; } /* Assuming that ada_is_fixed_point_type (TYPE), return the scaling @@ -9311,17 +9315,23 @@ static DOUBLEST scaling_factor (struct type *type) { const char *encoding = fixed_type_info (type); - unsigned long num0, den0, num1, den1; + DOUBLEST num0, den0, num1, den1; int n; - n = sscanf (encoding, "_%lu_%lu_%lu_%lu", &num0, &den0, &num1, &den1); + /* Strictly speaking, num's and den's are encoded as integer. However, + they may not fit into a long, and they will have to be converted + to DOUBLEST anyway. So scan them as DOUBLEST. */ + n = sscanf (encoding, + "_%" DOUBLEST_SCAN_FORMAT "_%" DOUBLEST_SCAN_FORMAT + "_%" DOUBLEST_SCAN_FORMAT "_%" DOUBLEST_SCAN_FORMAT, + &num0, &den0, &num1, &den1); if (n < 2) return 1.0; else if (n == 4) - return (DOUBLEST) num1 / (DOUBLEST) den1; + return num1 / den1; else - return (DOUBLEST) num0 / (DOUBLEST) den0; + return num0 / den0; } |