[cfe-dev] -ferror-limit omits part of last error message

Douglas Gregor dgregor at apple.com
Thu Aug 11 10:07:04 PDT 2011


On Aug 10, 2011, at 10:39 PM, Nikola Smiljanic wrote:

> On Fri, Jul 29, 2011 at 5:57 PM, Douglas Gregor <dgregor at apple.com> wrote:
> 
> 
> The -ferror-limit logic is clipping notes when it shouldn't.
> 
>        - Doug
> 
> 
> Clang emits a fatal error (fatal_too_many_errors) when the error limit is reached and this clips all subsequent diagnostics. Here's a patch that allows notes to be emitted even after the fatal error. The question is what kind of diagnostics does error-limit filter, everything, only errors, warnings + errors? If it only filters errors then we should also allow warnings to be emitted.
> <error-limit_clipping_notes.patch>


@@ -703,7 +703,7 @@

 
   // If a fatal error has already been emitted, silence all subsequent
   // diagnostics.
-  if (Diag.FatalErrorOccurred) {
+  if (Diag.FatalErrorOccurred && DiagLevel != DiagnosticIDs::Note) {
     if (DiagLevel >= DiagnosticIDs::Error &&
         Diag.Client->IncludeInDiagnosticCounts()) {
       ++Diag.NumErrors;

This doesn't look right… it looks like it'll allow *all* notes to be printed, even if the warning/error preceding that note was suppressed. What we really want is for the notes corresponding to the last displayed error to be displayed, but subsequent notes should still be suppressed.

	- Doug
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20110811/094ca92e/attachment.html>


More information about the cfe-dev mailing list