Skip to contentSkip to conversation

target/hexagon: suppress unused variable warning

PATCH Superseded Alessandro Di Federico via 4 participants 4 messages Dec 21, 2022 Arm/Amlogic Meson SoC support

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 target/hexagon: suppress unused variable warning

This patch manually suppresses a warning for an unused variable (yynerrs) emitted by bison.

This warning has been triggered for the first time by clang 15.

This patch also disables -Wextra, which is not usually adopted in QEMU. However, clang 15 triggers the warning fixed in this patch even in absence of -Wextra.

---
 target/hexagon/idef-parser/idef-parser.y | 2 ++
 target/hexagon/meson.build               | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)
target/hexagon/idef-parser/idef-parser.y +2 -0
index 8be44a0ad17..de61f48a628 100644
@@ -99,6 +99,8 @@
 /* Input file containing the description of each hexagon instruction */
 input : instructions
       {
+          // Suppress warning about unused yynerrs
+          (void) yynerrs;
           YYACCEPT;
       }
       ;
target/hexagon/meson.build +0 -1
index e8f250fcac5..c9d31d095ca 100644
@@ -197,7 +197,6 @@ if idef_parser_enabled and 'hexagon-linux-user' in target_dirs
          idef_parser_dir / 'parser-helpers.c'],
         include_directories: ['idef-parser', '../../include/'],
         dependencies: [glib_dep],
-        c_args: ['-Wextra'],
         native: true
     )
 
Signature · 1 line
2.38.1
Reviewed-by Tested-by on v1 1/1
#1 lore raw
Quoted 9 lines · Alessandro Di Federico

This patch manually suppresses a warning for an unused variable (yynerrs) emitted by bison.

This warning has been triggered for the first time by clang 15.

This patch also disables -Wextra, which is not usually adopted in QEMU. However, clang 15 triggers the warning fixed in this patch even in absence of -Wextra.

Quoted 5 lines
---
  target/hexagon/idef-parser/idef-parser.y | 2 ++
  target/hexagon/meson.build               | 1 -
  2 files changed, 2 insertions(+), 1 deletion(-)

Thanks!

Reviewed-by Tested-by on v1 1/1
#2 lore raw
In reply to Alessandro Di Federico via
Quoted 35 lines

-----Original Message-----
From: Alessandro Di Federico <[email protected]>
Sent: Wednesday, December 21, 2022 4:03 AM
To: [email protected]
Cc: Philippe Mathieu-Daudé <[email protected]>; Taylor Simpson <[email protected]>; Anton Johansson <[email protected]>; Alessandro Di Federico <[email protected]>
Subject: [PATCH] target/hexagon: suppress unused variable warning

This patch manually suppresses a warning for an unused variable (yynerrs) emitted by bison.

This warning has been triggered for the first time by clang 15.

This patch also disables -Wextra, which is not usually adopted in QEMU. However, clang 15 triggers the warning fixed in this patch even in absence of -Wextra.

---
 target/hexagon/idef-parser/idef-parser.y | 2 ++
 target/hexagon/meson.build               | 1 -
 2 files changed, 2 insertions(+), 1 deletion(-)
target/hexagon/idef- renamed from target/hexagon/idef-parser/idef-parser.y +0 -0

parser/idef-parser.y
index 8be44a0ad17..de61f48a628 100644

target/hexagon/idef-parser/idef-parser.y +0 -0
@@ -99,6 +99,8 @@
 /* Input file containing the description of each hexagon instruction */  input :

instructions

       {

target/hexagon/idef-parser/idef-parser.y line 106

Quoted 5 lines
target/hexagon/idef-parser/idef-parser.y +2 -0
+          // Suppress warning about unused yynerrs
+          (void) yynerrs;
           YYACCEPT;
       }
       ;

According to this page
https://qemu-project.gitlab.io/qemu/devel/style.html#comment-style
we should avoid // comments, and the checkpatch script will warn about this. However, checkpatch does not warn on this patch.

#3 lore raw
Quoted 7 lines · Taylor Simpson
Quoted 7 lines
target/hexagon/idef-parser/idef-parser.y +0 -0
@@ -99,6 +99,8 @@
  /* Input file containing the description of each hexagon instruction */  input :

instructions

        {

+ // Suppress warning about unused yynerrs

Quoted 8 lines
Quoted 4 lines
+          (void) yynerrs;
            YYACCEPT;
        }
        ;

According to this page
https://qemu-project.gitlab.io/qemu/devel/style.html#comment-style
we should avoid // comments, and the checkpatch script will warn about this. However, checkpatch does not warn on this patch.

It does not process *.y.

r~