public inbox for binutils@sourceware.org
 help / color / mirror / Atom feed
From: Tsukasa OI <research_trasio@irq.a4lg.com>
To: Tsukasa OI <research_trasio@irq.a4lg.com>,
	Andrew Burgess <aburgess@redhat.com>,
	Mike Frysinger <vapier@gentoo.org>,
	Nick Clifton <nickc@redhat.com>
Cc: binutils@sourceware.org
Subject: [PATCH 09/40] sim/erc32: Use int32_t as event callback argument
Date: Thu, 20 Oct 2022 09:25:55 +0000	[thread overview]
Message-ID: <057c2f8392410494c3bc5dc98052246508e6a73e.1666257885.git.research_trasio@irq.a4lg.com> (raw)
In-Reply-To: <cover.1666257885.git.research_trasio@irq.a4lg.com>

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 causes a build failure (unless
"--disable-werror" is specified).

To fix that, this commit makes struct evcell to use int32_t as a callback
(cfunc) argument of an event.
---
 sim/erc32/erc32.c | 28 ++++++++++++++--------------
 sim/erc32/func.c  |  8 ++++----
 sim/erc32/sis.h   |  4 ++--
 3 files changed, 20 insertions(+), 20 deletions(-)

diff --git a/sim/erc32/erc32.c b/sim/erc32/erc32.c
index 0206c02e6f0..d7cc1f1cf3b 100644
--- a/sim/erc32/erc32.c
+++ b/sim/erc32/erc32.c
@@ -274,19 +274,19 @@ static void	port_init (void);
 static uint32_t	read_uart (uint32_t addr);
 static void	write_uart (uint32_t addr, uint32_t data);
 static void	flush_uart (void);
-static void	uarta_tx (void);
-static void	uartb_tx (void);
-static void	uart_rx (void *arg);
-static void	uart_intr (void *arg);
+static void	uarta_tx (int32_t);
+static void	uartb_tx (int32_t);
+static void	uart_rx (int32_t);
+static void	uart_intr (int32_t);
 static void	uart_irq_start (void);
-static void	wdog_intr (void *arg);
+static void	wdog_intr (int32_t);
 static void	wdog_start (void);
-static void	rtc_intr (void *arg);
+static void	rtc_intr (int32_t);
 static void	rtc_start (void);
 static uint32_t	rtc_counter_read (void);
 static void	rtc_scaler_set (uint32_t val);
 static void	rtc_reload_set (uint32_t val);
-static void	gpt_intr (void *arg);
+static void	gpt_intr (int32_t);
 static void	gpt_start (void);
 static uint32_t	gpt_counter_read (void);
 static void	gpt_scaler_set (uint32_t val);
@@ -1245,7 +1245,7 @@ flush_uart(void)
 
 ATTRIBUTE_UNUSED
 static void
