This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] Add a new warning flag -Wself-assign


On Wed, Jun 9, 2010 at 11:25 AM, Le-Chun Wu <lcwu@google.com> wrote:
> It should be pretty easy to modify this patch to not warn about
> self-initialization of local variables with this flag. However, what I
> don't understand is why a user would want to work around (or suppress)
> an uninitialized warning by doing self-initialization. They could have
> just initialized a local variable to some other more meaningful value.
> Initializing a variable with itself doesn't seem like a good way to
> fix an uninitialized warning.

Well this is the documented way of disabling the warning.   If we want
to change this, we should get rid of -Winit-self at the same time.
And remove the documentation for this special case.  I don't remember
the full history behind my change of the documentation to mention this
special case but from what I remember the source at one point did not
warn about "int t = t +1;".  And that I was fixing that case with
keeping the special case of "int i = i;".

Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]