From e8c280034fad30d5234590ac3c62ebd0fe3d25dd Mon Sep 17 00:00:00 2001 From: Brian Kernighan Date: Thu, 25 Oct 2018 13:28:54 -0400 Subject: [PATCH] fix maketab non-bug --- FIXES | 5 +++++ makefile | 4 ++-- maketab.c | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/FIXES b/FIXES index d414c6d..909afb7 100644 --- a/FIXES +++ b/FIXES @@ -25,6 +25,11 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the AWK book was sent to the printers in August, 1987. +Oct 25, 2018: + Added test in maketab.c to prevent generating a proctab entry + for YYSTYPE_IS_DEFINED. It was harmless but some gcc settings + generated a warning message. Thanks to Nan Xiao for report. + Aug 27, 2018: Disallow '$' in printf formats; arguments evaluated in order and printed in order. diff --git a/makefile b/makefile index ae80e4d..e0a43da 100644 --- a/makefile +++ b/makefile @@ -34,8 +34,8 @@ CC = gcc -g -Wall -pedantic # yacc options. pick one; this varies a lot by system. #YFLAGS = -d -S -#YACC = bison -d -y -YACC = yacc -d +YACC = bison -d -y +#YACC = yacc -d # -S uses sprintf in yacc parser instead of sprint OFILES = b.o main.o parse.o proctab.o tran.o lib.o run.o lex.o diff --git a/maketab.c b/maketab.c index e23974c..bb8e317 100644 --- a/maketab.c +++ b/maketab.c @@ -135,6 +135,8 @@ int main(int argc, char *argv[]) n = sscanf(buf, "%1c %s %s %d", &c, def, name, &tok); if (c != '#' || (n != 4 && strcmp(def,"define") != 0)) /* not a valid #define */ continue; + if (strcmp(name, "YYSTYPE_IS_DECLARED") == 0) + continue; if (tok < FIRSTTOKEN || tok > LASTTOKEN) { /* fprintf(stderr, "maketab funny token %d %s ignored\n", tok, buf); */ continue;