From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dirk Behme Date: Tue, 21 Jul 2009 20:32:01 +0200 Subject: [U-Boot] [PATCH 5/8]: Use do_div from div64.h for vsprintf In-Reply-To: <20090720215922.A516C832E416@gemini.denx.de> References: <20090707155510.58ae70bb@marrow.netinsight.se> <20090707155927.78e75333@marrow.netinsight.se> <20090720214252.B0B6E832E416@gemini.denx.de> <20090720215922.A516C832E416@gemini.denx.de> Message-ID: <4A6609A1.1010201@googlemail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Wolfgang Denk wrote: > Dear Simon Kagstrom, > > In message <20090720214252.B0B6E832E416@gemini.denx.de> I wrote: >> Dear Simon Kagstrom, >> >> In message <20090707155927.78e75333@marrow.netinsight.se> you wrote: >>> Signed-off-by: Simon Kagstrom >>> --- >>> lib_generic/vsprintf.c | 7 +------ >>> 1 files changed, 1 insertions(+), 6 deletions(-) >> Applied, thanks. > > Sorry, I had to back out your patch. as it is causing compile problems: > > -> ./MAKEALL voiceblue > Configuring for voiceblue board... > vsprintf.c: In function 'put_dec': > vsprintf.c:237: warning: comparison of distinct pointer types lacks a cast > vsprintf.c:237: warning: right shift count >= width of type > vsprintf.c:237: warning: passing argument 1 of '__div64_32' from incompatible pointer type > text data bss dec hex filename > 142099 5196 23304 170599 29a67 ./u-boot > > Please fix and resubmit. :( This is because do_div() in div64.h only likes a 64bit value as first parameter. So something like --- a/lib_generic/vsprintf.c +++ b/lib_generic/vsprintf.c @@ -22,18 +22,19 @@ extern int do_reset (cmd_tbl_t *cmdtp, i #endif #ifdef CONFIG_SYS_64BIT_VSPRINTF +#include # define NUM_TYPE long long #else # define NUM_TYPE long -#endif -#define noinline __attribute__((noinline)) - #define do_div(n, base) ({ \ unsigned int __res; \ __res = ((unsigned NUM_TYPE) n) % base; \ n = ((unsigned NUM_TYPE) n) / base; \ __res; \ }) +#endif +#define noinline __attribute__((noinline)) + would do the trick. I don't know any clean way how to do this, though. Best regards Dirk