aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2012-04-01 04:23:40 +0000
committerMike Frysinger <vapier@gentoo.org>2012-04-01 04:23:40 +0000
commit2fa7a0570bc9a5dc033457ce1769a90db0d3c990 (patch)
treece4e72dbed50f6bbedc002f5d03d26fcd4eb4d7e
parent02bb38cc809b286293a8227b86a64b09420754c0 (diff)
downloadgdb-2fa7a0570bc9a5dc033457ce1769a90db0d3c990.zip
gdb-2fa7a0570bc9a5dc033457ce1769a90db0d3c990.tar.gz
gdb-2fa7a0570bc9a5dc033457ce1769a90db0d3c990.tar.bz2
sim: bfin: simplify field width processing and fix build warnings
This fix the build time warning: warning: format not a string literal, argument types not checked [-Wformat-nonliteral] Signed-off-by: Mike Frysinger <vapier@gentoo.org>
-rw-r--r--sim/bfin/ChangeLog5
-rw-r--r--sim/bfin/bfin-sim.c11
2 files changed, 6 insertions, 10 deletions
diff --git a/sim/bfin/ChangeLog b/sim/bfin/ChangeLog
index 70d9275..899d0ca 100644
--- a/sim/bfin/ChangeLog
+++ b/sim/bfin/ChangeLog
@@ -1,5 +1,10 @@
2012-04-01 Mike Frysinger <vapier@gentoo.org>
+ * bfin-dis.c (fmtconst): Replace decimal handling with a single
+ sprintf call and the '*' field width.
+
+2012-04-01 Mike Frysinger <vapier@gentoo.org>
+
* machs.c (bfin_model_map_bfrom): Return when mnum is 535.
2012-04-01 Mike Frysinger <vapier@gentoo.org>
diff --git a/sim/bfin/bfin-sim.c b/sim/bfin/bfin-sim.c
index 2c93e04..54d6bca 100644
--- a/sim/bfin/bfin-sim.c
+++ b/sim/bfin/bfin-sim.c
@@ -223,16 +223,7 @@ fmtconst_str (const_forms_t cf, bs32 x, bu32 pc)
x <<= constant_formats[cf].scale;
if (constant_formats[cf].decimal)
- {
- if (constant_formats[cf].leading)
- {
- char ps[10];
- sprintf (ps, "%%%ii", constant_formats[cf].leading);
- sprintf (buf, ps, x);
- }
- else
- sprintf (buf, "%i", x);
- }
+ sprintf (buf, "%*i", constant_formats[cf].leading, x);
else
{
if (constant_formats[cf].issigned && x < 0)