-uarta_tx(void)
+uarta_tx(int32_t arg ATTRIBUTE_UNUSED)
 {
 
     while (f1open && fwrite(&uarta_sreg, 1, 1, f1out) != 1);
@@ -1261,7 +1261,7 @@ uarta_tx(void)
 
 ATTRIBUTE_UNUSED
 static void
-uartb_tx(void)
+uartb_tx(int32_t arg ATTRIBUTE_UNUSED)
 {
     while (f2open && fwrite(&uartb_sreg, 1, 1, f2out) != 1);
     if (uart_stat_reg & UARTB_HRE) {
@@ -1276,7 +1276,7 @@ uartb_tx(void)
 
 ATTRIBUTE_UNUSED
 static void
-uart_rx(void *arg)
+uart_rx(int32_t arg ATTRIBUTE_UNUSED)
 {
     int32_t           rsize;
     char            rxd;
@@ -1318,7 +1318,7 @@ uart_rx(void *arg)
 }
 
 static void
-uart_intr(void *arg)
+uart_intr(int32_t arg ATTRIBUTE_UNUSED)
 {
     read_uart(0xE8);		/* Check for UART interrupts every 1000 clk */
     flush_uart();		/* Flush UART ports      */
@@ -1341,7 +1341,7 @@ uart_irq_start(void)
 /* Watch-dog */
 
 static void
-wdog_intr(void *arg)
+wdog_intr(int32_t arg ATTRIBUTE_UNUSED)
 {
     if (wdog_status == disabled) {
 	wdog_status = stopped;
@@ -1379,7 +1379,7 @@ wdog_start(void)
 
 
 static void
-rtc_intr(void *arg)
+rtc_intr(int32_t arg ATTRIBUTE_UNUSED)
 {
     if (rtc_counter == 0) {
 
@@ -1430,7 +1430,7 @@ rtc_reload_set(uint32_t val)
 }
 
 static void
-gpt_intr(void *arg)
+gpt_intr(int32_t arg ATTRIBUTE_UNUSED)
 {
     if (gpt_counter == 0) {
 	mec_irq(12);
diff --git a/sim/erc32/func.c b/sim/erc32/func.c
index af92c9f7d48..6971ae0129d 100644
--- a/sim/erc32/func.c
+++ b/sim/erc32/func.c
@@ -298,7 +298,7 @@ disp_reg(struct pstate *sregs, char *reg)
 #ifdef ERRINJ
 
 void
-errinj (void)
+errinj (int32_t arg ATTRIBUTE_UNUSED)
 {
     int	err;
 
@@ -887,8 +887,8 @@ advance_time(struct pstate *sregs)
 {
 
     struct evcell  *evrem;
-    void            (*cfunc) ();
-    uint32_t          arg;
+    void            (*cfunc) (int32_t);
+    int32_t           arg;
     uint64_t          endtime;
 
 #ifdef STAT
@@ -926,7 +926,7 @@ int
 wait_for_irq(void)
 {
     struct evcell  *evrem;
-    void            (*cfunc) ();
+    void            (*cfunc) (int32_t);
     int32_t           arg;
     uint64_t          endtime;
 
diff --git a/sim/erc32/sis.h b/sim/erc32/sis.h
index 71033137f2c..36346cae641 100644
--- a/sim/erc32/sis.h
+++ b/sim/erc32/sis.h
@@ -124,7 +124,7 @@ struct pstate {
 };
 
 struct evcell {
-    void            (*cfunc) ();
+    void            (*cfunc) (int32_t);
     int32_t           arg;
     uint64_t          time;
     struct evcell  *nxt;
@@ -183,7 +183,7 @@ extern void	init_signals (void);
 struct disassemble_info;
 extern void	dis_mem (uint32_t addr, uint32_t len,
 			 struct disassemble_info *info);
-extern void	event (void (*cfunc) (), int32_t arg, uint64_t delta);
+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	advance_time (struct pstate  *sregs);
 extern uint32_t	now (void);
-- 
2.34.1


  parent reply	other threads:[~2022-10-20  9:28 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-20  9:25 [PATCH 00/40] sim+gdb: Suppress warnings if built with Clang (big batch 1) Tsukasa OI
2022-10-20  9:25 ` [PATCH 01/40] gdb/unittests: PR28413, suppress warnings generated by Gnulib Tsukasa OI
2022-10-20  9:25 ` [PATCH 02/40] sim: Check known getrusage declaration existence Tsukasa OI
2022-10-20  9:25 ` [PATCH 03/40] sim/aarch64: Remove unused functions Tsukasa OI
2022-10-20  9:25 ` [PATCH 04/40] cpu/cris: Initialize some variables on CRIS CPU Tsukasa OI
2022-10-22  1:59   ` Hans-Peter Nilsson
2022-10-20  9:25 ` [PATCH 05/40] cpu/cris: Add u-stall virtual unit to CRIS v32 Tsukasa OI
2022-10-22  1:44   ` Hans-Peter Nilsson
2022-10-20  9:25 ` [PATCH 06/40] sim/cris: Move declarations of f_specific_init Tsukasa OI
2022-10-22  1:46   ` Hans-Peter Nilsson
2022-10-20  9:25 ` [PATCH 07/40] sim/cris: Regenerate with CGEN Tsukasa OI
2022-10-22  2:02   ` Hans-Peter Nilsson
2022-10-20  9:25 ` [PATCH 08/40] sim/erc32: Insert void parameter Tsukasa OI
2022-10-20  9:25 ` Tsukasa OI [this message]
2022-10-20  9:25 ` [PATCH 10/40] sim/erc32: Use int32_t as IRQ callback argument Tsukasa OI
2022-10-20  9:25 ` [PATCH 11/40] cpu/frv: Initialize some variables Tsukasa OI
2022-10-20  9:25 ` [PATCH 12/40] sim/frv: Initialize nesr variable Tsukasa OI
2022-10-20  9:25 ` [PATCH 13/40] sim/frv: Initialize some variables Tsukasa OI
2022-10-20  9:26 ` [PATCH 14/40] sim/frv: Add explicit casts Tsukasa OI
2022-10-20  9:26 ` [PATCH 15/40] sim/h8300: Add "+ 0x0" to avoid self-assignments Tsukasa OI
2022-10-25 13:54   ` Jeff Law
2022-10-20  9:26 ` [PATCH 16/40] sim/lm32: fix some missing function declaration warnings Tsukasa OI
2022-10-20  9:26 ` [PATCH 17/40] sim/lm32: Add explicit casts Tsukasa OI
2022-10-20  9:32 ` [PATCH 00/40] sim+gdb: Suppress warnings if built with Clang (big batch 1) Tsukasa OI
2022-10-22 19:01 ` Mike Frysinger
2022-10-24  7:59   ` Tsukasa OI

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=057c2f8392410494c3bc5dc98052246508e6a73e.1666257885.git.research_trasio@irq.a4lg.com \
    --to=research_trasio@irq.a4lg.com \
    --cc=aburgess@redhat.com \
    --cc=binutils@sourceware.org \
    --cc=nickc@redhat.com \
    --cc=vapier@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).