vsprintf: fix gcc warning
Subsystems (2)
PATCH 1/1 vsprintf: fix gcc warning
Hi :)
Does this look correct? Please disregard this if it has already been fixed. Thanks.
Vegard
From: Vegard Nossum <[email protected]>
Date: Mon, 7 Jul 2008 21:08:57 +0200
Subject: [PATCH] vsprintf: fix gcc warning
The patch
commit bf4bb495e5dc8f1abba98bb6cb08b2d94446a662
Author: Linus Torvalds <[email protected]> Date: Sat Jul 5 22:37:13 2008 -0700
printk: add support for '%pS'
introduced a new build warning from GCC (4.1.2):
CC lib/vsprintf.olib/vsprintf.c: In function `pointer':lib/vsprintf.c:560: warning: cast from pointer to integer of different size
Whether the warning is useful or not is a discussion on its own. But we can at least fix this by casting to 'unsigned long' instead of 'unsigned long long'. 'unsigned long' can hold a pointer and will be converted implicitly to the right type upon calling the function.
--- lib/vsprintf.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
lib/vsprintf.c +1 -1
@@ -557,7 +557,7 @@ static char *pointer(const char *fmt, char *buf, char *end, void *ptr, int base, precision =2 *sizeof (void *); type |=ZEROPAD ; } -return number (buf, end, (unsigned long long ) ptr, base, size, precision, type); +return number (buf, end, (unsigned long ) ptr, base, size, precision, type); }/**
Signature · 1 line
1.5.4.1
Quoted 3 lines · Vegard Nossum
Does this look correct? Please disregard this if it has already been fixed. Thanks.
Looks fine. But the series I eventually committed avoided this issue, so please double-check current -git.
Linus
Quoted 8 lines · Linus Torvalds
Quoted 3 lines · Vegard Nossum
Does this look correct? Please disregard this if it has already been fixed. Thanks.
Looks fine. But the series I eventually committed avoided this issue, so please double-check current -git.
Oh, you're right. I was compiling/looking at tip/master which had your old version. Sorry for the noise!
Vegard
Signature · 4 lines
"The animistic metaphor of the bug that maliciously sneaked in while the programmer was not looking is intellectually dishonest as it disguises that the error is the programmer's own creation." -- E. W. Dijkstra, EWD1036