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

Steven Rostedt
2006-05-10T15:24:44Z

On Wed, 10 May 2006, Daniel Walker wrote:

> On Wed, 2006-05-10 at 16:09 +0100, Alan Cox wrote:
> > On Mer, 2006-05-10 at 07:31 -0700, Daniel Walker wrote:
> > > > Hiding warnings like this can be a hazard as it will hide real warnings
> > > > later on.
> > >
> > > How could it hide real warnings? If anything these patch allow other
> > > (real warnings) to be seen .
> >
> > Because while the warning is present people will check it now and again.
>
> But it's pointless to review it, in this case and for this warning .
>
> > If you set the variable to zero then you generate extra code and you
> > ensure nobody will look in future.
>
> The extra code is a problem , I'll admit that . But the warning should
> disappear , it's just a waste .
>

What is really needed is an attribute to add to function parameters, that
tells gcc that the parameter, if a pointer, will be initialize via the
function.

For example:

#define __assigned __attribute__((initialized))

then declare a function:

int my_init_variabl(__assigned struct mystruct *var);

So gcc can know that the passed in variable will be updated. It could
then check to see if the function actually does initialize the pointer,
if the declaration is visible to the function definition itself.

Any gcc developers watching :)

-- Steve