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] [C/C++] Add a new warning flag -Wself-assign


On Wed, Jun 23, 2010 at 2:56 PM, Le-Chun Wu <lcwu@google.com> wrote:
> Paul,
>
> On Wed, Jun 23, 2010 at 2:30 PM, Paul Koning <Paul_Koning@dell.com> wrote:
>>> ...
>>> Besides minor changes that address the review comments, the
>>> major differences of this revised patch from the original one are (1)
>>> -Wself-assign is enabled by -Wall, and (2) -Winit-self flag is
>>> removed.
>>
>> Given that self-assign is the documented way to suppress a warning (for
>> uninitialized variable) is it appropriate for -Wall to turn this on? ?It
>> would mean that code that was specifically fixed to avoid warnings under
>> -Wall will now get warnings again on that exact same line. ?I don't
>> object to the feature itself, but I do object to that aspect.
>>
>
> This patch actually removes the paragraph in invoke.texi that
> recommends using self-initialization to suppress uninitialized
> variable warnings. Yes, this would be a disruptive change to people
> who use self-initialization, but in my opinion, self-initialization
> doesn't really make sense and is not a good way to fix or work around
> uninitialized variable warnings. (One can initialize a variable with
> other more meaningful value as easily.)
>

I forgot to mention that when this patch is approved and checked in, I
will also update gcc-4.6/changes.html to mention that
self-initialization is not longer a recommended way to suppress the
uninitialized variable warnings.

Le-chun


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