diff options
author | Mike Frysinger <vapier@gentoo.org> | 2015-04-13 01:56:13 -0400 |
---|---|---|
committer | Mike Frysinger <vapier@gentoo.org> | 2015-04-13 02:01:11 -0400 |
commit | 8ac57fbde478b8e8fb0ba169f620d713be319260 (patch) | |
tree | 8cfd0cb78e0fc69b998adaf4c345d438dda1e5cb | |
parent | 65f9096890a7bd7a7ea2655dcfb0e0a2589a753b (diff) | |
download | gdb-8ac57fbde478b8e8fb0ba169f620d713be319260.zip gdb-8ac57fbde478b8e8fb0ba169f620d713be319260.tar.gz gdb-8ac57fbde478b8e8fb0ba169f620d713be319260.tar.bz2 |
sim: mips: fix prototype warnings
Convert a bunch of old style prototypes and tweak various casts
to match the function signatures.
-rw-r--r-- | sim/mips/ChangeLog | 13 | ||||
-rw-r--r-- | sim/mips/interp.c | 93 |
2 files changed, 43 insertions, 63 deletions
diff --git a/sim/mips/ChangeLog b/sim/mips/ChangeLog index d6a29c1..cd655eb 100644 --- a/sim/mips/ChangeLog +++ b/sim/mips/ChangeLog @@ -1,3 +1,16 @@ +2015-04-13 Mike Frysinger <vapier@gentoo.org> + + * interp.c (mips_option_handler, open_trace, sim_close, + sim_write, sim_read, sim_store_register, sim_fetch_register, + sim_create_inferior, pr_addr, pr_uword64): Convert old style + prototypes. + (sim_open): Convert old style prototype. Change casts with + sim_write to unsigned char *. + (fetch_str): Change null to unsigned char, and change cast to + unsigned char *. + (sim_monitor): Change c & ch to unsigned char. Change cast to + unsigned char *. + 2015-04-12 Mike Frysinger <vapier@gentoo.org> * Makefile.in (SIM_OBJS): Move interp.o to the start of the list. diff --git a/sim/mips/interp.c b/sim/mips/interp.c index b382455..dabd9e0 100644 --- a/sim/mips/interp.c +++ b/sim/mips/interp.c @@ -182,12 +182,8 @@ enum { static int display_mem_info = 0; static SIM_RC -mips_option_handler (sd, cpu, opt, arg, is_command) - SIM_DESC sd; - sim_cpu *cpu; - int opt; - char *arg; - int is_command; +mips_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, char *arg, + int is_command) { int cpu_nr; switch (opt) @@ -341,11 +337,7 @@ static void device_init(SIM_DESC sd) { /*---------------------------------------------------------------------------*/ SIM_DESC -sim_open (kind, cb, abfd, argv) - SIM_OPEN_KIND kind; - host_callback *cb; - struct bfd *abfd; - char **argv; +sim_open (SIM_OPEN_KIND kind, host_callback *cb, struct bfd *abfd, char **argv) { SIM_DESC sd = sim_state_alloc (kind, cb); sim_cpu *cpu = STATE_CPU (sd, 0); /* FIXME */ @@ -719,7 +711,7 @@ sim_open (kind, cb, abfd, argv) (((loop >> 2) & RSVD_INSTRUCTION_ARG_MASK) << RSVD_INSTRUCTION_ARG_SHIFT)); H2T (insn); - sim_write (sd, vaddr, (char *)&insn, sizeof (insn)); + sim_write (sd, vaddr, (unsigned char *)&insn, sizeof (insn)); } } @@ -767,13 +759,13 @@ sim_open (kind, cb, abfd, argv) if (pmon_monitor_base != 0) { address_word vaddr = (pmon_monitor_base + (loop * 4)); - sim_write (sd, vaddr, (char *)&value, sizeof (value)); + sim_write (sd, vaddr, (unsigned char *)&value, sizeof (value)); } if (lsipmon_monitor_base != 0) { address_word vaddr = (lsipmon_monitor_base + (loop * 4)); - sim_write (sd, vaddr, (char *)&value, sizeof (value)); + sim_write (sd, vaddr, (unsigned char *)&value, sizeof (value)); } } @@ -788,13 +780,13 @@ sim_open (kind, cb, abfd, argv) HALT_INSTRUCTION /* BREAK */ }; H2T (halt[0]); H2T (halt[1]); - sim_write (sd, 0x80000000, (char *) halt, sizeof (halt)); - sim_write (sd, 0x80000180, (char *) halt, sizeof (halt)); - sim_write (sd, 0x80000200, (char *) halt, sizeof (halt)); + sim_write (sd, 0x80000000, (unsigned char *) halt, sizeof (halt)); + sim_write (sd, 0x80000180, (unsigned char *) halt, sizeof (halt)); + sim_write (sd, 0x80000200, (unsigned char *) halt, sizeof (halt)); /* XXX: Write here unconditionally? */ - sim_write (sd, 0xBFC00200, (char *) halt, sizeof (halt)); - sim_write (sd, 0xBFC00380, (char *) halt, sizeof (halt)); - sim_write (sd, 0xBFC00400, (char *) halt, sizeof (halt)); + sim_write (sd, 0xBFC00200, (unsigned char *) halt, sizeof (halt)); + sim_write (sd, 0xBFC00380, (unsigned char *) halt, sizeof (halt)); + sim_write (sd, 0xBFC00400, (unsigned char *) halt, sizeof (halt)); } } @@ -805,8 +797,7 @@ sim_open (kind, cb, abfd, argv) #if defined(TRACE) static void -open_trace(sd) - SIM_DESC sd; +open_trace (SIM_DESC sd) { tracefh = fopen(tracefile,"wb+"); if (tracefh == NULL) @@ -825,9 +816,7 @@ get_insn_name (sim_cpu *cpu, int i) } void -sim_close (sd, quitting) - SIM_DESC sd; - int quitting; +sim_close (SIM_DESC sd, int quitting) { #ifdef DEBUG printf("DBG: sim_close: entered (quitting = %d)\n",quitting); @@ -856,11 +845,7 @@ sim_close (sd, quitting) int -sim_write (sd,addr,buffer,size) - SIM_DESC sd; - SIM_ADDR addr; - const unsigned char *buffer; - int size; +sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size) { int index; sim_cpu *cpu = STATE_CPU (sd, 0); /* FIXME */ @@ -888,11 +873,7 @@ sim_write (sd,addr,buffer,size) } int -sim_read (sd,addr,buffer,size) - SIM_DESC sd; - SIM_ADDR addr; - unsigned char *buffer; - int size; +sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size) { int index; sim_cpu *cpu = STATE_CPU (sd, 0); /* FIXME */ @@ -917,11 +898,7 @@ sim_read (sd,addr,buffer,size) } int -sim_store_register (sd,rn,memory,length) - SIM_DESC sd; - int rn; - unsigned char *memory; - int length; +sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length) { sim_cpu *cpu = STATE_CPU (sd, 0); /* FIXME */ /* NOTE: gdb (the client) stores registers in target byte order @@ -1006,11 +983,7 @@ sim_store_register (sd,rn,memory,length) } int -sim_fetch_register (sd,rn,memory,length) - SIM_DESC sd; - int rn; - unsigned char *memory; - int length; +sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length) { sim_cpu *cpu = STATE_CPU (sd, 0); /* FIXME */ /* NOTE: gdb (the client) stores registers in target byte order @@ -1100,11 +1073,7 @@ sim_pc_get (sim_cpu *cpu) } SIM_RC -sim_create_inferior (sd, abfd, argv,env) - SIM_DESC sd; - struct bfd *abfd; - char **argv; - char **env; +sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env) { #ifdef DEBUG @@ -1155,11 +1124,11 @@ fetch_str (SIM_DESC sd, { char *buf; int nr = 0; - char null; + unsigned char null; while (sim_read (sd, addr + nr, &null, 1) == 1 && null != 0) nr++; buf = NZALLOC (char, nr + 1); - sim_read (sd, addr, buf, nr); + sim_read (sd, addr, (unsigned char *)buf, nr); return buf; } @@ -1287,7 +1256,7 @@ sim_monitor (SIM_DESC sd, int nr = A2; char *buf = zalloc (nr); V0 = sim_io_read (sd, fd, buf, nr); - sim_write (sd, A1, buf, nr); + sim_write (sd, A1, (unsigned char *)buf, nr); free (buf); } break; @@ -1297,7 +1266,7 @@ sim_monitor (SIM_DESC sd, int fd = A0; int nr = A2; char *buf = zalloc (nr); - sim_read (sd, A1, buf, nr); + sim_read (sd, A1, (unsigned char *)buf, nr); V0 = sim_io_write (sd, fd, buf, nr); if (fd == 1) sim_io_flush_stdout (sd); @@ -1394,9 +1363,9 @@ sim_monitor (SIM_DESC sd, value = mem_size; H2T (value); - sim_write (sd, A0 + 0, (char *)&value, 4); - sim_write (sd, A0 + 4, (char *)&zero, 4); - sim_write (sd, A0 + 8, (char *)&zero, 4); + sim_write (sd, A0 + 0, (unsigned char *)&value, 4); + sim_write (sd, A0 + 4, (unsigned char *)&zero, 4); + sim_write (sd, A0 + 8, (unsigned char *)&zero, 4); /* sim_io_eprintf (sd, "sim: get_mem_info() deprecated\n"); */ break; } @@ -1410,7 +1379,7 @@ sim_monitor (SIM_DESC sd, /* The following is based on the PMON printf source */ { address_word s = A0; - char c; + unsigned char c; signed_word *ap = &A1; /* 1st argument */ /* This isn't the quickest way, since we call the host print routine for every character almost. But it does avoid @@ -1467,7 +1436,7 @@ sim_monitor (SIM_DESC sd, if ((int)*ap != 0) { address_word p = *ap++; - char ch; + unsigned char ch; while (sim_read (sd, p++, &ch, 1) == 1 && ch != '\0') sim_io_printf(sd, "%c", ch); } @@ -2471,8 +2440,7 @@ get_cell (void) static int thirty_two = 32; char* -pr_addr(addr) - SIM_ADDR addr; +pr_addr (SIM_ADDR addr) { char *paddr_str=get_cell(); switch (sizeof(addr)) @@ -2494,8 +2462,7 @@ pr_addr(addr) } char* -pr_uword64(addr) - uword64 addr; +pr_uword64 (uword64 addr) { char *paddr_str=get_cell(); sprintf(paddr_str,"%08lx%08lx", |