public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: gdb-patches@sourceware.org
Cc: Tom Tromey <tom@tromey.com>
Subject: [PATCH 1/2] Do not use old-style definitions in sim
Date: Thu,  8 Apr 2021 10:44:35 -0600	[thread overview]
Message-ID: <20210408164436.2165323-2-tom@tromey.com> (raw)
In-Reply-To: <20210408164436.2165323-1-tom@tromey.com>

This changes all the non-generated (hand-written) code in sim to use
"new" (post-K&R) style function definitions.

sim/bpf/ChangeLog
2021-04-08  Tom Tromey  <tom@tromey.com>

	* bpf.c (bpf_def_model_init): Use new-style declaration.

sim/common/ChangeLog
2021-04-08  Tom Tromey  <tom@tromey.com>

	* cgen-utils.c (RORQI, ROLQI, RORHI, ROLHI, RORSI, ROLSI): Use
	new-style declaration.

sim/erc32/ChangeLog
2021-04-08  Tom Tromey  <tom@tromey.com>

	* sis.c (run_sim, main): Use new-style declaration.
	* interf.c (run_sim, sim_open, sim_close, sim_load)
	(sim_create_inferior, sim_store_register, sim_fetch_register)
	(sim_info, sim_stop_reason, flush_windows, sim_do_command): Use
	new-style declaration.
	* help.c (usage, gen_help): Use new-style declaration.
	* func.c (batch, set_regi, set_rega, disp_reg, limcalc)
	(reset_stat, show_stat, init_bpt, int_handler, init_signals)
	(disp_fpu, disp_regs, disp_ctrl, disp_mem, dis_mem, event)
	(init_event, set_int, advance_time, now, wait_for_irq, check_bpt)
	(reset_all, sys_reset, sys_halt): Use new-style declaration.
	* float.c (get_accex, clear_accex, set_fsr): Use new-style
	declaration.
	* exec.c (sub_cc, add_cc, log_cc, dispatch_instruction, fpexec)
	(chk_asi, execute_trap, check_interrupts, init_regs): Use
	new-style declaration.
	* erc32.c (init_sim, reset, decode_ersr, mecparerror)
	(error_mode, decode_memcfg, decode_wcr, decode_mcr, sim_halt)
	(close_port, exit_sim, mec_reset, mec_intack, chk_irq, mec_irq)
	(set_sfsr, mec_read, mec_write, init_stdio, restore_stdio)
	(port_init, read_uart, write_uart, flush_uart, uarta_tx)
	(uartb_tx, uart_rx, uart_intr, uart_irq_start, wdog_intr)
	(wdog_start, rtc_intr, rtc_start, rtc_counter_read)
	(rtc_scaler_set, rtc_reload_set, gpt_intr, gpt_start)
	(gpt_counter_read, gpt_scaler_set, gpt_reload_set, timer_ctrl)
	(memory_read, memory_write, get_mem_ptr, sis_memory_write)
	(sis_memory_read): Use new-style declaration.

sim/frv/ChangeLog
2021-04-08  Tom Tromey  <tom@tromey.com>

	* sim-if.c (sim_open, frv_sim_close, sim_create_inferior): Use
	new-style declaration.

sim/h8300/ChangeLog
2021-04-08  Tom Tromey  <tom@tromey.com>

	* compile.c (cmdline_location): Use new-style declaration.

sim/iq2000/ChangeLog
2021-04-08  Tom Tromey  <tom@tromey.com>

	* sim-if.c (sim_open, sim_create_inferior): Use new-style
	declaration.
	* iq2000.c (fetch_str): Use new-style declaration.

sim/lm32/ChangeLog
2021-04-08  Tom Tromey  <tom@tromey.com>

	* sim-if.c (sim_open, sim_create_inferior): Use new-style
	declaration.

sim/m32r/ChangeLog
2021-04-08  Tom Tromey  <tom@tromey.com>

	* sim-if.c (sim_open, sim_create_inferior): Use new-style
	declaration.
---
 sim/bpf/ChangeLog       |   4 ++
 sim/bpf/bpf.c           |   2 +-
 sim/common/ChangeLog    |   5 ++
 sim/common/cgen-utils.c |  24 ++-----
 sim/erc32/ChangeLog     |  30 +++++++++
 sim/erc32/erc32.c       | 137 ++++++++++++++--------------------------
 sim/erc32/exec.c        |  37 +++--------
 sim/erc32/float.c       |   7 +-
 sim/erc32/func.c        |  82 ++++++++----------------
 sim/erc32/help.c        |   4 +-
 sim/erc32/interf.c      |  56 ++++------------
 sim/erc32/sis.c         |   9 +--
 sim/frv/ChangeLog       |   5 ++
 sim/frv/sim-if.c        |  18 ++----
 sim/h8300/ChangeLog     |   4 ++
 sim/h8300/compile.c     |   2 +-
 sim/iq2000/ChangeLog    |   6 ++
 sim/iq2000/iq2000.c     |   5 +-
 sim/iq2000/sim-if.c     |  14 ++--
 sim/lm32/ChangeLog      |   5 ++
 sim/lm32/sim-if.c       |  14 ++--
 sim/m32r/ChangeLog      |   5 ++
 sim/m32r/sim-if.c       |  14 ++--
 23 files changed, 191 insertions(+), 298 deletions(-)

