shithub: scc

Download patch

ref: 930f559028da0e7c47e577adf62e7c53cc0166fe
parent: 3cd073e95cfa26090e59b799ccc160f63949a734
author: FRIGN <dev@frign.de>
date: Tue May 17 14:25:12 EDT 2016

[cc1] Fix error messages

grammar fixes and consistent wording

"No hables a menos que puedas mejorar el silencio."
   - Jorge Luis Borges

--- a/cc1/cpp.c
+++ b/cc1/cpp.c
@@ -155,13 +155,13 @@
 		} while (++n < NR_MACROARG && yytoken == ',');
 	}
 	if (yytoken != ')')
-		error("incorrect macro function alike invocation");
+		error("incorrect macro function-alike invocation");
 	disexpand = 0;
 
 	if (n == NR_MACROARG)
-		error("too much parameters in macro \"%s\"", macroname);
+		error("too many parameters in macro \"%s\"", macroname);
 	if (n != nargs) {
-		error("macro \"%s\" passed %d arguments, but it takes %d",
+		error("macro \"%s\" received %d arguments, but it takes %d",
 		      macroname, n, nargs);
 	}
 
@@ -222,7 +222,7 @@
 	return bp - buffer;
 
 expansion_too_long:
-	error("expansion of macro \"%s\" is too long", macroname);
+	error("macro expansion of \"%s\" too long", macroname);
 }
 
 #define BUFSIZE ((INPUTSIZ > FILENAME_MAX+2) ? INPUTSIZ : FILENAME_MAX+2)
@@ -271,7 +271,7 @@
 	total = llen + elen + rlen;
 
 	if (total >= LINESIZ)
-		error("macro expansion too long");
+		error("macro expansion of \"%s\" too long", macroname);
 
 	/* cut macro invocation */
 	memmove(begin, begin + ilen, rlen);
