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

2022-12-31 Thread Alessandro Di Federico via
On Sat, 31 Dec 2022 17:19:35 +0800
Zongyuan Li  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.

-- 
Alessandro Di Federico
rev.ng Labs



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

2022-12-31 Thread Zongyuan Li
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/msg6.html

Signed-off-by: Zongyuan Li 
---
 target/hexagon/idef-parser/idef-parser.y | 3 +++
 1 file changed, 3 insertions(+)

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;
   }
   ;
-- 
2.38.1