diff --git a/sim/bpf/bpf.c b/sim/bpf/bpf.c
index 840fb862e7f..a0cc803da82 100644
--- a/sim/bpf/bpf.c
+++ b/sim/bpf/bpf.c
@@ -205,7 +205,7 @@ bpfbf_breakpoint (SIM_CPU *current_cpu)
    several ISAs.  This should be fixed in CGEN.  */
 
 static void
-bpf_def_model_init ()
+bpf_def_model_init (void)
 {
   /* Do nothing.  */
 }
diff --git a/sim/common/cgen-utils.c b/sim/common/cgen-utils.c
index 8e87ceb3485..3d7c2821eaa 100644
--- a/sim/common/cgen-utils.c
+++ b/sim/common/cgen-utils.c
@@ -319,9 +319,7 @@ CONVDISI (val)
 #endif /* DI_FN_SUPPORT */
 \f
 QI
-RORQI (val, shift)
-     QI  val;
-     int shift;
+RORQI (QI val, int shift)
 {
   if (shift != 0)
     {
@@ -336,9 +334,7 @@ RORQI (val, shift)
 }
 
 QI
-ROLQI (val, shift)
-     QI  val;
-     int shift;
+ROLQI (QI val, int shift)
 {
   if (shift != 0)
     {
@@ -353,9 +349,7 @@ ROLQI (val, shift)
 }
 
 HI
-RORHI (val, shift)
-     HI  val;
-     int shift;
+RORHI (HI val, int shift)
 {
   if (shift != 0)
     {
@@ -370,9 +364,7 @@ RORHI (val, shift)
 }
 
 HI
-ROLHI (val, shift)
-     HI  val;
-     int shift;
+ROLHI (HI val, int shift)
 {
   if (shift != 0)
     {
@@ -387,9 +379,7 @@ ROLHI (val, shift)
 }
 
 SI
-RORSI (val, shift)
-     SI  val;
-     int shift;
+RORSI (SI val, int shift)
 {
   if (shift != 0)
     {
@@ -404,9 +394,7 @@ RORSI (val, shift)
 }
 
 SI
-ROLSI (val, shift)
-     SI  val;
-     int shift;
+ROLSI (SI val, int shift)
 {
   if (shift != 0)
     {
diff --git a/sim/erc32/erc32.c b/sim/erc32/erc32.c
index 893e898c4f4..a93b62b798c 100644
--- a/sim/erc32/erc32.c
+++ b/sim/erc32/erc32.c
@@ -297,7 +297,7 @@ extern int	ext_irl;
 /* One-time init */
 
 void
-init_sim()
+init_sim(void)
 {
     port_init();
 }
@@ -305,7 +305,7 @@ init_sim()
 /* Power-on reset init */
 
 void
-reset()
+reset(void)
 {
     mec_reset();
     uart_irq_start();
@@ -313,7 +313,7 @@ reset()
 }
 
 static void
-decode_ersr()
+decode_ersr(void)
 {
     if (mec_ersr & 0x01) {
 	if (!(mec_mcr & 0x20)) {
@@ -375,7 +375,7 @@ iucomperr()
 #endif
 
 static void
-mecparerror()
+mecparerror(void)
 {
     mec_ersr |= 0x20;
     decode_ersr();
@@ -385,8 +385,7 @@ mecparerror()
 /* IU error mode manager */
 
 void
-error_mode(pc)
-    uint32          pc;
+error_mode(uint32 pc)
 {
 
     mec_ersr |= 0x1;
@@ -397,7 +396,7 @@ error_mode(pc)
 /* Check memory settings */
 
 static void
-decode_memcfg()
+decode_memcfg(void)
 {
     if (rom8) mec_memcfg &= ~0x20000;
     else mec_memcfg |= 0x20000;
@@ -421,7 +420,7 @@ decode_memcfg()
 }
 
 static void
-decode_wcr()
+decode_wcr(void)
 {
     mem_ramr_ws = mec_wcr & 3;
     mem_ramw_ws = (mec_wcr >> 2) & 3;
@@ -437,7 +436,7 @@ decode_wcr()
 }
 
 static void
-decode_mcr()
+decode_mcr(void)
 {
     mem_accprot = (mec_wpr[0] | mec_wpr[1]);
     mem_blockprot = (mec_mcr >> 3) & 1;
@@ -456,7 +455,7 @@ decode_mcr()
 /* Flush ports when simulator stops */
 
 void
-sim_halt()
+sim_halt(void)
 {
 #ifdef FAST_UART
     flush_uart();
@@ -471,7 +470,7 @@ sim_stop(SIM_DESC sd)
 }
 
 static void
-close_port()
+close_port(void)
 {
     if (f1open && f1in != stdin)
 	fclose(f1in);
@@ -480,13 +479,13 @@ close_port()
 }
 
 void
-exit_sim()
+exit_sim(void)
 {
     close_port();
 }
 
 static void
-mec_reset()
+mec_reset(void)
 {
     int             i;
 
@@ -547,8 +546,7 @@ mec_reset()
 
 
 static void
-mec_intack(level)
-    int32           level;
+mec_intack(int32 level)
 {
     int             irq_test;
 
@@ -563,7 +561,7 @@ mec_intack(level)
 }
 
 static void
-chk_irq()
+chk_irq(void)
 {
     int32           i;
     uint32          itmp;
@@ -588,19 +586,14 @@ chk_irq()
 }
 
 static void
-mec_irq(level)
-    int32           level;
+mec_irq(int32 level)
 {
     mec_ipr |= (1 << level);
     chk_irq();
 }
 
 static void
-set_sfsr(fault, addr, asi, read)
-    uint32          fault;
-    uint32          addr;
-    uint32          asi;
-    uint32          read;
+set_sfsr(uint32 fault, uint32 addr, uint32 asi, uint32 read)
 {
     if ((asi == 0xa) || (asi == 0xb)) {
 	mec_ffar = addr;
@@ -618,10 +611,7 @@ set_sfsr(fault, addr, asi, read)
 }
 
 static int32
-mec_read(addr, asi, data)
-    uint32          addr;
-    uint32          asi;
-    uint32         *data;
+mec_read(uint32 addr, uint32 asi, uint32 *data)
 {
 
     switch (addr & 0x0ff) {
@@ -748,9 +738,7 @@ mec_read(addr, asi, data)
 }
 
 static int
-mec_write(addr, data)
-    uint32          addr;
-    uint32          data;
+mec_write(uint32 addr, uint32 data)
 {
     if (sis_verbose > 1)
 	printf("MEC write a: %08x, d: %08x\n",addr,data);
@@ -932,7 +920,7 @@ mec_write(addr, data)
 static int      ifd1 = -1, ifd2 = -1, ofd1 = -1, ofd2 = -1;
 
 void
-init_stdio()
+init_stdio(void)
 {
     if (dumbio)
         return; /* do nothing */
@@ -943,7 +931,7 @@ init_stdio()
 }
 
 void
-restore_stdio()
+restore_stdio(void)
 {
     if (dumbio)
         return; /* do nothing */
@@ -960,7 +948,7 @@ restore_stdio()
 
 
 static void
-port_init()
+port_init(void)
 {
 
     if (uben) {
@@ -1037,8 +1025,7 @@ port_init()
 }
 
 static uint32
-read_uart(addr)
-    uint32          addr;
+read_uart(uint32 addr)
 {
 
     unsigned        tmp;
@@ -1159,9 +1146,7 @@ read_uart(addr)
 }
 
 static void
-write_uart(addr, data)
-    uint32          addr;
-    uint32          data;
+write_uart(uint32 addr, uint32 data)
 {
     unsigned char   c;
 
@@ -1235,7 +1220,7 @@ write_uart(addr, data)
 }
 
 static void
-flush_uart()
+flush_uart(void)
 {
     while (wnuma && f1open)
 	wnuma -= fwrite(wbufa, 1, wnuma, f1out);
@@ -1246,7 +1231,7 @@ flush_uart()
 
 
 static void
-uarta_tx()
+uarta_tx(void)
 {
 
     while (f1open && fwrite(&uarta_sreg, 1, 1, f1out) != 1);
@@ -1261,7 +1246,7 @@ uarta_tx()
 }
 
 static void
-uartb_tx()
+uartb_tx(void)
 {
     while (f2open && fwrite(&uartb_sreg, 1, 1, f2out) != 1);
     if (uart_stat_reg & UARTB_HRE) {
@@ -1275,8 +1260,7 @@ uartb_tx()
 }
 
 static void
-uart_rx(arg)
-    caddr_t         arg;
+uart_rx(caddr_t arg)
 {
     int32           rsize;
     char            rxd;
@@ -1318,8 +1302,7 @@ uart_rx(arg)
 }
 
 static void
-uart_intr(arg)
-    caddr_t         arg;
+uart_intr(caddr_t arg)
 {
     read_uart(0xE8);		/* Check for UART interrupts every 1000 clk */
     flush_uart();		/* Flush UART ports      */
@@ -1328,7 +1311,7 @@ uart_intr(arg)
 
 
 static void
-uart_irq_start()
+uart_irq_start(void)
 {
 #ifdef FAST_UART
     event(uart_intr, 0, UART_FLUSH_TIME);
@@ -1342,8 +1325,7 @@ uart_irq_start()
 /* Watch-dog */
 
 static void
-wdog_intr(arg)
-    caddr_t         arg;
+wdog_intr(caddr_t arg)
 {
     if (wdog_status == disabled) {
 	wdog_status = stopped;
@@ -1368,7 +1350,7 @@ wdog_intr(arg)
 }
 
 static void
-wdog_start()
+wdog_start(void)
 {
     event(wdog_intr, 0, wdog_scaler + 1);
     if (sis_verbose)
@@ -1381,8 +1363,7 @@ wdog_start()
 
 
 static void
-rtc_intr(arg)
-    caddr_t         arg;
+rtc_intr(caddr_t arg)
 {
     if (rtc_counter == 0) {
 
@@ -1405,7 +1386,7 @@ rtc_intr(arg)
 }
 
 static void
-rtc_start()
+rtc_start(void)
 {
     if (sis_verbose)
 	printf("RTC started (period %d)\n\r", rtc_scaler + 1);
@@ -1415,28 +1396,25 @@ rtc_start()
 }
 
 static uint32
-rtc_counter_read()
+rtc_counter_read(void)
 {
     return rtc_counter;
 }
 
 static void
-rtc_scaler_set(val)
-    uint32          val;
+rtc_scaler_set(uint32 val)
 {
     rtc_scaler = val & 0x0ff;	/* eight-bit scaler only */
 }
 
 static void
-rtc_reload_set(val)
-    uint32          val;
+rtc_reload_set(uint32 val)
 {
     rtc_reload = val;
 }
 
 static void
-gpt_intr(arg)
-    caddr_t         arg;
+gpt_intr(caddr_t arg)
 {
     if (gpt_counter == 0) {
 	mec_irq(12);
@@ -1458,7 +1436,7 @@ gpt_intr(arg)
 }
 
 static void
-gpt_start()
+gpt_start(void)
 {
     if (sis_verbose)
 	printf("GPT started (period %d)\n\r", gpt_scaler + 1);
@@ -1468,28 +1446,25 @@ gpt_start()
 }
 
 static uint32
-gpt_counter_read()
+gpt_counter_read(void)
 {
     return gpt_counter;
 }
 
 static void
-gpt_scaler_set(val)
-    uint32          val;
+gpt_scaler_set(uint32 val)
 {
     gpt_scaler = val & 0x0ffff;	/* 16-bit scaler */
 }
 
 static void
-gpt_reload_set(val)
-    uint32          val;
+gpt_reload_set(uint32 val)
 {
     gpt_reload = val;
 }
 
 static void
-timer_ctrl(val)
-    uint32          val;
+timer_ctrl(uint32 val)
 {
 
     rtc_cr = ((val & TCR_TCRCR) != 0);
@@ -1577,12 +1552,7 @@ memory_iread (uint32 addr, uint32 *data, int32 *ws)
 }
 
 int
-memory_read(asi, addr, data, sz, ws)
-    int32           asi;
-    uint32          addr;
-    uint32         *data;
-    int32           sz;
-    int32          *ws;
+memory_read(int32 asi, uint32 addr, uint32 *data, int32 sz, int32 *ws)
 {
     int32           mexc;
 
@@ -1648,12 +1618,7 @@ memory_read(asi, addr, data, sz, ws)
 }
 
 int
-memory_write(asi, addr, data, sz, ws)
-    int32           asi;
-    uint32          addr;
-    uint32         *data;
-    int32           sz;
-    int32          *ws;
+memory_write(int32 asi, uint32 addr, uint32 *data, int32 sz, int32 *ws)
 {
     uint32          byte_addr;
     uint32          byte_mask;
@@ -1761,9 +1726,7 @@ memory_write(asi, addr, data, sz, ws)
 }
 
 static unsigned char  *
-get_mem_ptr(addr, size)
-    uint32          addr;
-    uint32          size;
+get_mem_ptr(uint32 addr, uint32 size)
 {
     if ((addr + size) < ROM_SZ) {
 	return &romb[addr];
@@ -1782,10 +1745,7 @@ get_mem_ptr(addr, size)
 }
 
 int
-sis_memory_write(addr, data, length)
-    uint32               addr;
-    const unsigned char *data;
-    uint32               length;
+sis_memory_write(uint32 addr, const unsigned char *data, uint32 length)
 {
     char           *mem;
 
@@ -1797,10 +1757,7 @@ sis_memory_write(addr, data, length)
 }
 
 int
-sis_memory_read(addr, data, length)
-    uint32          addr;
-    char           *data;
-    uint32          length;
+sis_memory_read(uint32 addr, char *data, uint32 length)
 {
     char           *mem;
 
diff --git a/sim/erc32/exec.c b/sim/erc32/exec.c
index baf52f7fd78..8daf759514e 100644
--- a/sim/erc32/exec.c
+++ b/sim/erc32/exec.c
@@ -234,11 +234,7 @@ extern uint32 errtt, errftt;
 #endif
 
 static uint32
-sub_cc(psr, operand1, operand2, result)
-    uint32          psr;
-    int32           operand1;
-    int32           operand2;
-    int32           result;
+sub_cc(uint32 psr, int32 operand1, int32 operand2, int32 result)
 {
     psr = ((psr & ~PSR_N) | ((result >> 8) & PSR_N));
     if (result)
@@ -253,11 +249,7 @@ sub_cc(psr, operand1, operand2, result)
 }
 
 uint32
-add_cc(psr, operand1, operand2, result)
-    uint32          psr;
-    int32           operand1;
-    int32           operand2;
-    int32           result;
+add_cc(uint32 psr, int32 operand1, int32 operand2, int32 result)
 {
     psr = ((psr & ~PSR_N) | ((result >> 8) & PSR_N));
     if (result)
@@ -272,9 +264,7 @@ add_cc(psr, operand1, operand2, result)
 }
 
 static void
-log_cc(result, sregs)
-    int32           result;
-    struct pstate  *sregs;
+log_cc(int32 result, struct pstate *sregs)
 {
     sregs->psr &= ~(PSR_CC);	/* Zero CC bits */
     sregs->psr = (sregs->psr | ((result >> 8) & PSR_N));
@@ -398,8 +388,7 @@ extract_byte_signed (uint32 data, uint32 address)
 }
 
 int
-dispatch_instruction(sregs)
-    struct pstate  *sregs;
+dispatch_instruction(struct pstate *sregs)
 {
 
     uint32          cwp, op, op2, op3, asi, rd, cond, rs1,
@@ -1671,9 +1660,7 @@ dispatch_instruction(sregs)
 
 
 static int
-fpexec(op3, rd, rs1, rs2, sregs)
-    uint32          op3, rd, rs1, rs2;
-    struct pstate  *sregs;
+fpexec(uint32 op3, uint32 rd, uint32 rs1, uint32 rs2, struct pstate *sregs)
 {
     uint32          opf, tem, accex;
     int32           fcc;
@@ -1952,10 +1939,7 @@ fpexec(op3, rd, rs1, rs2, sregs)
 }
 
 static int
-chk_asi(sregs, asi, op3)
-    struct pstate  *sregs;
-    uint32 *asi, op3;
-
+chk_asi(struct pstate *sregs, uint32 *asi, uint32 op3)
 {
     if (!(sregs->psr & PSR_S)) {
 	sregs->trap = TRAP_PRIVI;
@@ -1969,8 +1953,7 @@ chk_asi(sregs, asi, op3)
 }
 
 int
-execute_trap(sregs)
-    struct pstate  *sregs;
+execute_trap(struct pstate *sregs)
 {
     int32           cwp;
 
@@ -2017,8 +2000,7 @@ execute_trap(sregs)
 extern struct irqcell irqarr[16];
 
 int
-check_interrupts(sregs)
-    struct pstate  *sregs;
+check_interrupts(struct pstate *sregs)
 {
 #ifdef ERRINJ
     if (errtt) {
@@ -2040,8 +2022,7 @@ check_interrupts(sregs)
 }
 
 void
-init_regs(sregs)
-    struct pstate  *sregs;
+init_regs(struct pstate *sregs)
 {
     sregs->pc = 0;
     sregs->npc = 4;
diff --git a/sim/erc32/float.c b/sim/erc32/float.c
index ff548a228b4..6d3d2bd73d2 100644
--- a/sim/erc32/float.c
+++ b/sim/erc32/float.c
@@ -32,7 +32,7 @@
 
 /* This routine should return the accrued exceptions */
 int
-get_accex()
+get_accex(void)
 {
     int fexc, accx;
 
@@ -53,15 +53,14 @@ get_accex()
 
 /* How to clear the accrued exceptions */
 void
-clear_accex()
+clear_accex(void)
 {
     feclearexcept (FE_ALL_EXCEPT);
 }
 
 /* How to map SPARC FSR onto the host */
 void
-set_fsr(fsr)
-uint32 fsr;
+set_fsr(uint32 fsr)
 {
     int fround;
 
diff --git a/sim/erc32/func.c b/sim/erc32/func.c
index 1bad6dff806..98217f062ae 100644
--- a/sim/erc32/func.c
+++ b/sim/erc32/func.c
@@ -70,9 +70,7 @@ static void	disp_ctrl (struct pstate *sregs);
 static void	disp_mem (uint32 addr, uint32 len);
 
 static int 
-batch(sregs, fname)
-    struct pstate  *sregs;
-    char           *fname;
+batch(struct pstate *sregs, char *fname)
 {
     FILE           *fp;
     char           *lbuf = NULL;
@@ -97,10 +95,7 @@ batch(sregs, fname)
 }
 
 void
-set_regi(sregs, reg, rval)
-    struct pstate  *sregs;
-    int32           reg;
-    uint32          rval;
+set_regi(struct pstate *sregs, int32 reg, uint32 rval)
 {
     uint32          cwp;
 
@@ -187,10 +182,7 @@ get_regi(struct pstate * sregs, int32 reg, char *buf)
 
 
 static void
-set_rega(sregs, reg, rval)
-    struct pstate  *sregs;
-    char           *reg;
-    uint32          rval;
+set_rega(struct pstate *sregs, char *reg, uint32 rval)
 {
     uint32          cwp;
     int32           err = 0;
@@ -294,9 +286,7 @@ set_rega(sregs, reg, rval)
 }
 
 static void
-disp_reg(sregs, reg)
-    struct pstate  *sregs;
-    char           *reg;
+disp_reg(struct pstate *sregs, char *reg)
 {
     if (strncmp(reg, "w",1) == 0)
 	disp_regs(sregs, VAL(&reg[1]));
@@ -337,8 +327,7 @@ errinjstart()
 #endif
 
 static uint32
-limcalc (freq)
-    float32		freq;
+limcalc (float32 freq)
 {
     uint32          unit, lim;
     double	    flim;
@@ -603,8 +592,7 @@ exec_cmd(struct pstate *sregs, const char *cmd)
 
 
 void
-reset_stat(sregs)
-    struct pstate  *sregs;
+reset_stat(struct pstate *sregs)
 {
     sregs->tottime = 0.0;
     sregs->pwdtime = 0;
@@ -621,8 +609,7 @@ reset_stat(sregs)
 }
 
 void
-show_stat(sregs)
-    struct pstate  *sregs;
+show_stat(struct pstate *sregs)
 {
     uint32          iinst;
     uint32          stime;
@@ -677,8 +664,7 @@ show_stat(sregs)
 
 
 void
-init_bpt(sregs)
-    struct pstate  *sregs;
+init_bpt(struct pstate *sregs)
 {
     sregs->bptnum = 0;
     sregs->histlen = 0;
@@ -688,8 +674,7 @@ init_bpt(sregs)
 }
 
 static void
-int_handler(sig)
-    int32           sig;
+int_handler(int32 sig)
 {
     if (sig != 2)
 	printf("\n\n Signal handler error  (%d)\n\n", sig);
@@ -697,7 +682,7 @@ int_handler(sig)
 }
 
 void
-init_signals()
+init_signals(void)
 {
     typedef void    (*PFI) ();
     static PFI      int_tab[2];
@@ -714,8 +699,7 @@ struct evcell   evbuf[EVENT_MAX];
 struct irqcell  irqarr[16];
 
 static int
-disp_fpu(sregs)
-    struct pstate  *sregs;
+disp_fpu(struct pstate *sregs)
 {
 
     int         i;
@@ -741,9 +725,7 @@ disp_fpu(sregs)
 }
 
 static void
-disp_regs(sregs,cwp)
-    struct pstate  *sregs;
-    int cwp;
+disp_regs(struct pstate *sregs, int cwp)
 {
 
     int           i;
@@ -770,8 +752,7 @@ static void print_insn_sparc_sis(uint32 addr, struct disassemble_info *info)
 }
 
 static void
-disp_ctrl(sregs)
-    struct pstate  *sregs;
+disp_ctrl(struct pstate *sregs)
 {
 
     uint32           i;
@@ -790,9 +771,7 @@ disp_ctrl(sregs)
 }
 
 static void
-disp_mem(addr, len)
-    uint32          addr;
-    uint32          len;
+disp_mem(uint32 addr, uint32 len)
 {
 
     uint32          i;
@@ -823,10 +802,7 @@ disp_mem(addr, len)
 }
 
 void
-dis_mem(addr, len, info)
-    uint32          addr;
-    uint32          len;
-    struct disassemble_info *info;
+dis_mem(uint32 addr, uint32 len, struct disassemble_info *info)
 {
     uint32          i;
     union {
@@ -846,10 +822,7 @@ dis_mem(addr, len, info)
 /* Add event to event queue */
 
 void
-event(cfunc, arg, delta)
-    void            (*cfunc) ();
-    int32           arg;
-    uint64          delta;
+event(void (*cfunc) (), int32 arg, uint64 delta)
 {
     struct evcell  *ev1, *evins;
 
@@ -885,7 +858,7 @@ stop_event()
 #endif
 
 void
-init_event()
+init_event(void)
 {
     int32           i;
 
@@ -898,10 +871,7 @@ init_event()
 }
 
 void
-set_int(level, callback, arg)
-    int32           level;
-    void            (*callback) ();
-    int32           arg;
+set_int(int32 level, void (*callback) (), int32 arg)
 {
     irqarr[level & 0x0f].callback = callback;
     irqarr[level & 0x0f].arg = arg;
@@ -910,8 +880,7 @@ set_int(level, callback, arg)
 /* Advance simulator time */
 
 void
-advance_time(sregs)
-    struct pstate  *sregs;
+advance_time(struct pstate *sregs)
 {
 
     struct evcell  *evrem;
@@ -942,7 +911,7 @@ advance_time(sregs)
 }
 
 uint32
-now()
+now(void)
 {
     return ebase.simtime;
 }
@@ -951,7 +920,7 @@ now()
 /* Advance time until an external interrupt is seen */
 
 int
-wait_for_irq()
+wait_for_irq(void)
 {
     struct evcell  *evrem;
     void            (*cfunc) ();
@@ -980,8 +949,7 @@ wait_for_irq()
 }
 
 int
-check_bpt(sregs)
-    struct pstate  *sregs;
+check_bpt(struct pstate *sregs)
 {
     int32           i;
 
@@ -995,7 +963,7 @@ check_bpt(sregs)
 }
 
 void
-reset_all()
+reset_all(void)
 {
     init_event();		/* Clear event queue */
     init_regs(&sregs);
@@ -1006,14 +974,14 @@ reset_all()
 }
 
 void
-sys_reset()
+sys_reset(void)
 {
     reset_all();
     sregs.trap = 256;		/* Force fake reset trap */
 }
 
 void
-sys_halt()
+sys_halt(void)
 {
     sregs.trap = 257;           /* Force fake halt trap */
 }
diff --git a/sim/erc32/help.c b/sim/erc32/help.c
index ed4f21b8c3b..419ab0d33ef 100644
--- a/sim/erc32/help.c
+++ b/sim/erc32/help.c
@@ -21,7 +21,7 @@
 #include "sis.h"
 
 void
-usage()
+usage(void)
 {
 
     printf("usage: sis [-uart1 uart_device1] [-uart2 uart_device2]\n");
@@ -30,7 +30,7 @@ usage()
 }
 
 void
-gen_help()
+gen_help(void)
 {
 
   printf("\n batch <file>          execute a batch file of SIS commands\n");
diff --git a/sim/erc32/interf.c b/sim/erc32/interf.c
index ca2e9faea21..c8e025b23e0 100644
--- a/sim/erc32/interf.c
+++ b/sim/erc32/interf.c
@@ -60,10 +60,7 @@ int             sis_gdb_break = 1;
 host_callback *sim_callback;
 
 int
-run_sim(sregs, icount, dis)
-    struct pstate  *sregs;
-    uint64          icount;
-    int             dis;
+run_sim(struct pstate *sregs, uint64 icount, int dis)
 {
     int             mexc, irq;
 
@@ -158,11 +155,8 @@ run_sim(sregs, icount, dis)
 }
 
 SIM_DESC
-sim_open (kind, callback, abfd, argv)
-     SIM_OPEN_KIND kind;
-     struct host_callback_struct *callback;
-     struct bfd *abfd;
-     char * const *argv;
+sim_open (SIM_OPEN_KIND kind, struct host_callback_struct *callback,
+	  struct bfd *abfd, char * const *argv)
 {
 
     int             argc = 0;
@@ -263,9 +257,7 @@ sim_open (kind, callback, abfd, argv)
 }
 
 void
-sim_close(sd, quitting)
-     SIM_DESC sd;
-     int quitting;
+sim_close(SIM_DESC sd, int quitting)
 {
 
     exit_sim();
@@ -274,22 +266,15 @@ sim_close(sd, quitting)
 };
 
 SIM_RC
-sim_load(sd, prog, abfd, from_tty)
-     SIM_DESC sd;
-     const char *prog;
-     bfd *abfd;
-     int from_tty;
+sim_load(SIM_DESC sd, const char *prog, bfd *abfd, int from_tty)
 {
     bfd_load (prog);
     return SIM_RC_OK;
 }
 
 SIM_RC
-sim_create_inferior(sd, abfd, argv, env)
-     SIM_DESC sd;
-     struct bfd *abfd;
-     char * const *argv;
-     char * const *env;
+sim_create_inferior(SIM_DESC sd, bfd *abfd, char * const *argv,
+		    char * const *env)
 {
     bfd_vma start_address = 0;
     if (abfd != NULL)
@@ -304,11 +289,7 @@ sim_create_inferior(sd, abfd, argv, env)
 }
 
 int
-sim_store_register(sd, regno, value, length)
-    SIM_DESC sd;
-    int             regno;
-    unsigned char  *value;
-    int length;
+sim_store_register(SIM_DESC sd, int regno, unsigned char *value, int length)
 {
     int regval;
 
@@ -320,11 +301,7 @@ sim_store_register(sd, regno, value, length)
 
 
 int
-sim_fetch_register(sd, regno, buf, length)
-     SIM_DESC sd;
-    int             regno;
-    unsigned char  *buf;
-     int length;
+sim_fetch_register(SIM_DESC sd, int regno, unsigned char *buf, int length)
 {
     get_regi(&sregs, regno, buf);
     return -1;
@@ -353,9 +330,7 @@ sim_read (SIM_DESC sd, SIM_ADDR mem, unsigned char *buf, int length)
 }
 
 void
-sim_info(sd, verbose)
-     SIM_DESC sd;
-     int verbose;
+sim_info(SIM_DESC sd, int verbose)
 {
     show_stat(&sregs);
 }
@@ -363,10 +338,7 @@ sim_info(sd, verbose)
 int             simstat = OK;
 
 void
-sim_stop_reason(sd, reason, sigrc)
-     SIM_DESC sd;
-     enum sim_stop * reason;
-     int *sigrc;
+sim_stop_reason(SIM_DESC sd, enum sim_stop *reason, int *sigrc)
 {
 
     switch (simstat) {
@@ -400,7 +372,7 @@ sim_stop_reason(sd, reason, sigrc)
 */
 
 static void
-flush_windows ()
+flush_windows (void)
 {
   int invwin;
   int cwp;
@@ -452,9 +424,7 @@ sim_resume(SIM_DESC sd, int step, int siggnal)
 }
 
 void
-sim_do_command(sd, cmd)
-     SIM_DESC sd;
-     const char *cmd;
+sim_do_command(SIM_DESC sd, const char *cmd)
 {
     exec_cmd(&sregs, cmd);
 }
diff --git a/sim/erc32/sis.c b/sim/erc32/sis.c
index 858bcbb9d7b..05044c3ad8f 100644
--- a/sim/erc32/sis.c
+++ b/sim/erc32/sis.c
@@ -65,10 +65,7 @@ extern int era;
 #endif
 
 int
-run_sim(sregs, icount, dis)
-    struct pstate  *sregs;
-    uint64          icount;
-    int             dis;
+run_sim(struct pstate *sregs, uint64 icount, int dis)
 {
     int             irq, mexc, deb;
 
@@ -140,9 +137,7 @@ run_sim(sregs, icount, dis)
 }
 
 int
-main(argc, argv)
-    int             argc;
-    char          **argv;
+main(int argc, char **argv)
 {
 
     int             cont = 1;
diff --git a/sim/frv/sim-if.c b/sim/frv/sim-if.c
index 45cbd1618a4..9351f79e053 100644
--- a/sim/frv/sim-if.c
+++ b/sim/frv/sim-if.c
@@ -43,11 +43,8 @@ free_state (SIM_DESC sd)
 /* Create an instance of the simulator.  */
 
 SIM_DESC
-sim_open (kind, callback, abfd, argv)
-     SIM_OPEN_KIND kind;
-     host_callback *callback;
-     bfd *abfd;
-     char * const *argv;
+sim_open (SIM_OPEN_KIND kind, host_callback *callback, bfd *abfd,
+	  char * const *argv)
 {
   char c;
   int i;
@@ -162,9 +159,7 @@ sim_open (kind, callback, abfd, argv)
 }
 
 void
-frv_sim_close (sd, quitting)
-     SIM_DESC sd;
-     int quitting;
+frv_sim_close (SIM_DESC sd, int quitting)
 {
   int i;
   /* Terminate cache support.  */
@@ -177,11 +172,8 @@ frv_sim_close (sd, quitting)
 }
 \f
 SIM_RC
-sim_create_inferior (sd, abfd, argv, envp)
-     SIM_DESC sd;
-     bfd *abfd;
-     char * const *argv;
-     char * const *envp;
+sim_create_inferior (SIM_DESC sd, bfd *abfd, char * const *argv,
+		     char * const *envp)
 {
   SIM_CPU *current_cpu = STATE_CPU (sd, 0);
   SIM_ADDR addr;
diff --git a/sim/h8300/compile.c b/sim/h8300/compile.c
index 47b0577781a..c30a738c6d1 100644
--- a/sim/h8300/compile.c
+++ b/sim/h8300/compile.c
@@ -465,7 +465,7 @@ lvalue (SIM_DESC sd, int x, int rn, unsigned int *val)
 }
 
 static int
-cmdline_location()
+cmdline_location(void)
 {
   if (h8300smode && !h8300_normal_mode)
     return 0xffff00L;
diff --git a/sim/iq2000/iq2000.c b/sim/iq2000/iq2000.c
index 86151ca9e1e..23a342983ce 100644
--- a/sim/iq2000/iq2000.c
+++ b/sim/iq2000/iq2000.c
@@ -56,10 +56,7 @@ enum libgloss_syscall
 
 /* Read a null terminated string from memory, return in a buffer */
 static char *
-fetch_str (current_cpu, pc, addr)
-     SIM_CPU *current_cpu;
-     PCADDR pc;
-     DI addr;
+fetch_str (SIM_CPU *current_cpu, PCADDR pc, DI addr)
 {
   char *buf;
   int nr = 0;
diff --git a/sim/iq2000/sim-if.c b/sim/iq2000/sim-if.c
index 496b10659ea..158c6e7574a 100644
--- a/sim/iq2000/sim-if.c
+++ b/sim/iq2000/sim-if.c
@@ -50,11 +50,8 @@ free_state (SIM_DESC sd)
 /* Create an instance of the simulator.  */
 
 SIM_DESC
-sim_open (kind, callback, abfd, argv)
-     SIM_OPEN_KIND kind;
-     host_callback *callback;
-     struct bfd *abfd;
-     char * const *argv;
+sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
+	  char * const *argv)
 {
   char c;
   int i;
@@ -130,11 +127,8 @@ sim_open (kind, callback, abfd, argv)
 }
 \f
 SIM_RC
-sim_create_inferior (sd, abfd, argv, envp)
-     SIM_DESC sd;
-     struct bfd *abfd;
-     char * const *argv;
-     char * const *envp;
+sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char * const *argv,
+		     char * const *envp)
 {
   SIM_CPU *current_cpu = STATE_CPU (sd, 0);
   SIM_ADDR addr;
diff --git a/sim/lm32/sim-if.c b/sim/lm32/sim-if.c
index 176456ed62d..398eb60c67a 100644
--- a/sim/lm32/sim-if.c
+++ b/sim/lm32/sim-if.c
@@ -80,11 +80,8 @@ find_limit (SIM_DESC sd)
 /* Create an instance of the simulator.  */
 
 SIM_DESC
-sim_open (kind, callback, abfd, argv)
-     SIM_OPEN_KIND kind;
-     host_callback *callback;
-     struct bfd *abfd;
-     char * const *argv;
+sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
+	  char * const *argv)
 {
   SIM_DESC sd = sim_state_alloc (kind, callback);
   char c;
@@ -190,11 +187,8 @@ sim_open (kind, callback, abfd, argv)
 }
 \f
 SIM_RC
-sim_create_inferior (sd, abfd, argv, envp)
-     SIM_DESC sd;
-     struct bfd *abfd;
-     char * const *argv;
-     char * const *envp;
+sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char * const *argv,
+		     char * const *envp)
 {
   SIM_CPU *current_cpu = STATE_CPU (sd, 0);
   SIM_ADDR addr;
diff --git a/sim/m32r/sim-if.c b/sim/m32r/sim-if.c
index 58d46946eb7..42cf728e79e 100644
--- a/sim/m32r/sim-if.c
+++ b/sim/m32r/sim-if.c
@@ -44,11 +44,8 @@ free_state (SIM_DESC sd)
 /* Create an instance of the simulator.  */
 
 SIM_DESC
-sim_open (kind, callback, abfd, argv)
-     SIM_OPEN_KIND kind;
-     host_callback *callback;
-     struct bfd *abfd;
-     char * const *argv;
+sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd,
+	  char * const *argv)
 {
   SIM_DESC sd = sim_state_alloc (kind, callback);
   char c;
@@ -142,11 +139,8 @@ sim_open (kind, callback, abfd, argv)
 }
 \f
 SIM_RC
-sim_create_inferior (sd, abfd, argv, envp)
-     SIM_DESC sd;
-     struct bfd *abfd;
-     char * const *argv;
-     char * const *envp;
+sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char * const *argv,
+		     char * const *envp)
 {
   SIM_CPU *current_cpu = STATE_CPU (sd, 0);
   SIM_ADDR addr;
-- 
2.26.2


  reply	other threads:[~2021-04-08 16:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-08 16:44 [PATCH 0/2] Fix some sim warnings Tom Tromey
2021-04-08 16:44 ` Tom Tromey [this message]
2021-04-08 17:44   ` [PATCH 1/2] Do not use old-style definitions in sim Mike Frysinger
2021-04-08 16:44 ` [PATCH 2/2] Add system includes " Tom Tromey
2021-04-08 17:43   ` Mike Frysinger
2021-04-08 18:32     ` Tom Tromey
2021-04-08 18:43       ` Tom Tromey
2021-04-08 19:26       ` Mike Frysinger
2021-04-08 19:30         ` Tom Tromey
2021-04-08 20:12           ` Mike Frysinger
2021-04-08 20:34       ` Tom Tromey
2021-04-08 20:58         ` Mike Frysinger

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=20210408164436.2165323-2-tom@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.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).