[cfe-commits] r137910 - in /cfe/trunk: include/clang/Basic/Diagnostic.h lib/Basic/Diagnostic.cpp lib/Basic/DiagnosticIDs.cpp lib/Frontend/Warnings.cpp test/Sema/warn-unused-parameters.c

Jordy Rose jediknil at belkadan.com
Wed Aug 17 21:03:08 PDT 2011


On Aug 17, 2011, at 20:49, Ted Kremenek wrote:

> On Aug 17, 2011, at 7:06 PM, Eli Friedman wrote:
> 
>> On Wed, Aug 17, 2011 at 6:12 PM, Ted Kremenek <kremenek at apple.com> wrote:
>>> Author: kremenek
>>> Date: Wed Aug 17 20:12:56 2011
>>> New Revision: 137910
>>> 
>>> URL: http://llvm.org/viewvc/llvm-project?rev=137910&view=rev
>>> Log:
>>> Implement '-Weverything', which enables all warnings except those explicitly mapped to be ignored.
>>> 
>>> Currently this includes -pedantic warnings as well; we'll need to consider whether these should
>>> be included.
>> 
>> This seems like a bad idea: people will start using it, then complain
>> whenever we add a new warning which isn't generically applicable
>> (suppose we add an opt-in warning for C-style casts in C++, for
>> example).  We already have -Wextra for people who want lots of
>> warnings.
> 
> Hi Eli,
> 
> I had such reservations myself initially.  This was actually requested by several users, and I think they presented a compelling usage scenario.
> 
> Without -Weverything, our users have to guess what warning options they need to pass to get the warnings (new and old) that they want.  We add warnings all the time, some which we add to -Wall or -Wextra, and some we don't add to either.  The means the only way to activate a set of warnings is to gradually build the set of warnings up from the baseline set of enabled warnings.  This is reasonable for most users, but not all, especially those who want to always make use of the latest and greatest warnings.  For those users, they will need to manually add an additional -W flag for each opt in warning.  This really sucks for a variety of reasons, with the main one being discoverability of new warnings.  Our documentation on our warnings is essentially non-existent, and even if it was terrific it's still questionable to require users to constantly scour our documentation for the latest and greatest warnings if what they want is to always opt in to the latest set of warnings we add.
> 
> The argument I heard for -Weverything is that instead of starting with a baseline set of enabled warnings, and building that up with extra -W flags, one starts with all warnings enabled, and cherry picks which ones to disable with -Wno-[warning]. Thus the user takes an "opt out" instead of an "opt in" approach.  The real advantage of this approach is that warnings are instantly discoverable.  There is no scouring through docs.  They are all activated.  If the user feels the warning sucks, they turn it off.
> 
> -Weverything is not for everybody, and for those that complain about new warnings we can (and should) tell them to take the opt-in approach as opposed to the opt-out approach.  I don't see a problem with really serving both sets of user preferences.
> 
> Lastly, I think -Weverything is immensely useful from a testing perspective.  Without -Weverything, we don't have a convenient way to activate every warning in the compiler for large scale testing on real code.

If we keep this (and I think it's a good idea too), I think this would be a good explanation to add to the user manual page. New users who aren't familiar with -Wall might wonder what the difference is. (Wouldn't be bad to mention -Wmost and -Wextra either.)

Jordy



More information about the cfe-commits mailing list