Re: Fix sparse warning

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Matthew Wilcox <matthew@xxxxxx> wrote:

> On Fri, Oct 23, 2009 at 09:59:11AM +0200, Ingo Molnar wrote:
> > Warnings are not something that should be 'fixed' - they are just a sign 
> > of some sort of trouble:
> > 
> >  1- bug/limitation in the tool (Sparse)
> >  2- uncleanliness in the source code
> >  3- bug in the source code
> > 
> > here it seems to be case #1, as file scope statics are perfectly fine, 
> > even if used by a single function.
> 
> This is case #2.  We used to have:
> 
> int do_one_initcall(initcall_t fn)
> {
> 	struct boot_trace_call call;
> }
> 
> static void __init do_initcalls(void)
> {
>         initcall_t *call;
> }
> 
> static void __init do_pre_smp_initcalls(void)
> {
>         initcall_t *call;
> }
> 
> and you changed it so that the boot_trace_call is now file-scope.  Now 
> sparse rightfully warns about the shadow definitions in do_initcalls 
> and do_pre_smp_initcalls.

Doh, right you are!

Unfortunately the discussion was not Cc:-ed to lkml so i couldnt review 
the original patch and i assumed it moved the static back into function 
scope.

The right fix would be to rename the variables to not be colliding. (if 
we used -Wshadow like tools/perf/ does we'd have gotten this warning 
from GCC too btw) Does the patch do that? Could we please Cc: patches to 
lkml?

Thanks,

	Ingo
--
To unsubscribe from this list: send the line "unsubscribe kernel-janitors" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Kernel Development]     [Kernel Announce]     [Kernel Newbies]     [Linux Networking Development]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Device Mapper]

  Powered by Linux