From 60d92bbdcfc22c7248989ad7efb856989d299daa Mon Sep 17 00:00:00 2001 From: /dev/humancontroller Date: Thu, 13 Apr 2017 11:30:00 +0000 Subject: update the tools to the latest revision URL: https://github.com/darklegion/tremulous revision: c862a5340c8de44dcc7abaff170c20c04f9340e8, equivalently f45fbef604e05144057dec8d1dbfc5d4f5a2a822 --- src/tools/lcc/cpp/cpp.c | 12 ++++++++---- src/tools/lcc/cpp/cpp.h | 4 ++-- src/tools/lcc/cpp/include.c | 7 +++---- src/tools/lcc/cpp/macro.c | 11 +++++------ src/tools/lcc/cpp/nlist.c | 1 + src/tools/lcc/cpp/tokens.c | 2 +- src/tools/lcc/cpp/unix.c | 15 +++++++++++---- 7 files changed, 31 insertions(+), 21 deletions(-) (limited to 'src/tools/lcc/cpp') diff --git a/src/tools/lcc/cpp/cpp.c b/src/tools/lcc/cpp/cpp.c index 6739e4d..5c0cfd7 100644 --- a/src/tools/lcc/cpp/cpp.c +++ b/src/tools/lcc/cpp/cpp.c @@ -9,7 +9,7 @@ char rcsid[] = "cpp.c - faked rcsid"; #define OUTS 16384 char outbuf[OUTS]; -char *outp = outbuf; +char *outbufp = outbuf; Source *cursource; int nerrs; struct token nltoken = { NL, 0, 0, 0, 1, (uchar*)"\n" }; @@ -51,7 +51,7 @@ process(Tokenrow *trp) for (;;) { if (trp->tp >= trp->lp) { trp->tp = trp->lp = trp->bp; - outp = outbuf; + outbufp = outbuf; anymacros |= gettokens(trp, 1); trp->tp = trp->bp; } @@ -204,9 +204,14 @@ control(Tokenrow *trp) error(WARNING, "Syntax error in #endif"); break; + case KWARNING: + trp->tp = tp+1; + error(WARNING, "#warning directive: %r", trp); + break; + case KERROR: trp->tp = tp+1; - error(WARNING, "#error directive: %r", trp); + error(ERROR, "#error directive: %r", trp); break; case KLINE: @@ -245,7 +250,6 @@ control(Tokenrow *trp) break; } setempty(trp); - return; } void * diff --git a/src/tools/lcc/cpp/cpp.h b/src/tools/lcc/cpp/cpp.h index ae855c9..ddd7502 100644 --- a/src/tools/lcc/cpp/cpp.h +++ b/src/tools/lcc/cpp/cpp.h @@ -24,7 +24,7 @@ enum toktype { END, UNCLASS, NAME, NUMBER, STRING, CCON, NL, WS, DSHARP, DSHARP1, NAME1, DEFINED, UMINUS }; enum kwtype { KIF, KIFDEF, KIFNDEF, KELIF, KELSE, KENDIF, KINCLUDE, KDEFINE, - KUNDEF, KLINE, KERROR, KPRAGMA, KDEFINED, + KUNDEF, KLINE, KWARNING, KERROR, KPRAGMA, KDEFINED, KLINENO, KFILE, KDATE, KTIME, KSTDC, KEVAL }; #define ISDEFINED 01 /* has #defined value */ @@ -143,7 +143,7 @@ void setobjname(char *); char *basepath( char *fname ); -extern char *outp; +extern char *outbufp; extern Token nltoken; extern Source *cursource; extern char *curtime; diff --git a/src/tools/lcc/cpp/include.c b/src/tools/lcc/cpp/include.c index 1bb8847..5ecd8b3 100644 --- a/src/tools/lcc/cpp/include.c +++ b/src/tools/lcc/cpp/include.c @@ -108,7 +108,6 @@ doinclude(Tokenrow *trp) return; syntax: error(ERROR, "Syntax error in #include"); - return; } /* @@ -121,7 +120,7 @@ genline(void) static Tokenrow tr = { &ta, &ta, &ta+1, 1 }; uchar *p; - ta.t = p = (uchar*)outp; + ta.t = p = (uchar*)outbufp; strcpy((char*)p, "#line "); p += sizeof("#line ")-1; p = (uchar*)outnum((char*)p, cursource->line); @@ -134,8 +133,8 @@ genline(void) strcpy((char*)p, cursource->filename); p += strlen((char*)p); *p++ = '"'; *p++ = '\n'; - ta.len = (char*)p-outp; - outp = (char*)p; + ta.len = (char*)p-outbufp; + outbufp = (char*)p; tr.tp = tr.bp; puttokens(&tr); } diff --git a/src/tools/lcc/cpp/macro.c b/src/tools/lcc/cpp/macro.c index 49d1129..2972083 100644 --- a/src/tools/lcc/cpp/macro.c +++ b/src/tools/lcc/cpp/macro.c @@ -218,7 +218,6 @@ expand(Tokenrow *trp, Nlist *np) insertrow(trp, ntokc, &ntr); trp->tp -= rowlen(&ntr); dofree(ntr.bp); - return; } /* @@ -471,10 +470,10 @@ builtin(Tokenrow *trp, int biname) /* most are strings */ tp->type = STRING; if (tp->wslen) { - *outp++ = ' '; + *outbufp++ = ' '; tp->wslen = 1; } - op = outp; + op = outbufp; *op++ = '"'; switch (biname) { @@ -509,7 +508,7 @@ builtin(Tokenrow *trp, int biname) } if (tp->type==STRING) *op++ = '"'; - tp->t = (uchar*)outp; - tp->len = op - outp; - outp = op; + tp->t = (uchar*)outbufp; + tp->len = op - outbufp; + outbufp = op; } diff --git a/src/tools/lcc/cpp/nlist.c b/src/tools/lcc/cpp/nlist.c index d76df86..d3a8357 100644 --- a/src/tools/lcc/cpp/nlist.c +++ b/src/tools/lcc/cpp/nlist.c @@ -29,6 +29,7 @@ struct kwtab { {"define", KDEFINE, ISKW}, {"undef", KUNDEF, ISKW}, {"line", KLINE, ISKW}, + {"warning", KWARNING, ISKW}, {"error", KERROR, ISKW}, {"pragma", KPRAGMA, ISKW}, {"eval", KEVAL, ISKW}, diff --git a/src/tools/lcc/cpp/tokens.c b/src/tools/lcc/cpp/tokens.c index 147569b..3570896 100644 --- a/src/tools/lcc/cpp/tokens.c +++ b/src/tools/lcc/cpp/tokens.c @@ -267,7 +267,7 @@ peektokens(Tokenrow *trp, char *str) if (str) fprintf(stderr, "%s ", str); if (tpbp || tp>trp->lp) - fprintf(stderr, "(tp offset %d) ", tp-trp->bp); + fprintf(stderr, "(tp offset %ld) ", (long int) (tp - trp->bp)); for (tp=trp->bp; tplp && tpbp+32; tp++) { if (tp->type!=NL) { int c = tp->t[tp->len]; diff --git a/src/tools/lcc/cpp/unix.c b/src/tools/lcc/cpp/unix.c index 17986d8..75e5b6d 100644 --- a/src/tools/lcc/cpp/unix.c +++ b/src/tools/lcc/cpp/unix.c @@ -2,6 +2,7 @@ #include #include #include +#include #include "cpp.h" extern int lcc_getopt(int, char *const *, const char *); @@ -66,7 +67,12 @@ setup(int argc, char **argv) error(FATAL, "Can't open input file %s", fp); } if (optind+1