From 73c4cf88f3bf4094fd12cffec0147b957ad1e9c6 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Tue, 5 Mar 2024 05:24:05 -0500 Subject: improve portability for bison/byacc Provide declaration of yyparse(), and alternate declaration of yylex(). This works with bison and byacc, as well as different versions of flex. Signed-off-by: Thomas E. Dickey --- src/parse.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/parse.h b/src/parse.h index f66bf06..88b1118 100644 --- a/src/parse.h +++ b/src/parse.h @@ -63,8 +63,21 @@ in this Software without prior written authorization from The Open Group. #include "list.h" #include "gram.h" +/* + * POSIX does not say where yyparse() is declared. bison puts it in its + * generated header, while byacc does not. This chunk helps with portability. + */ +#if !(defined(YYDEBUG) && defined(YY_YY_GRAM_H_INCLUDED)) && !defined(YYBYACC) +extern int yyparse(void); +#endif + +/* + * Some versions of byacc and flex declare yylex(). This chunk fixes that. + */ +#if !(defined(YYBYACC) || defined(YYLEX_DECL)) #define YY_DECL int yylex (void) YY_DECL; +#endif extern void assign_var_savecolor(void); extern int do_single_keyword(int keyword); -- cgit v1.2.3