@@ -307,7 +307,7 @@
 	n = 0;
 	do {
 		if (n == NR_MACROARG) {
-			cpperror("too much parameters in macro");
+			cpperror("too many parameters in macro");
 			return NR_MACROARG;
 		}
 		if (yytoken != IDEN) {
@@ -332,7 +332,7 @@
 	int prevc = 0, ispar;
 
 	if (yytoken == '$') {
-		cpperror("'##' cannot appear at either end of a macro expansion");
+		cpperror("'##' cannot appear at either ends of a macro expansion");
 		return 0;
 	}
 
@@ -356,7 +356,7 @@
 			break;
 
 		if ((len = strlen(yytext)) >= bufsiz) {
-			cpperror("too long macro");
+			cpperror("macro too long");
 			return 0;
 		}
 		if (yytoken == '$') {
@@ -579,7 +579,7 @@
 	Node *expr;
 
 	if (cppctx == NR_COND-1)
-		error("too much nesting levels of conditional inclusion");
+		error("too many nesting levels of conditional inclusion");
 
 	n = cppctx++;
 	namespace = NS_CPP;
--- a/cc1/decl.c
+++ b/cc1/decl.c
@@ -42,7 +42,7 @@
 
 	va_start(va, op);
 	if ((n = dp->nr++) == NR_DECLARATORS)
-		error("too much declarators");
+		error("too many declarators");
 
 	p = &dp->d[n];
 	p->op = op;
@@ -268,7 +268,7 @@
 			continue;
 		}
 		if (!toomany)
-			errorp("too much parameters in function definition");
+			errorp("too many parameters in function definition");
 		toomany = 1;
 	} while (accept(','));
 
@@ -320,7 +320,7 @@
 
 	if (accept('(')) {
 		if (nested == NR_SUBTYPE)
-			error("too declarators nested by parentheses");
+			error("too many declarators nested by parentheses");
 		++nested;
 		declarator(dp, ns);
 		--nested;
@@ -482,7 +482,7 @@
 		Type *tp;
 
 		if (ns == NS_STRUCTS + NR_MAXSTRUCTS)
-			error("too much tags declared");
+			error("too many tags declared");
 		tp = mktype(NULL, tag, 0, NULL);
 		tp->ns = ns++;
 		sym->type = tp;
@@ -523,7 +523,7 @@
 	tp->defined = 1;
 
 	if (nested == NR_STRUCT_LEVEL)
-		error("too levels of nested structure or union definitions");
+		error("too many levels of nested structure or union definitions");
 
 	++nested;
 	while (yytoken != '}') {
@@ -639,7 +639,7 @@
 
 	sym->flags |= SFIELD;
 	if (n == NR_FIELDS)
-		error("too much fields in struct/union");
+		error("too many fields in struct/union");
 	DBG("New field '%s' in namespace %d\n", name, structp->ns);
 	structp->p.fields = xrealloc(structp->p.fields, ++n * sizeof(*sym));
 	structp->p.fields[n-1] = sym;
--- a/cc1/expr.c
+++ b/cc1/expr.c
@@ -370,7 +370,7 @@
 		err = 1;
 	}
 	if (err)
-		errorp("incompatibles type in comparision");
+		errorp("incompatible types in comparison");
 	return simplify(op, inttype, lp, rp);
 }
 
@@ -391,7 +391,7 @@
 		arithconv(&lp, &rp);
 		return simplify(op, inttype, lp, rp);
 	} else {
-		errorp("incompatibles type in comparision");
+		errorp("incompatible types in comparison");
 		freetree(lp);
 		freetree(rp);
 		return constnode(zero);
@@ -836,11 +836,11 @@
 
 		switch (tp->op) {
 		case ARY:
-			error("cast specify an array type");
+			error("cast specifies an array type");
 		default:
 			lp = cast();
 			if ((rp = convert(lp,  tp, 1)) == NULL)
-				error("bad type convertion requested");
+				error("bad type conversion requested");
 			rp->flags &= ~NLVAL;
 			rp->flags |= lp->flags & NLVAL;
 		}
@@ -847,7 +847,7 @@
 		break;
 	default:
 		if (nested == NR_SUBEXPR)
-			error("too expressions nested by parentheses");
+			error("too many expressions nested by parentheses");
 		++nested;
 		rp = expr();
 		--nested;
--- a/cc1/init.c
+++ b/cc1/init.c
@@ -65,7 +65,7 @@
 		unexpected();
 	sym = yylval.sym;
 	if ((sym->flags & SDECLARED) == 0) {
-		errorp(" unknown field '%s' specified in initializer",
+		errorp("unknown field '%s' specified in initializer",
 		      sym->name);
 		return 0;
 	}
@@ -292,7 +292,7 @@
 	int flags = sym->flags;
 
 	if (tp->op == FTN) {
-		errorp("function '%s' is initialized like a variable",
+		errorp("function '%s' initialized like a variable",
 		       sym->name);
 		tp = inttype;
 	}
--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -85,7 +85,7 @@
 		fname = "<stdin>";
 	} else {
 		if ((fp = fopen(fname, "r")) == NULL) {
-			die("error opening input '%s':%s",
+			die("error: failed to open input file '%s': %s",
 			    fname, strerror(errno));
 		}
 	}
@@ -112,7 +112,7 @@
 	if (!ip->next)
 		eof = 1;
 	if (fclose(ip->fp))
-		die("error reading from input file '%s'", ip->fname);
+		die("error: failed to read from input file '%s'", ip->fname);
 	if (eof)
 		return;
 	input = ip->next;
@@ -124,7 +124,7 @@
 newline(void)
 {
 	if (++input->nline == 0)
-		die("error:input file '%s' too long", input->fname);
+		die("error: input file '%s' too long", input->fname);
 }
 
 static char
--- a/cc1/main.c
+++ b/cc1/main.c
@@ -79,7 +79,7 @@
 	}
 
 	if (output && !freopen(output, "w", stdout))
-		die("error opening output:%s", strerror(errno));
+		die("error opening output: %s", strerror(errno));
 	if (argc > 1)
 		usage();
 
--- a/cc1/stmt.c
+++ b/cc1/stmt.c
@@ -244,7 +244,7 @@
 	if (!sw) {
 		errorp("case label not within a switch statement");
 	} else if (sw->nr >= 0 && ++sw->nr == NR_SWITCH) {
-		errorp("too case labels for a switch statement");
+		errorp("too many case labels for a switch statement");
 		sw->nr = -1;
 	}
 	expect(':');
@@ -322,7 +322,7 @@
 	expect('{');
 
 	if (nested == NR_BLOCK)
-		error("too nesting levels of compound statements");
+		error("too many nesting levels of compound statements");
 
 	++nested;
 	for (;;) {
--- a/cc1/symbol.c
+++ b/cc1/symbol.c
@@ -73,7 +73,7 @@
 pushctx(void)
 {
 	if (++curctx == NR_BLOCK+1)
-		error("too much nested blocks");
+		error("too many nested blocks");
 }
 
 void