Silence a const vs non-const warning
Subsystems (2)
PATCH 1/1 Silence a const vs non-const warning
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 <[email protected]>
----
string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/string.c +1 -1
@@ -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++;
Signature · 4 lines
Jan-Benedict Glaw [email protected] . +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));
Quoted 4 lines · Jan-Benedict Glaw
This patch silences a const vs. non-const warning issued by very recent GCC versions:
$ vax-linux-uclibc-gcc -v 2>&1 | grep version
[...]
lib/string.c EXPORT_SYMBOL(memset); · line 470
Quoted 5 lines
void *memcpy(void *dest, const void *src,
size_tcount) {lib/string.c +1
-1char *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