diff options
author | Tsukasa OI <research_trasio@irq.a4lg.com> | 2022-09-24 09:49:42 +0000 |
---|---|---|
committer | Tsukasa OI <research_trasio@irq.a4lg.com> | 2022-10-29 08:13:15 +0000 |
commit | e47530f72f587550b1ff2f2adcfa4f64ec702d82 (patch) | |
tree | 44d9c2d25efee2b407f1f64f9cc7aa9acbf2611a /sim/erc32 | |
parent | dc4e697f2fec232cecfd1d162365ce836c785369 (diff) | |
download | gdb-e47530f72f587550b1ff2f2adcfa4f64ec702d82.zip gdb-e47530f72f587550b1ff2f2adcfa4f64ec702d82.tar.gz gdb-e47530f72f587550b1ff2f2adcfa4f64ec702d82.tar.bz2 |
sim/erc32: Use int32_t as event callback argument
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. int32_t is chosen because "event" function
accepts "int32_t arg".
Diffstat (limited to 'sim/erc32')
-rw-r--r-- | sim/erc32/README.sis | 4 | ||||
-rw-r--r-- | sim/erc32/erc32.c | 28 | ||||
-rw-r--r-- | sim/erc32/func.c | 10 | ||||
-rw-r--r-- | sim/erc32/sis.h | 4 |
4 files changed, 23 insertions, 23 deletions
diff --git a/sim/erc32/README.sis b/sim/erc32/README.sis index b119f03..b85479e 100644 --- a/sim/erc32/README.sis +++ b/sim/erc32/README.sis @@ -241,8 +241,8 @@ interrupts. The following functions are available to the user-defined memory module: event(cfunc,arg,delta) -void (*cfunc)(); -int arg; +void (*cfunc)(int32_t); +int32_t arg; unsigned int delta; set_int(level,callback,arg) diff --git a/sim/erc32/erc32.c b/sim/erc32/erc32.c index 0206c02..d7cc1f1 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 af92c9f..85d3c0c 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; @@ -825,7 +825,7 @@ dis_mem(uint32_t addr, uint32_t len, struct disassemble_info *info) /* Add event to event queue */ void -event(void (*cfunc) (), int32_t arg, uint64_t delta) +event(void (*cfunc) (int32_t), int32_t arg, uint64_t delta) { struct evcell *ev1, *evins; @@ -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 7103313..36346ca 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); |