This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] fix -fmax-errors & notes, take 2


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]