From c79b4339fc477e2d0212d442f38c50326e430f2a Mon Sep 17 00:00:00 2001 From: Hiltjo Posthuma Date: Wed, 15 Jul 2015 21:37:32 +0200 Subject: [PATCH] whitespace + typo fixes change exit(-1) to exit(1), just use 1 instead of EXIT_FAILURE --- README | 4 ++-- cc1/cpp.c | 2 +- cc1/error.c | 4 ++-- cc1/lex.c | 2 +- cc2/main.c | 2 +- cc2/optm.c | 2 +- cc2/parser.c | 2 +- lib/die.c | 2 +- 8 files changed, 10 insertions(+), 10 deletions(-) diff --git a/README b/README index a4c9337..a99676a 100644 --- a/README +++ b/README @@ -23,8 +23,8 @@ friends). This is the reason why I begin to develop this compiler, and I hope it will be useful for you. -Changes from standar C -====================== +Changes from standard C +======================= This compiler is near of being full compatible with C99 standard, but it has some differences: diff --git a/cc1/cpp.c b/cc1/cpp.c index 13ec31b..8552f80 100644 --- a/cc1/cpp.c +++ b/cc1/cpp.c @@ -534,7 +534,7 @@ usererr(char *s) if (cppoff) return; printerr("#error %s", s); - exit(-1); + exit(1); } static void diff --git a/cc1/error.c b/cc1/error.c index 2160c3a..68880d1 100644 --- a/cc1/error.c +++ b/cc1/error.c @@ -25,7 +25,7 @@ warn_helper(int flag, char *fmt, va_list va) putc('\n', stderr); if (flag < 0 && nerrors++ == MAXERRNUM) { fputs("too many errors\n", stderr); - exit(-1); + exit(1); } } @@ -62,6 +62,6 @@ printerr(char *fmt, ...) void unexpected(void) -{ +{ error("unexpected '%s'", yytext); } diff --git a/cc1/lex.c b/cc1/lex.c index 26d9b14..c35e401 100644 --- a/cc1/lex.c +++ b/cc1/lex.c @@ -651,7 +651,7 @@ discard(void) break; } if (c == '\0' && !moreinput()) - exit(-1); + exit(1); } jump: yytoken = c; diff --git a/cc2/main.c b/cc2/main.c index 846f81e..3aec235 100644 --- a/cc2/main.c +++ b/cc2/main.c @@ -22,7 +22,7 @@ error(unsigned nerror, ...) vfprintf(stderr, errlist[nerror], va); va_end(va); putc('\n', stderr); - exit(EXIT_FAILURE); + exit(1); } bool diff --git a/cc2/optm.c b/cc2/optm.c index f755023..83a634a 100644 --- a/cc2/optm.c +++ b/cc2/optm.c @@ -34,7 +34,7 @@ repeat: np->left = optcasts(np->left, tp); np->right = optcasts(np->right, tp); - return np; + return np; } static Node * diff --git a/cc2/parser.c b/cc2/parser.c index cfdff4b..99f9d8d 100644 --- a/cc2/parser.c +++ b/cc2/parser.c @@ -464,7 +464,7 @@ oreturn(char *token) if (token = strtok(NULL, "\t")) { expr(token); lp = pop(); - np ->left = lp; + np->left = lp; np->type = lp->type; } else { np->left = NULL; diff --git a/lib/die.c b/lib/die.c index 6752848..974dd2c 100644 --- a/lib/die.c +++ b/lib/die.c @@ -16,5 +16,5 @@ die(const char *fmt, ...) va_start(va, fmt); fprintf(stderr, fmt, va); va_end(va); - exit(EXIT_FAILURE); + exit(1); } -- 2.3.0