diff options
author | Thomas E. Dickey <dickey@invisible-island.net> | 2024-03-05 05:24:05 -0500 |
---|---|---|
committer | Thomas E. Dickey <dickey@invisible-island.net> | 2024-03-05 05:33:38 -0500 |
commit | 73c4cf88f3bf4094fd12cffec0147b957ad1e9c6 (patch) | |
tree | 4298309ebce9cb480a5bbab2003104f1eb548d40 | |
parent | c2833e0c97f491a1acc87abe09adcd2b3f937688 (diff) |
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 <dickey@invisible-island.net>
-rw-r--r-- | src/parse.h | 13 |
1 files changed, 13 insertions, 0 deletions
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); |