[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

Enea Zaffanella zaffanella at cs.unipr.it
Sun Feb 5 13:19:12 PST 2012


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.



More information about the cfe-commits mailing list