On Thu, 2016-10-13 at 06:48 -0400, Nathan Sidwell wrote:
> On 10/11/16 16:07, David Malcolm wrote:
> 
> > This logic is running when the next diagnostic is about to be
> > emitted.
> > But what if the user has selected -Wfatal-errors and there's a
> > single
> > error and no further diagnostics?  Could this change the observable
> > behavior?  (I'm trying to think of a case here, but failing).
> 
> 
> This version only moves the -fmax-errors handling.  I've addressed
> your testcase 
> comments too.  WDYT?

invoke.texi has this text for -fmax-errors:

"Limits the maximum number of error messages to @var{n}, at which point
GCC bails out rather than attempting to continue processing the source
code.  If @var{n} is 0 (the default), there is no limit on the number
of error messages produced.  If @option{-Wfatal-errors} is also
specified, then @option{-Wfatal-errors} takes precedence over this
option."

I'm not sure that the above would still be true after this patch.

How about splitting out the bail-out code into a separate function:

   diagnostic_handle_max_errors

or somesuch, and calling it before emitting a diagnostic (like in your
patch), and *also* at various key points in compilation - perhaps at
some of the places where we call seen_error?  That way we wouldn't need
an additional error to happen to stop processing, and notes would still
happen after the final error.  There could also be one just before we
cleanup the global_dc, so that the user gets the message there, if they
haven't gotten it yet.

Thanks
Dave

Reply via email to