Description: Fix wmlscript lexer prototype mismatch with generated parser
 Fix FTBFS with bison 3.x and C23 semantics: the reentrant bison parser
 generates a call to yylex with (yylval, yylloc, context) arguments, but
 the old empty-parameter declaration of yylex in wsint.h means "no
 arguments" under C23, causing "too many arguments to function
 'ws_yy_lex'".  Declare the proper ws_yy_lex prototype in wsgram.y and
 pass the compiler context to the lexer via %lex-param.
Author: tangxiaofeng <tangxiaofeng@kylinos.cn>
Forwarded: not-needed

--- kannel-1.4.5.orig/wmlscript/wsgram.y
+++ kannel-1.4.5/wmlscript/wsgram.y
@@ -20,6 +20,13 @@
    by using the `wserror.h' functions. */
 extern void
 ws_yy_error(YYLTYPE *locp, WsCompiler *compiler, char *msg);
+
+/* The lexer, defined in wslexer.c.  A proper prototype is required
+   here: in C23 an empty parameter list means a function taking no
+   arguments, which conflicts with the reentrant bison parser calling
+   yylex() with (yylval, yylloc, context). */
+extern int
+ws_yy_lex(YYSTYPE *yylval, YYLTYPE *yylloc, void *context);
 %}
 
 /* The possible semantic values. */
@@ -105,6 +112,10 @@ ws_yy_error(YYLTYPE *locp, WsCompiler *c
 
 %parse-param {WsCompiler *pctx}
 
+/* Pass the compiler context to the reentrant lexer, matching the
+   prototype of ws_yy_lex() in wslexer.c. */
+%lex-param {WsCompiler *pctx}
+
 /* This grammar has one shift-reduce conflict.  It comes from the
    if-else statement. */
 %expect 1
--- kannel-1.4.5.orig/wmlscript/wsint.h
+++ kannel-1.4.5/wmlscript/wsint.h
@@ -272,8 +272,9 @@ typedef struct WsCompilerRec WsCompiler;
 #define YYPARSE_PARAM   pctx
 #define YYLEX_PARAM     pctx
 
-/* The lexer. */
-extern int yylex();
+/* The lexer.  Its prototype with (YYSTYPE, YYLTYPE, context) arguments
+   is declared in wsgram.y: in C23 an empty parameter list means a
+   function taking no arguments, so keep no declaration here. */
 
 /* Register the lexer allocated block `ptr' to the compiler's list of
    active blocks. */

