diff mbox series

[1/1] target/hexagon: work around unused variable in yyparser

Message ID 20221231091935.152590-1-zongyuan.li@smartx.com (mailing list archive)
State New, archived
Headers show
Series [1/1] target/hexagon: work around unused variable in yyparser | expand

Commit Message

Zongyuan Li Dec. 31, 2022, 9:19 a.m. UTC
Variable 'yynerrs' is recognized as unused variable in clang15,
which is auto-generated by bison in parser file, as long as user
code doesn't access it in '.y'. This is already fixed in bison 8.2.
But for user who use latest clang, a simple harmless code piece
would fix this building error.

FYI: bison patch link
https://mail.gnu.org/archive/html/bison-patches/2022-08/msg00006.html

Signed-off-by: Zongyuan Li <zongyuan.li@smartx.com>
---
 target/hexagon/idef-parser/idef-parser.y | 3 +++
 1 file changed, 3 insertions(+)

Comments

Alessandro Di Federico Dec. 31, 2022, 12:48 p.m. UTC | #1
On Sat, 31 Dec 2022 17:19:35 +0800
Zongyuan Li <zongyuan.li@smartx.com> wrote:

> Variable 'yynerrs' is recognized as unused variable in clang15,

This issue is already handled by another similar patch (target/hexagon:
suppress unused variable warning) that will soon end up in a pull
request.

Thanks for looking into this though.
diff mbox series

Patch

diff --git a/target/hexagon/idef-parser/idef-parser.y b/target/hexagon/idef-parser/idef-parser.y
index 8be44a0ad1..07aa105aa2 100644
--- a/target/hexagon/idef-parser/idef-parser.y
+++ b/target/hexagon/idef-parser/idef-parser.y
@@ -99,6 +99,9 @@ 
 /* Input file containing the description of each hexagon instruction */
 input : instructions
       {
+          if (yynerrs != 0) {
+              YYABORT;
+          }
           YYACCEPT;
       }
       ;