Hi Enea,

On Feb 5, 2012, at 8:54 AM, Enea Zaffanella <[email protected]> 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.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to