[cfe-commits] r149662 - in /cfe/trunk: lib/Basic/Diagnostic.cpp test/Analysis/null-deref-ps.c test/CodeGen/statements.c test/Sema/return.c test/SemaCXX/vararg-non-pod.cpp test/SemaObjCXX/vararg-non-pod.mm

Chad Rosier mcrosier at apple.com
Mon Feb 6 16:10:42 PST 2012


On Feb 5, 2012, at 1:19 PM, Enea Zaffanella <zaffanella at cs.unipr.it> wrote:

> On 02/05/2012 09:17 PM, Chad Rosier wrote:
>> Hi Enea,
> 
> [...]
> 
>>> Why this change?
>> 
>> This change makes clang more consistent with how gcc handles warning options.  Previously, something such as "-Werror=foo -Wall" would result in foo only being a warning, not an error.  This is not consistent with gcc.  Conversely, "-Wall -Werror=foo" would result in a error.
>> 
>>> There are warnings that are mapped by default to errors.
>>> After this change, clients no longer have the option of mapping them back to warnings, which is obviously wrong.
>> 
>> Not true; to downgrade an error to a warning use '-Wno-error=foo', where foo is the specific warning.
>> 
>>  Chad
> 
> We are interested in changing the diagnostic mapping when using clang as a library (i.e., without using command line options). We were previously using the method setDiagnosticMapping(), but this no longer works. The doxygen documentation for the method says:
> 
>  void setDiagnosticMapping (diag::kind Diag,
>                             diag::Mapping Map,
>                             SourceLocation Loc)
>  This allows the client to specify that certain warnings are ignored.
>  Notes can never be mapped, errors can only be mapped to fatal, and
>  WARNINGs and EXTENSIONs can be mapped arbitrarily.
> 
> 
> Looks like the specification above no longer matches the implemented behavior (some of our calls to the method for remapping warnings are now _silently_ ignored). Anyway, this would still be OK, provided we know an alternative function/method we should call. So, what code should we write in order to change the default mapping of a warning that is mapped by default to error (e.g., warn_return_missing_expr)?
> 

Enea,
You can downgrade warnings that are mapped by default to errors using the setDiagnosticGroupWarningAsError(StringRef Group, bool Enabled) API (e.g.,  setDiagnosticGroupWarningAsError(Group, false)).  Let me know if this works for you.  If so, I'll go ahead and update the doxygen comments.

 Chad

> Enea.




More information about the cfe-commits mailing list