scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 937a1686e98b70e427e12de8b9b635d245d7e05c
parent 5e295214e4eddad0eb9be0b88398ed4137269694
Author: Hiltjo Posthuma <hiltjo@codemadness.org>
Date:   Wed, 15 Jul 2015 22:22:02 +0200

minor fixes (whitespace and such)

Hi,

Just some minor fixes (whitespace and such).

Kind regards,
Hiltjo

From c79b4339fc477e2d0212d442f38c50326e430f2a Mon Sep 17 00:00:00 2001
From: Hiltjo Posthuma <hiltjo@codemadness.org>
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

Diffstat:
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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -16,5 +16,5 @@ die(const char *fmt, ...) va_start(va, fmt); fprintf(stderr, fmt, va); va_end(va); - exit(EXIT_FAILURE); + exit(1); }