[patch] opcodes: bfin: simplify field width processing and fix build warnings

Mike Frysinger vapier@gentoo.org
Sun Apr 1 04:13:00 GMT 2012


this fix the build time warning:
warning: format not a string literal, argument types not checked [-Wformat-
nonliteral]

committed
-mike

2012-04-01  Mike Frysinger  <vapier@gentoo.org>

	* bfin-dis.c (fmtconst): Replace decimal handling with a single
	sprintf call and the '*' field width.

--- opcodes/bfin-dis.c	24 Mar 2011 05:27:39 -0000	1.42
+++ opcodes/bfin-dis.c	1 Apr 2012 04:04:50 -0000
@@ -162,16 +162,7 @@ fmtconst (const_forms_t cf, TIword x, bf
     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, "%li", x);
-    }
+    sprintf (buf, "%*li", constant_formats[cf].leading, x);
   else
     {
       if (constant_formats[cf].issigned && x < 0)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <https://sourceware.org/pipermail/binutils/attachments/20120401/da8c0266/attachment.sig>


More information about the Binutils mailing list