[10/40] sim/erc32: Use int32_t as IRQ callback argument

Message ID 8c05aec20557191434485be347d37177a2ec5ff2.1666258361.git.research_trasio@irq.a4lg.com
State Committed
Series sim+gdb: Suppress warnings if built with Clang (big batch 1) |

Commit Message

Tsukasa OI Oct. 20, 2022, 9:32 a.m. UTC
  Clang generates a warning if an argument is passed to a function without
prototype (zero arguments, even without (void)).  Such calls are deprecated
forms of indefinite arguments passing ("-Wdeprecated-non-prototype").
On the default configuration, it (somehow) doesn't cause a build failure but
a warning is generated.

But because the cause is the same as the issue the author fixed in
"sim/erc32: Use int32_t as event callback argument", it would be better to
fix it now to prevent problems in the future.

To fix the issue, this commit makes struct irqcall to use int32_t as a
callback (callback) argument of an IRQ.
 sim/erc32/func.c | 2 +-
 sim/erc32/sis.h  | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)


Mike Frysinger Oct. 23, 2022, 2:33 p.m. UTC | #1


diff --git a/sim/erc32/func.c b/sim/erc32/func.c
index 6971ae0129d..527df172660 100644
--- a/sim/erc32/func.c
+++ b/sim/erc32/func.c
@@ -874,7 +874,7 @@  init_event(void)
-set_int(int32_t level, void (*callback) (), int32_t arg)
+set_int(int32_t level, void (*callback) (int32_t), int32_t arg)
     irqarr[level & 0x0f].callback = callback;
     irqarr[level & 0x0f].arg = arg;
diff --git a/sim/erc32/sis.h b/sim/erc32/sis.h
index 36346cae641..df6b22c47b0 100644
--- a/sim/erc32/sis.h
+++ b/sim/erc32/sis.h
@@ -137,7 +137,7 @@  struct estate {
 struct irqcell {
-    void            (*callback) ();
+    void            (*callback) (int32_t);
     int32_t           arg;
@@ -184,7 +184,7 @@  struct disassemble_info;
 extern void	dis_mem (uint32_t addr, uint32_t len,
 			 struct disassemble_info *info);
 extern void	event (void (*cfunc) (int32_t), int32_t arg, uint64_t delta);
-extern void	set_int (int32_t level, void (*callback) (), int32_t arg);
+extern void	set_int (int32_t level, void (*callback) (int32_t), int32_t arg);
 extern void	advance_time (struct pstate  *sregs);
 extern uint32_t	now (void);
 extern int	wait_for_irq (void);