diff options
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/yacc/output.c | 8 | ||||
-rw-r--r-- | usr.bin/yacc/reader.c | 7 |
2 files changed, 11 insertions, 4 deletions
diff --git a/usr.bin/yacc/output.c b/usr.bin/yacc/output.c index 6f143af511f..2c18431e6dc 100644 --- a/usr.bin/yacc/output.c +++ b/usr.bin/yacc/output.c @@ -1,4 +1,4 @@ -/* $OpenBSD: output.c,v 1.11 2003/06/19 16:34:53 pvalchev Exp $ */ +/* $OpenBSD: output.c,v 1.12 2004/01/06 05:35:26 deraadt Exp $ */ /* $NetBSD: output.c,v 1.4 1996/03/19 03:21:41 jtc Exp $ */ /* @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)output.c 5.7 (Berkeley) 5/24/93"; #else -static char rcsid[] = "$OpenBSD: output.c,v 1.11 2003/06/19 16:34:53 pvalchev Exp $"; +static char rcsid[] = "$OpenBSD: output.c,v 1.12 2004/01/06 05:35:26 deraadt Exp $"; #endif #endif /* not lint */ @@ -948,7 +948,9 @@ output_defines(void) if (union_file == NULL) open_error(union_file_name); while ((c = getc(union_file)) != EOF) putc(c, defines_file); - fprintf(defines_file, " YYSTYPE;\nextern YYSTYPE %slval;\n", + fprintf(defines_file, " YYSTYPE;\n"); + fprintf(defines_file, "#endif /* YYSTYPE_DEFINED */\n"); + fprintf(defines_file, "extern YYSTYPE %slval;\n", symbol_prefix); } } diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c index 9042f23385d..f492aefd25e 100644 --- a/usr.bin/yacc/reader.c +++ b/usr.bin/yacc/reader.c @@ -1,4 +1,4 @@ -/* $OpenBSD: reader.c,v 1.15 2003/06/19 16:34:53 pvalchev Exp $ */ +/* $OpenBSD: reader.c,v 1.16 2004/01/06 05:35:26 deraadt Exp $ */ /* $NetBSD: reader.c,v 1.5 1996/03/19 03:21:43 jtc Exp $ */ /* @@ -531,7 +531,11 @@ copy_union(void) if (!lflag) fprintf(text_file, line_format, lineno, input_file_name); + fprintf(text_file, "#ifndef YYSTYPE_DEFINED\n"); + fprintf(text_file, "#define YYSTYPE_DEFINED\n"); fprintf(text_file, "typedef union"); + if (dflag) fprintf(union_file, "#ifndef YYSTYPE_DEFINED\n"); + if (dflag) fprintf(union_file, "#define YYSTYPE_DEFINED\n"); if (dflag) fprintf(union_file, "typedef union"); depth = 0; @@ -555,6 +559,7 @@ loop: if (--depth == 0) { fprintf(text_file, " YYSTYPE;\n"); + fprintf(text_file, "#endif /* YYSTYPE_DEFINED */\n"); FREE(u_line); return; } |