scc

simple C compiler
git clone git://git.2f30.org/scc
Log | Files | Refs | README | LICENSE

commit 9b285f0edfd753ced6fe442afccd3b319be87aea
parent ad972426c2da0aff2346e7915ffb3b9454069e08
Author: FRIGN <dev@frign.de>
Date:   Tue, 17 May 2016 18:25:12 +0200

[cc1] Fix error messages

grammar fixes and consistent wording

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

Diffstat:
Mcc1/cpp.c | 18+++++++++---------
Mcc1/decl.c | 12++++++------
Mcc1/expr.c | 10+++++-----
Mcc1/init.c | 4++--
Mcc1/lex.c | 6+++---
Mcc1/main.c | 2+-
Mcc1/stmt.c | 4++--
Mcc1/symbol.c | 2+-
8 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/cc1/cpp.c b/cc1/cpp.c @@ -155,13 +155,13 @@ parsepars(char *buffer, char **listp, int nargs) } 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 @@ copymacro(char *buffer, char *s, size_t bufsiz, char *arglist[]) 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 @@ substitute: 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 @@ getpars(Symbol *args[NR_MACROARG]) 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 @@ getdefs(Symbol *args[NR_MACROARG], int nargs, char *bp, size_t bufsiz) 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 @@ getdefs(Symbol *args[NR_MACROARG], int nargs, char *bp, size_t bufsiz) break; if ((len = strlen(yytext)) >= bufsiz) { - cpperror("too long macro"); + cpperror("macro too long"); return 0; } if (yytoken == '$') { @@ -579,7 +579,7 @@ ifclause(int negate, int isifdef) 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; diff --git a/cc1/decl.c b/cc1/decl.c @@ -42,7 +42,7 @@ push(struct declarators *dp, int op, ...) 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 @@ ansifun(Type *tp, Type *types[], Symbol *syms[], int *ntypes, int *nsyms) 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 @@ directdcl(struct declarators *dp, unsigned ns) 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 @@ newtag(void) 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 @@ structdcl(void) 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 @@ field(struct decl *dcl) 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; diff --git a/cc1/expr.c b/cc1/expr.c @@ -370,7 +370,7 @@ pcompare(char op, Node *lp, Node *rp) err = 1; } if (err) - errorp("incompatibles type in comparision"); + errorp("incompatible types in comparison"); return simplify(op, inttype, lp, rp); } @@ -391,7 +391,7 @@ compare(char op, Node *lp, Node *rp) 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,18 +836,18 @@ cast(void) 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; } break; default: if (nested == NR_SUBEXPR) - error("too expressions nested by parentheses"); + error("too many expressions nested by parentheses"); ++nested; rp = expr(); --nested; diff --git a/cc1/init.c b/cc1/init.c @@ -65,7 +65,7 @@ fielddesig(Init *ip) 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 @@ initializer(Symbol *sym, Type *tp) 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; } diff --git a/cc1/lex.c b/cc1/lex.c @@ -85,7 +85,7 @@ ilex(char *fname) 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 @@ delinput(void) 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 @@ static void 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 diff --git a/cc1/main.c b/cc1/main.c @@ -79,7 +79,7 @@ main(int argc, char *argv[]) } if (output && !freopen(output, "w", stdout)) - die("error opening output:%s", strerror(errno)); + die("error opening output: %s", strerror(errno)); if (argc > 1) usage(); diff --git a/cc1/stmt.c b/cc1/stmt.c @@ -244,7 +244,7 @@ Case(Symbol *lbreak, Symbol *lcont, Switch *sw) 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 @@ compound(Symbol *lbreak, Symbol *lcont, Switch *lswitch) expect('{'); if (nested == NR_BLOCK) - error("too nesting levels of compound statements"); + error("too many nesting levels of compound statements"); ++nested; for (;;) { diff --git a/cc1/symbol.c b/cc1/symbol.c @@ -73,7 +73,7 @@ void pushctx(void) { if (++curctx == NR_BLOCK+1) - error("too much nested blocks"); + error("too many nested blocks"); } void