Re: [PATCH -mm] sys_semctl gcc 4.1 warning fix

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

 



There's no code increase when you init something to itself . I could
convert all the instance of the warning, that I've investigated, to a
system like this . I think it would be a benefit so we could clearly
identify any new warnings added over time, and quiet the ones we know
aren't real errors .

However, from all the responses I'd imagine a patch like this wouldn't
get accepted ..

Daniel

On Wed, 2006-05-10 at 15:20 -0400, Steven Rostedt wrote:
> Someone emailed me the bug report for gcc:
> 
>  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=5035
> 
> 
> And in this, it showed the trick to initialize self to turn off that
> warning.
> 
> Would it be OK to define a macro like:
> 
> #ifdef CONFIG_SHOW_ALL_UNINIT_WARNINGS
> #  define init_self(x) x
> #else
> #  define init_self(x) x = x
> #endif
> 
> Such that we can at least look at the places of bogus uninitialized
> warnings and do something like:
> 
> Index: ipc/sem.c
> ===================================================================
> --- ipc/sem.c   (revision 796)
> +++ ipc/sem.c   (working copy)
> @@ -809,7 +809,7 @@
>  {
>         struct sem_array *sma;
>         int err;
> -       struct sem_setbuf setbuf;
> +       struct sem_setbuf init_self(setbuf);
>         struct kern_ipc_perm *ipcp;
> 
>         if(cmd == IPC_SET) {
> 
> 
> Seems to work.  And if you want to make sure that a place doesn't need it
> anymore, use -Winit-self and have a script to do a full make once with
> CONFIG_SHOW_ALL_UNINIT_WARNINGS and once with -Winit-self, and make sure
> that all the -Winit-self warnings are in the
> CONFIG_SHOW_ALL_UNINIT_WARNINGS. Otherwise the init_self isn't needed
> anymore.
> 
> -- Steve
> 
> 

-
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/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux