[PATCH] Add back 'remark' to libclang interface
Tobias Grosser
tobias at grosser.es
Mon Apr 28 04:59:24 PDT 2014
On 28/04/2014 13:41, Tobias Grosser wrote:
> On 28/04/2014 13:08, Alp Toker wrote:
>>
>> On 28/04/2014 11:11, Tobias Grosser wrote:
>>>
>>>
>>> On 28/04/2014 11:16, Alp Toker wrote:
>>>> CXDiagnostic with value 5 is higher than CXDiagnostic_Error and there
>>>> are many applications using the outlined pattern that break following
>>>> the change, either by crashing or mis-categorising diagnostics as fatal
>>>> errors.
>>>
>>> I see that the above categorizes the diagnostic as an error. This is
>>> obviously incorrect. Nevertheless, it should just cause an error
>>> message. I do not see how/why this would crash.
>>
>> It hits an unreachable condition due to an unhandled case and crashes.
>
> I consider this an application bug.
>
> My quick look on ohloh did not find such usage. (Most results are
> duplicates of clang code, but e.g. ycm does the right thing and just
> maps to 'E' in case of unknown diagnostics). Obviously, there may still
> be other applications.
I looked a little further. There are only seven projects on ohloh which
actually look at the diagnostic level (all others just have a copy of
clang somewhere). All seem to do something sensible (either map to an
unknown diagnostic string, map it as an error or to a very high log level).
So the assumptions we are afraid of are to the very least not very
widespread on ohloh.
Cheers,
Tobias
## QTCreator
switch (severity)
{
case CXDiagnostic_Ignored:
return QLatin1String("Ignored");
case CXDiagnostic_Note:
return QLatin1String("Note");
case CXDiagnostic_Warning:
return QLatin1String("Warning");
case CXDiagnostic_Error:
return QLatin1String("Error");
case CXDiagnostic_Fatal:
return QLatin1String("Fatal");
default:
return QLatin1String("<UNKNOWN>");
## YouCompleteMe
char DiagnosticSeverityToType( CXDiagnosticSeverity severity ) {
switch ( severity ) {
case CXDiagnostic_Ignored:
case CXDiagnostic_Note:
return 'I';
case CXDiagnostic_Warning:
return 'W';
case CXDiagnostic_Error:
case CXDiagnostic_Fatal:
return 'E';
default:
return 'E';
}
## go-clang
func (ds DiagnosticSeverity) String() string {
switch ds {
case Diagnostic_Ignored:
return "Ignored"
case Diagnostic_Note:
return "Note"
case Diagnostic_Warning:
return "Warning"
case Diagnostic_Error:
return "Error"
case Diagnostic_Fatal:
return "Fatal"
default:
return "Invalid"
}
}
## rust-bindgen
if d.severity() >= CXDiagnostic_Error {
c_err = true;
}
## bindgen.clay
if (clang_getDiagnosticSeverity(diag) >= CXDiagnostic_Error)
error? = true;
## oovcde
if(sev >= CXDiagnostic_Error)
errType = ET_CompileErrors;
else
errType = ET_CompileWarnings;
}
## rtags
int logLevel = INT_MAX;
const CXDiagnosticSeverity severity =
clang_getDiagnosticSeverity(diagnostic);
switch (severity) {
case CXDiagnostic_Fatal:
case CXDiagnostic_Error:
logLevel = Error;
break;
case CXDiagnostic_Warning:
logLevel = Warning;
break;
case CXDiagnostic_Note:
logLevel = Debug;
break;
case CXDiagnostic_Ignored:
break;
}
More information about the cfe-commits
mailing list