scc

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

commit aa6b39201b88573be81bdadf82bd8c315221fa88
parent d93d39b724055b9e8b8f342481308d0e0f634b7a
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Sun, 26 Aug 2012 15:18:28 +0200

Removed TOKSIZ_MAX macro

It is removed because we already have other macro, IDENTSIZ, which should be
used instead of this other. IDENTSIZ is defined in sizes.h with other
ANSI-C implementation sizes or limits.

Diffstat:
Mlex.c | 16++++++++--------
Mtokens.h | 3---
2 files changed, 8 insertions(+), 11 deletions(-)

diff --git a/lex.c b/lex.c @@ -7,17 +7,17 @@ #include "cc.h" #include "tokens.h" #include "symbol.h" +#include "sizes.h" - -static FILE *yyin; union yyval yyval; -static unsigned char aheadtok = NOTOK; unsigned char yytoken; -char yytext[TOKSIZ_MAX + 1]; +char yytext[IDENTSIZ + 1]; unsigned linenum; unsigned columnum; const char *filename; +static FILE *yyin; +static unsigned char aheadtok = NOTOK; static char number(void) @@ -25,11 +25,11 @@ number(void) register char *bp; register char ch; - for (bp = yytext; bp < yytext + TOKSIZ_MAX; *bp++ = ch) { + for (bp = yytext; bp < yytext + IDENTSIZ; *bp++ = ch) { if (!isdigit(ch = getc(yyin))) break; } - if (bp == yytext + TOKSIZ_MAX) + if (bp == yytext + IDENTSIZ) error("identifier too long %s", yytext); *bp = '\0'; ungetc(ch, yyin); @@ -45,11 +45,11 @@ iden(void) register char ch, *bp; register struct symbol *sym; - for (bp = yytext; bp < yytext + TOKSIZ_MAX; *bp++ = ch) { + for (bp = yytext; bp < yytext + IDENTSIZ; *bp++ = ch) { if (!isalnum(ch = getc(yyin)) && ch != '_') break; } - if (bp == yytext + TOKSIZ_MAX) + if (bp == yytext + IDENTSIZ) error("identifier too long %s", yytext); *bp = '\0'; ungetc(ch, yyin); diff --git a/tokens.h b/tokens.h @@ -2,9 +2,6 @@ #define TOKENS_H - -#define TOKSIZ_MAX 21 - /* Don't change this codification because program used it!!! */ enum tokens { /* types */