aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gdb/ChangeLog13
-rw-r--r--gdb/ada-lex.l18
-rw-r--r--gdb/c-exp.y2
-rw-r--r--gdb/doublest.h11
-rw-r--r--gdb/jv-exp.y2
-rw-r--r--gdb/objc-exp.y2
-rw-r--r--gdb/p-exp.y2
7 files changed, 26 insertions, 24 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 2080adb..1d5c6a1 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,18 @@
2006-02-23 Daniel Jacobowitz <dan@codesourcery.com>
+ * doublest.h: Conditionalize DOUBLEST on PRINTF_HAS_LONG_DOUBLE
+ also.
+ (DOUBLEST_FORMAT): Rename to DOUBLEST_PRINT_FORMAT.
+ (DOUBLEST_SCAN_FORMAT): New.
+ * ada-lex.l (PRINTF_HAS_LONG_DOUBLE): Remove redefinitions.
+ (processReal): Use DOUBLEST_SCAN_FORMAT.
+ * c-exp.y (parse_number): Likewise.
+ * jv-exp.y (parse_number): Likewise.
+ * objc-exp.y (parse_number): Likewise.
+ * p-exp.y (parse_number): Likewise.
+
+2006-02-23 Daniel Jacobowitz <dan@codesourcery.com>
+
* event-top.c (async_do_nothing, async_disconnect)
(async_stop_sig, async_float_handler): Remove duplicated
prototypes.
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 156e0b8..b25264c 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -432,26 +432,10 @@ processInt (const char *base0, const char *num0, const char *exp0)
return INT;
}
-#if defined (PRINTF_HAS_LONG_DOUBLE)
-# undef PRINTF_HAS_LONG_DOUBLE
-# define PRINTF_HAS_LONG_DOUBLE 1
-#else
-# define PRINTF_HAS_LONG_DOUBLE 0
-#endif
-
static int
processReal (const char *num0)
{
-#if defined (PRINTF_HAS_LONG_DOUBLE)
- if (sizeof (DOUBLEST) > sizeof (double))
- sscanf (num0, "%Lg", &yylval.typed_val_float.dval);
- else
-#endif
- {
- double temp;
- sscanf (num0, "%lg", &temp);
- yylval.typed_val_float.dval = temp;
- }
+ sscanf (num0, DOUBLEST_SCAN_FORMAT, &yylval.typed_val_float.dval);
yylval.typed_val_float.type = type_float ();
if (sizeof(DOUBLEST) >= TARGET_DOUBLE_BIT / TARGET_CHAR_BIT)
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index e197227..1955fc0 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1080,7 +1080,7 @@ parse_number (p, len, parsed_float, putithere)
char saved_char = p[len];
p[len] = 0; /* null-terminate the token */
- num = sscanf (p, DOUBLEST_FORMAT "%s",
+ num = sscanf (p, DOUBLEST_SCAN_FORMAT "%s",
&putithere->typed_val_float.dval, s);
p[len] = saved_char; /* restore the input stream */
diff --git a/gdb/doublest.h b/gdb/doublest.h
index a035b7d..1ebefd8 100644
--- a/gdb/doublest.h
+++ b/gdb/doublest.h
@@ -48,15 +48,20 @@ struct floatformat;
host's `long double'. In general, we'll probably reduce the precision of
any such values and print a warning. */
-#if defined HAVE_LONG_DOUBLE && defined SCANF_HAS_LONG_DOUBLE
+#if (defined HAVE_LONG_DOUBLE && defined PRINTF_HAS_LONG_DOUBLE \
+ && defined SCANF_HAS_LONG_DOUBLE)
typedef long double DOUBLEST;
-# define DOUBLEST_FORMAT "%Lg"
+# define DOUBLEST_PRINT_FORMAT "%Lg"
+# define DOUBLEST_SCAN_FORMAT "%Lg"
#else
typedef double DOUBLEST;
-# define DOUBLEST_FORMAT "%g"
+# define DOUBLEST_PRINT_FORMAT "%g"
+# define DOUBLEST_SCAN_FORMAT "%lg"
/* If we can't scan or print long double, we don't want to use it
anywhere. */
# undef HAVE_LONG_DOUBLE
+# undef PRINTF_HAS_LONG_DOUBLE
+# undef SCANF_HAS_LONG_DOUBLE
#endif
extern void floatformat_to_doublest (const struct floatformat *,
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
index 70f94ca..8017372 100644
--- a/gdb/jv-exp.y
+++ b/gdb/jv-exp.y
@@ -713,7 +713,7 @@ parse_number (p, len, parsed_float, putithere)
char saved_char = p[len];
p[len] = 0; /* null-terminate the token */
- num = sscanf (p, DOUBLEST_FORMAT "%c",
+ num = sscanf (p, DOUBLEST_SCAN_FORMAT "%c",
&putithere->typed_val_float.dval, &c);
p[len] = saved_char; /* restore the input stream */
if (num != 1) /* check scanf found ONLY a float ... */
diff --git a/gdb/objc-exp.y b/gdb/objc-exp.y
index 52ae8c2..7b0ca39 100644
--- a/gdb/objc-exp.y
+++ b/gdb/objc-exp.y
@@ -1025,7 +1025,7 @@ parse_number (p, len, parsed_float, putithere)
/* It's a float since it contains a point or an exponent. */
- sscanf (p, DOUBLEST_FORMAT "%c",
+ sscanf (p, DOUBLEST_SCAN_FORMAT "%c",
&putithere->typed_val_float.dval, &c);
/* See if it has `f' or `l' suffix (float or long double). */
diff --git a/gdb/p-exp.y b/gdb/p-exp.y
index 08853d5..e095a35 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -799,7 +799,7 @@ parse_number (p, len, parsed_float, putithere)
char saved_char = p[len];
p[len] = 0; /* null-terminate the token */
- num = sscanf (p, DOUBLEST_FORMAT "%c",
+ num = sscanf (p, DOUBLEST_SCAN_FORMAT "%c",
&putithere->typed_val_float.dval, &c);
p[len] = saved_char; /* restore the input stream */
if (num != 1) /* check scanf found ONLY a float ... */