[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
Sun Feb 5 12:17:11 PST 2012


Hi Enea,

On Feb 5, 2012, at 8:54 AM, Enea Zaffanella <zaffanella at cs.unipr.it> wrote:

> On 02/03/2012 02:49 AM, Chad Rosier wrote:
>> Author: mcrosier
>> Date: Thu Feb  2 19:49:51 2012
>> New Revision: 149662
>> 
>> URL: http://llvm.org/viewvc/llvm-project?rev=149662&view=rev
>> Log:
>> [frontend] Don't allow a mapping to a warning override an error/fatal mapping.
> 
> [...]
> 
>> Modified: cfe/trunk/lib/Basic/Diagnostic.cpp
>> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Basic/Diagnostic.cpp?rev=149662&r1=149661&r2=149662&view=diff
>> ==============================================================================
>> --- cfe/trunk/lib/Basic/Diagnostic.cpp (original)
>> +++ cfe/trunk/lib/Basic/Diagnostic.cpp Thu Feb  2 19:49:51 2012
>> @@ -172,6 +172,13 @@
>> 
>>    FullSourceLoc Loc(L, *SourceMgr);
>>    FullSourceLoc LastStateChangePos = DiagStatePoints.back().Loc;
>> +  // Don't allow a mapping to a warning override an error/fatal mapping.
>> +  if (Map == diag::MAP_WARNING) {
>> +    DiagnosticMappingInfo&Info = GetCurDiagState()->getOrAddMappingInfo(Diag);
>> +    if (Info.getMapping() == diag::MAP_ERROR ||
>> +        Info.getMapping() == diag::MAP_FATAL)
>> +      Map = Info.getMapping();
>> +  }
>>    DiagnosticMappingInfo MappingInfo = makeMappingInfo(Map, L);
> 
> 
> 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

> Please revert this portion of your commit.
> 
> Enea.



More information about the cfe-commits mailing list