* [PATCH] Silence a const vs non-const warning
@ 2006-04-03 11:21 Jan-Benedict Glaw
2006-04-03 12:15 ` Mitchell Blank Jr
0 siblings, 1 reply; 2+ messages in thread
From: Jan-Benedict Glaw @ 2006-04-03 11:21 UTC (permalink / raw)
To: Andrew Morton; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1199 bytes --]
Hi!
This patch silences a const vs. non-const warning issued by very
recent GCC versions:
$ vax-linux-uclibc-gcc -v 2>&1 | grep version
gcc version 4.2.0 20060331 (experimental)
$ make CROSS_COMPILE=vax-linux-uclibc- ARCH=vax mopboot
[...]
CC lib/string.o
lib/string.c: In function 'memcpy':
lib/string.c:470: warning: initialization discards qualifiers from pointer target type
[...]
Signed-off-by: Jan-Benedict Glaw <jbglaw@lug-owl.de>
----
string.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/string.c b/lib/string.c
index b3c28a3..dd2bfdd 100644
--- a/lib/string.c
+++ b/lib/string.c
@@ -467,7 +467,7 @@ EXPORT_SYMBOL(memset);
void *memcpy(void *dest, const void *src, size_t count)
{
char *tmp = dest;
- char *s = src;
+ const char *s = src;
while (count--)
*tmp++ = *s++;
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
für einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply related [flat|nested] 2+ messages in thread* Re: [PATCH] Silence a const vs non-const warning
2006-04-03 11:21 [PATCH] Silence a const vs non-const warning Jan-Benedict Glaw
@ 2006-04-03 12:15 ` Mitchell Blank Jr
0 siblings, 0 replies; 2+ messages in thread
From: Mitchell Blank Jr @ 2006-04-03 12:15 UTC (permalink / raw)
To: Andrew Morton, linux-kernel
Jan-Benedict Glaw wrote:
> This patch silences a const vs. non-const warning issued by very
> recent GCC versions:
>
> $ vax-linux-uclibc-gcc -v 2>&1 | grep version
[...]
> void *memcpy(void *dest, const void *src, size_t count)
> {
> char *tmp = dest;
> - char *s = src;
> + const char *s = src;
Actually the compiler version has nothing to do with it -- I'm pretty
sure even gcc 2.X would warn on that. The actual reason that most people
don't see that is that an arch w/o __HAVE_ARCH_MEMCPY is pretty rare.
Still, no reason for the reference C version of that function to emit
a warning, so it's worth fixing.
-Mitch
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2006-04-03 12:10 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-03 11:21 [PATCH] Silence a const vs non-const warning Jan-Benedict Glaw
2006-04-03 12:15 ` Mitchell Blank Jr
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.