From ea4bc4aad22455f8f37030f5915c4a94d76fd5e7 Mon Sep 17 00:00:00 2001
From: "mark.yang" <mark.yang@lge.com>
Date: Mon, 7 Apr 2025 18:57:26 +0900
Subject: [PATCH] Fix build failure with gcc-15

* see more details: http://errors.yoctoproject.org/Errors/Details/851179/

yang-data.c:594:9: error: too many arguments to function 'yangparse'; expected 0, have 1
  594 |         yangparse(parser);
      |         ^~~~~~~~~ ~~~~~~
In file included from scanner-yang.h:19,
                 from yang-data.c:47:
parser-yang.h:16:12: note: declared here
   16 | extern int yangparse();
      |            ^~~~~~~~~
In file included from parser-yang.c:346:
parser-yang.tab.h:170:5: error: conflicting types for 'yangparse'; have 'int(struct Parser *)'
  170 | int yangparse (struct Parser *parserPtr);
      |     ^~~~~~~~~
In file included from parser-yang.y:40:
parser-yang.h:16:12: note: previous declaration of 'yangparse' with type 'int(void)'
   16 | extern int yangparse();
      |            ^~~~~~~~~
make[2]: *** [Makefile:573: yang-data.lo] Error 1
make[2]: *** Waiting for unfinished jobs....
smi-data.c: In function 'loadModule':
smi-data.c:4658:9: error: too many arguments to function 'smiparse'; expected 0, have 1
 4658 |         smiparse((void *)&parser);
      |         ^~~~~~~~ ~~~~~~~~~~~~~~~
smi-data.c:42:12: note: declared here
   42 | extern int smiparse();
      |            ^~~~~~~~
parser-smi.c:1515:5: error: conflicting types for 'smiparse'; have 'int(struct Parser *)'
 1515 | int smiparse (struct Parser *parserPtr);
      |     ^~~~~~~~
In file included from parser-smi.y:37:
parser-smi.h:27:12: note: previous declaration of 'smiparse' with type 'int(void)'
   27 | extern int smiparse();
      |            ^~~~~~~~
parser-smi.c:63:25: error: conflicting types for 'smiparse'; have 'int(struct Parser *)'
   63 | #define yyparse         smiparse
      |                         ^~~~~~~~
parser-smi.c:3207:1: note: in expansion of macro 'yyparse'
 3207 | yyparse (struct Parser *parserPtr)
      | ^~~~~~~
parser-smi.h:27:12: note: previous declaration of 'smiparse' with type 'int(void)'
   27 | extern int smiparse();
      |            ^~~~~~~~
parser-yang.c:68:25: error: conflicting types for 'yangparse'; have 'int(struct Parser *)'
   68 | #define yyparse         yangparse
      |                         ^~~~~~~~~
parser-yang.c:2312:1: note: in expansion of macro 'yyparse'
 2312 | yyparse (struct Parser *parserPtr)
      | ^~~~~~~
parser-yang.h:16:12: note: previous declaration of 'yangparse' with type 'int(void)'
   16 | extern int yangparse();
      |            ^~~~~~~~~
In file included from scanner-yang.l:31:
parser-yang.tab.h:170:5: error: conflicting types for 'yangparse'; have 'int(struct Parser *)'
  170 | int yangparse (struct Parser *parserPtr);
      |     ^~~~~~~~~
In file included from scanner-yang.l:30:
parser-yang.h:16:12: note: previous declaration of 'yangparse' with type 'int(void)'
   16 | extern int yangparse();
      |            ^~~~~~~~~
scanner-yang.l: In function 'yangEnterLexRecursion':
scanner-yang.l:79:1: warning: old-style function definition [-Wold-style-definition]
   79 |
      | ^
make[2]: *** [Makefile:573: smi-data.lo] Error 1
In file included from parser-smi.y:36:
parser-smi.c: In function 'smiparse':
parser-smi.c:10265:29: warning: passing argument 1 of 'smiyyerror' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
10265 |         yyerror (parserPtr, yymsgp);
      |                             ^~~~~~
error.h:25:44: note: in definition of macro 'yyerror'
   25 | #define yyerror(parserPtr, msg) smiyyerror(msg, parserPtr)
      |                                            ^~~
In file included from parser-smi.y:40:
smi-check.h:71:30: note: expected 'char *' but argument is of type 'const char *'
   71 | extern void smiyyerror(char *msg, Parser *parserPtr);
      |                        ~~~~~~^~~
make[2]: *** [Makefile:573: parser-yang.lo] Error 1
make[2]: *** [Makefile:573: parser-smi.lo] Error 1
make[2]: *** [Makefile:573: scanner-yang.lo] Error 1
In file included from scanner-smi.l:34:
parser-smi.tab.h:192:5: error: conflicting types for 'smiparse'; have 'int(struct Parser *)'
  192 | int smiparse (struct Parser *parserPtr);
      |     ^~~~~~~~
In file included from util.h:22,
                 from scanner-smi.l:32:
parser-smi.h:27:12: note: previous declaration of 'smiparse' with type 'int(void)'
   27 | extern int smiparse();
      |            ^~~~~~~~
scanner-smi.l: In function 'smiEnterLexRecursion':
scanner-smi.l:76:1: warning: old-style function definition [-Wold-style-definition]
   76 | smiEnterLexRecursion(file)
      | ^~~~~~~~~~~~~~~~~~~~

Upstream-Status: Submitted [https://lists.ibr.cs.tu-bs.de/hyperkitty/list/libsmi@ibr.cs.tu-bs.de/thread/XUW4E575ALYHCAM33OEMU5V2LKUOYAVA/]
Signed-off-by: mark.yang <mark.yang@lge.com>
---
 lib/parser-smi.h  | 2 +-
 lib/parser-yang.h | 4 ++--
 lib/smi-data.c    | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/lib/parser-smi.h b/lib/parser-smi.h
index 90d7ec2..c2a3d1f 100644
--- a/lib/parser-smi.h
+++ b/lib/parser-smi.h
@@ -24,7 +24,7 @@
 
 
 
-extern int smiparse();
+extern int smiparse(struct Parser *parserPtr);
 
 
 
diff --git a/lib/parser-yang.h b/lib/parser-yang.h
index dbfec46..f008cd6 100644
--- a/lib/parser-yang.h
+++ b/lib/parser-yang.h
@@ -6,14 +6,14 @@
 #include <stdio.h>
 
 #include "yang-data.h"
-
+#include "smi-data.h"
 
 
 #define YYERROR_VERBOSE
 
 
 
-extern int yangparse();
+extern int yangparse(struct Parser *parserPtr);
 
 
 
diff --git a/lib/smi-data.c b/lib/smi-data.c
index c9d95a4..773bc01 100644
--- a/lib/smi-data.c
+++ b/lib/smi-data.c
@@ -39,7 +39,7 @@
 
 #ifdef BACKEND_SMI
 #include "scanner-smi.h"
-extern int smiparse();
+extern int smiparse(struct Parser *parserPtr);
 #endif
 
 #ifdef BACKEND_SMING
