summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorQuentin Carbonneaux2015-03-09 12:15:43 -0400
committerQuentin Carbonneaux2015-03-09 12:15:43 -0400
commit170e1f9248884b855e1c278f978a6a35b0faf84e (patch)
tree63b30e4cbb879a7b1023d594a9e2307e6ff7af18
parentbaffac8b22758f2ea150eedfc10ad28f73e99c26 (diff)
add default definition of YYSTYPE in .tab.h
-rw-r--r--myacc.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/myacc.c b/myacc.c
index 990015f..13cae7e 100644
--- a/myacc.c
+++ b/myacc.c
@@ -692,9 +692,12 @@ tblout()
}
aout("yytrns", o, m);
if (fhdr) {
- fprintf(fhdr, "int yyparse(void);\n");
- fprintf(fhdr, "extern YYSTYPE yylval;\n");
- fprintf(fhdr, "#endif\n");
+ fputs("int yyparse(void);\n", fhdr);
+ fputs("#ifndef YYSTYPE\n", fhdr);
+ fputs("#define YYSTYPE int\n", fhdr);
+ fputs("#endif\n", fhdr);
+ fputs("extern YYSTYPE yylval;\n", fhdr);
+ fputs("#endif\n", fhdr);
}
free(o);
}