ref: c231c04f8d22b3b6a46fa49c7da5f7a829380a02
parent: 37c543332c819df9b16eceb732a727992af7a7d4
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Sat May 9 13:55:04 EDT 2015
Add limit to the number of errors This limit helps in the case of inifinite errors, and after 10 errors nobody read more.
--- a/cc1/error.c
+++ b/cc1/error.c
@@ -7,7 +7,10 @@
#include "../inc/cc.h"
#include "cc1.h"
+#define MAXERRNUM 10
+
extern uint8_t failure;
+static uint8_t nerrors;
static void
warn_helper(int8_t flag, char *fmt, va_list va)
@@ -18,6 +21,10 @@
(flag < 0) ? "error" : "warning", filename(), fileline());
vfprintf(stderr, fmt, va);
putc('\n', stderr);
+ if (flag < 0 && nerrors++ == MAXERRNUM) {
+ fputs("too many errors\n", stderr);
+ exit(-1);
+ }
}
void