summaryrefslogtreecommitdiffstats
path: root/usr.bin/yacc
diff options
context:
space:
mode:
Diffstat (limited to 'usr.bin/yacc')
-rw-r--r--usr.bin/yacc/skeleton.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/usr.bin/yacc/skeleton.c b/usr.bin/yacc/skeleton.c
index 90235cb..1eb07df 100644
--- a/usr.bin/yacc/skeleton.c
+++ b/usr.bin/yacc/skeleton.c
@@ -161,16 +161,27 @@ char *body[] =
"",
"#ifndef YYPARSE_PARAM",
"#define YYPARSE_PARAM",
- "#define YYPARSE_PARAM_DECL",
- "#else",
+ "#if defined(__cplusplus) || __STDC__",
+ "#define YYPARSE_PARAM_TYPE void",
+ "#else /* ! ANSI-C/C++ */",
+ "#define YYPARSE_PARAM_TYPE",
+ "#endif /* ANSI-C/C++ */",
+ "#else /* ! YYPARSE_PARAM */",
"#ifndef YYPARSE_PARAM_TYPE",
"#define YYPARSE_PARAM_TYPE void *",
"#endif",
+ "#endif /* ! YYPARSE_PARAM */",
+ "",
+ "#if defined(__cplusplus) || __STDC__",
+ "#define YYPARSE_PARAM_ARG YYPARSE_PARAM_TYPE YYPARSE_PARAM",
+ "#define YYPARSE_PARAM_DECL",
+ "#else /* ! ANSI-C/C++ */",
+ "#define YYPARSE_PARAM_ARG YYPARSE_PARAM;",
"#define YYPARSE_PARAM_DECL YYPARSE_PARAM_TYPE YYPARSE_PARAM;",
- "#endif",
+ "#endif /* ANSI-C/C++ */",
"",
"int",
- "yyparse (YYPARSE_PARAM)",
+ "yyparse (YYPARSE_PARAM_ARG)",
" YYPARSE_PARAM_DECL",
"{",
" register int yym, yyn, yystate;",
OpenPOWER on IntegriCloud