This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] fix -fmax-errors & notes, take 2
- From: Bernd Schmidt <bschmidt at redhat dot com>
- To: Nathan Sidwell <nathan at acm dot org>, dmalcolm at redhat dot com, schwab at linux-m68k dot org
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 2 Dec 2016 15:07:54 +0100
- Subject: Re: [PATCH] fix -fmax-errors & notes, take 2
- Authentication-results: sourceware.org; auth=none
- References: <95ebd046-fb7c-174d-51fb-3e94b72e27bc@acm.org>
On 12/02/2016 02:25 PM, Nathan Sidwell wrote:
+/* Check if we've met the maximum error limit. */
Arguments should be documented.
+void
+diagnostic_check_max_errors (diagnostic_context *context, bool flush)
+{
+ if (!context->max_errors)
+ return;
I prefer to spell that as != 0 since it's not a boolean, but you can
also leave it.
+ int count = (diagnostic_kind_count (context, DK_ERROR)
+ + diagnostic_kind_count (context, DK_SORRY)
+ + diagnostic_kind_count (context, DK_WERROR));
+
+ if (count >= (int) context->max_errors)
Looks like there are some unnecessary type mismatches leading to this
cast. Maybe declare max_errors as int and remove the cast?
Otherwise ok.
Bernd