aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThiago Jung Bauermann <bauerman@br.ibm.com>2008-01-09 19:27:15 +0000
committerThiago Jung Bauermann <bauerman@br.ibm.com>2008-01-09 19:27:15 +0000
commit689e4e2d8a2fd0d55acc62c746fdcc302f851995 (patch)
treef444c80441738f50b041e6c996813da97f44278a
parent7ddd14deffa8d2579c691bb8f19585fb2e7b5de3 (diff)
downloadgdb-689e4e2d8a2fd0d55acc62c746fdcc302f851995.zip
gdb-689e4e2d8a2fd0d55acc62c746fdcc302f851995.tar.gz
gdb-689e4e2d8a2fd0d55acc62c746fdcc302f851995.tar.bz2
* doublest.h (DOUBLEST_PRINT_FORMAT): Remove % from string.
(DOUBLEST_SCAN_FORMAT): Likewise. * dfp.c (decimal_from_floating): Use DOUBLEST_PRINT_FORMAT. * ada-lex.l (processReal): Prepend "%" to use of 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.
-rw-r--r--gdb/ChangeLog11
-rw-r--r--gdb/ada-lex.l2
-rw-r--r--gdb/c-exp.y2
-rw-r--r--gdb/dfp.c3
-rw-r--r--gdb/doublest.h8
-rw-r--r--gdb/jv-exp.y2
-rw-r--r--gdb/objc-exp.y2
-rw-r--r--gdb/p-exp.y2
8 files changed, 22 insertions, 10 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 8caa93a..efac94e 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,14 @@
+2008-01-09 Thiago Jung Bauermann <bauerman@br.ibm.com>
+
+ * doublest.h (DOUBLEST_PRINT_FORMAT): Remove % from string.
+ (DOUBLEST_SCAN_FORMAT): Likewise.
+ * dfp.c (decimal_from_floating): Use DOUBLEST_PRINT_FORMAT.
+ * ada-lex.l (processReal): Prepend "%" to use of 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.
+
2008-01-09 Joel Brobecker <brobecker@adacore.com>
* gdbtypes.c (create_array_type): Add handling of null Ada arrays.
diff --git a/gdb/ada-lex.l b/gdb/ada-lex.l
index 6be64ab..cd6de8c 100644
--- a/gdb/ada-lex.l
+++ b/gdb/ada-lex.l
@@ -373,7 +373,7 @@ processInt (const char *base0, const char *num0, const char *exp0)
static int
processReal (const char *num0)
{
- sscanf (num0, DOUBLEST_SCAN_FORMAT, &yylval.typed_val_float.dval);
+ sscanf (num0, "%" DOUBLEST_SCAN_FORMAT, &yylval.typed_val_float.dval);
yylval.typed_val_float.type = type_float ();
if (sizeof(DOUBLEST) >= gdbarch_double_bit (current_gdbarch)
diff --git a/gdb/c-exp.y b/gdb/c-exp.y
index 22bb4c6..b520721 100644
--- a/gdb/c-exp.y
+++ b/gdb/c-exp.y
@@ -1125,7 +1125,7 @@ parse_number (p, len, parsed_float, putithere)
return (DECFLOAT);
}
- num = sscanf (p, DOUBLEST_SCAN_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/dfp.c b/gdb/dfp.c
index bf82114..e184ecd 100644
--- a/gdb/dfp.c
+++ b/gdb/dfp.c
@@ -237,7 +237,8 @@ decimal_from_floating (struct value *from, gdb_byte *to, int len)
char *buffer;
int ret;
- ret = asprintf (&buffer, "%.30Lg", value_as_double (from));
+ ret = asprintf (&buffer, "%.30" DOUBLEST_PRINT_FORMAT,
+ value_as_double (from));
if (ret < 0)
error (_("Error in memory allocation for conversion to decimal float."));
diff --git a/gdb/doublest.h b/gdb/doublest.h
index f3ab619..247eb5d 100644
--- a/gdb/doublest.h
+++ b/gdb/doublest.h
@@ -49,12 +49,12 @@ struct floatformat;
#if (defined HAVE_LONG_DOUBLE && defined PRINTF_HAS_LONG_DOUBLE \
&& defined SCANF_HAS_LONG_DOUBLE)
typedef long double DOUBLEST;
-# define DOUBLEST_PRINT_FORMAT "%Lg"
-# define DOUBLEST_SCAN_FORMAT "%Lg"
+# define DOUBLEST_PRINT_FORMAT "Lg"
+# define DOUBLEST_SCAN_FORMAT "Lg"
#else
typedef double DOUBLEST;
-# define DOUBLEST_PRINT_FORMAT "%g"
-# define DOUBLEST_SCAN_FORMAT "%lg"
+# 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
diff --git a/gdb/jv-exp.y b/gdb/jv-exp.y
index 1db33a6..14a7bf8 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_SCAN_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 d421441..a4a42d9 100644
--- a/gdb/objc-exp.y
+++ b/gdb/objc-exp.y
@@ -1023,7 +1023,7 @@ parse_number (p, len, parsed_float, putithere)
/* It's a float since it contains a point or an exponent. */
- sscanf (p, DOUBLEST_SCAN_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 857a69f..9cab7cd 100644
--- a/gdb/p-exp.y
+++ b/gdb/p-exp.y
@@ -797,7 +797,7 @@ parse_number (p, len, parsed_float, putithere)
char saved_char = p[len];
p[len] = 0; /* null-terminate the token */
- num = sscanf (p, DOUBLEST_SCAN_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 ... */