Re: linux 2.6.23-rc7 - 14 compile warnings

2007-09-22 Thread WANG Cong
On Sat, Sep 22, 2007 at 10:23:59PM -0400, Gerhard Mack wrote:
>On Sat, 22 Sep 2007, WANG Cong wrote:
>
>> >Summary:
>> >  CC  mm/slub.o
>> >mm/slub.c: In function 'kfree':
>> >mm/slub.c:2491: warning: passing argument 3 of 'slab_free' discards
>> >qualifiers from pointer target type
>
>static void __slab_free(struct kmem_cache *s, struct page *page,
>void *x, void *addr)
>but ..
>
>void kfree(const void *x)
>
>void is not the same as const void.
>   
>> >  CC  fs/autofs4/symlink.o
>> >fs/autofs4/symlink.c: In function 'autofs4_follow_link':
>> >fs/autofs4/symlink.c:18: warning: passing argument 2 of 'nd_set_link'
>> >discards qualifiers from pointer target type
>
>Once again ino->u.symlink is a const char and it's dropping the const.
>

slab_free(s, page, (void *)x, __builtin_return_address(0));
   ^
I knew these things. But the explicit casts, such as the above one, mean
that we are intended to discard to qualifiers and I think gcc shouldn't
warn about this.

Regards.


WANG Cong

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux 2.6.23-rc7 - 14 compile warnings

2007-09-22 Thread Gerhard Mack
On Sat, 22 Sep 2007, WANG Cong wrote:

> >Summary:
> >  CC  mm/slub.o
> >mm/slub.c: In function 'kfree':
> >mm/slub.c:2491: warning: passing argument 3 of 'slab_free' discards
> >qualifiers from pointer target type

static void __slab_free(struct kmem_cache *s, struct page *page,
void *x, void *addr)
but ..

void kfree(const void *x)

void is not the same as const void.

> >  CC  fs/autofs4/symlink.o
> >fs/autofs4/symlink.c: In function 'autofs4_follow_link':
> >fs/autofs4/symlink.c:18: warning: passing argument 2 of 'nd_set_link'
> >discards qualifiers from pointer target type

Once again ino->u.symlink is a const char and it's dropping the const.

> 
> These two warnings are suspicious. Explicit casts are already there, how
> they come out? Or gcc bugs?
> 

gcc is perfectly justified when warning about dropping const. 

Gerhard


--
Gerhard Mack

[EMAIL PROTECTED]

<>< As a computer I find your faith in technology amusing.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: linux 2.6.23-rc7 - 14 compile warnings

2007-09-21 Thread WANG Cong
On Fri, Sep 21, 2007 at 10:33:56AM +0100, Dave Haywood wrote:
>Contents:
>   ver_linux output
>   Summary of compile warnings
>   Full compile log
>   .config
>
>
>
>Linux s1 2.6.23-rc7-g335fb8fc #9 SMP Fri Sep 21 09:31:01 BST 2007 i686 Pentium 
>III (Coppermine) GenuineIntel GNU/Linux
>
>Gnu C  4.2.0
>Gnu make   3.81
>binutils   2.17
>util-linux 2.12r
>mount  2.12r
>module-init-tools  3.2.2
>e2fsprogs  1.40.2
>PPP2.4.4
>Linux C Library2.5
>Dynamic linker (ldd)   2.5
>Procps 3.2.7
>Net-tools  1.60
>Kbd1.12
>Sh-utils   6.9
>udev   114
>
>
>
>Summary:
>  CC  mm/slub.o
>mm/slub.c: In function 'kfree':
>mm/slub.c:2491: warning: passing argument 3 of 'slab_free' discards
>qualifiers from pointer target type
>
>  CC  fs/autofs4/symlink.o
>fs/autofs4/symlink.c: In function 'autofs4_follow_link':
>fs/autofs4/symlink.c:18: warning: passing argument 2 of 'nd_set_link'
>discards qualifiers from pointer target type

These two warnings are suspicious. Explicit casts are already there, how
they come out? Or gcc bugs?

{snip}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/