sim: d10v: clean up misc warnings

This commit is contained in:
Mike Frysinger 2015-03-30 01:38:59 -04:00
parent ef9535c6bc
commit 11558abc20
6 changed files with 240 additions and 285 deletions

View file

@ -1,3 +1,28 @@
2015-03-30 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (gencode.o, d10v-opc.o): Add $(WARN_CFLAGS).
(gencode): Add $(BUILD_LDFLAGS).
* endian.c (get_word, get_longword, get_longlong, write_word,
write_longword, write_longlong): Convert old style prototypes.
* gencode.c: Include string.h.
(main): Convert old style prototype.
(write_header): Convert old style prototype and fix printf format.
(write_template, write_opcodes): Likewise.
(check_opcodes): Mark static void.
* interp.c: Include inttypes.h and run-sim.h.
(hash, lookup_hash, decode_pc, do_long, do_2_short, do_parallel,
add_commas, sim_size, sim_write, sim_read, sim_open, sim_close,
sim_set_profile, sim_set_profile_size, sim_stop, +sim_resume,
sim_info, sim_set_callbacks, sim_stop_reason, sim_fetch_register,
sim_store_register, sim_do_command, sim_load): Convert old style
prototypes.
(sim_create_inferior): Fix pointer cast to use uintptr_t.
* simops.c (strrchr): Delete prototype.
(trace_input_func): Mark name static.
(trace_input_func, trace_output_void, trace_output_flag): Convert old style
prototypes.
(OP_*): Convert old style prototypes.
2015-03-30 Mike Frysinger <vapier@gentoo.org> 2015-03-30 Mike Frysinger <vapier@gentoo.org>
* Makefile.in (interp.o, simops.o, endian.o, table.o): Delete rules. * Makefile.in (interp.o, simops.o, endian.o, table.o): Delete rules.

View file

@ -40,13 +40,13 @@ table.c: gencode simops.h
./gencode >$@ ./gencode >$@
gencode.o: gencode.c $(INCLUDE) gencode.o: gencode.c $(INCLUDE)
$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/gencode.c $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(WARN_CFLAGS) -c $(srcdir)/gencode.c
d10v-opc.o: $(srcdir)/../../opcodes/d10v-opc.c d10v-opc.o: $(srcdir)/../../opcodes/d10v-opc.c
$(CC_FOR_BUILD) $(BUILD_CFLAGS) -c $(srcdir)/../../opcodes/d10v-opc.c $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(WARN_CFLAGS) -c $(srcdir)/../../opcodes/d10v-opc.c
gencode: gencode.o d10v-opc.o gencode: gencode.o d10v-opc.o
$(CC_FOR_BUILD) $(BUILD_CFLAGS) -o gencode gencode.o d10v-opc.o $(BUILD_LIB) $(CC_FOR_BUILD) $(BUILD_CFLAGS) $(BUILD_LDFLAGS) -o gencode gencode.o d10v-opc.o $(BUILD_LIB)
clean-extra: clean-extra:
rm -f table.c simops.h gencode rm -f table.c simops.h gencode

View file

@ -8,8 +8,7 @@
#endif #endif
ENDIAN_INLINE uint16 ENDIAN_INLINE uint16
get_word (x) get_word (uint8 *x)
uint8 *x;
{ {
#if (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)) && defined(__GNUC__) #if (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)) && defined(__GNUC__)
@ -28,8 +27,7 @@ get_word (x)
} }
ENDIAN_INLINE uint32 ENDIAN_INLINE uint32
get_longword (x) get_longword (uint8 *x)
uint8 *x;
{ {
#if (defined(__i486__) || defined(__i586__) || defined(__i686__)) && defined(__GNUC__) && defined(USE_BSWAP) #if (defined(__i486__) || defined(__i586__) || defined(__i686__)) && defined(__GNUC__) && defined(USE_BSWAP)
@ -62,8 +60,7 @@ get_longword (x)
} }
ENDIAN_INLINE int64 ENDIAN_INLINE int64
get_longlong (x) get_longlong (uint8 *x)
uint8 *x;
{ {
uint32 top = get_longword (x); uint32 top = get_longword (x);
uint32 bottom = get_longword (x+4); uint32 bottom = get_longword (x+4);
@ -71,9 +68,7 @@ get_longlong (x)
} }
ENDIAN_INLINE void ENDIAN_INLINE void
write_word (addr, data) write_word (uint8 *addr, uint16 data)
uint8 *addr;
uint16 data;
{ {
#if (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)) && defined(__GNUC__) #if (defined(__i386__) || defined(__i486__) || defined(__i586__) || defined(__i686__)) && defined(__GNUC__)
@ -92,9 +87,7 @@ write_word (addr, data)
} }
ENDIAN_INLINE void ENDIAN_INLINE void
write_longword (addr, data) write_longword (uint8 *addr, uint32 data)
uint8 *addr;
uint32 data;
{ {
#if (defined(__i486__) || defined(__i586__) || defined(__i686__)) && defined(__GNUC__) && defined(USE_BSWAP) #if (defined(__i486__) || defined(__i586__) || defined(__i686__)) && defined(__GNUC__) && defined(USE_BSWAP)
@ -128,9 +121,7 @@ write_longword (addr, data)
} }
ENDIAN_INLINE void ENDIAN_INLINE void
write_longlong (addr, data) write_longlong (uint8 *addr, int64 data)
uint8 *addr;
int64 data;
{ {
write_longword (addr, (uint32)(data >> 32)); write_longword (addr, (uint32)(data >> 32));
write_longword (addr+4, (uint32)data); write_longword (addr+4, (uint32)data);

View file

@ -2,6 +2,7 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <limits.h> #include <limits.h>
#include <string.h>
#include "ansidecl.h" #include "ansidecl.h"
#include "opcode/d10v.h" #include "opcode/d10v.h"
@ -10,9 +11,7 @@ static void write_opcodes (void);
static void write_template (void); static void write_template (void);
int int
main (argc, argv) main (int argc, char *argv[])
int argc;
char *argv[];
{ {
if ((argc > 1) && (strcmp (argv[1],"-h") == 0)) if ((argc > 1) && (strcmp (argv[1],"-h") == 0))
write_header(); write_header();
@ -25,13 +24,13 @@ main (argc, argv)
static void static void
write_header () write_header (void)
{ {
struct d10v_opcode *opcode; struct d10v_opcode *opcode;
for (opcode = (struct d10v_opcode *)d10v_opcodes; opcode->name; opcode++) for (opcode = (struct d10v_opcode *)d10v_opcodes; opcode->name; opcode++)
if (opcode->format != OPCODE_FAKE) if (opcode->format != OPCODE_FAKE)
printf("void OP_%X (void);\t\t/* %s */\n",opcode->opcode, opcode->name); printf("void OP_%lX (void);\t\t/* %s */\n", opcode->opcode, opcode->name);
} }
@ -39,7 +38,7 @@ write_header ()
/* to be filled out */ /* to be filled out */
static void static void
write_template () write_template (void)
{ {
struct d10v_opcode *opcode; struct d10v_opcode *opcode;
int i,j; int i,j;
@ -51,7 +50,7 @@ write_template ()
{ {
if (opcode->format != OPCODE_FAKE) if (opcode->format != OPCODE_FAKE)
{ {
printf("/* %s */\nvoid\nOP_%X ()\n{\n",opcode->name,opcode->opcode); printf("/* %s */\nvoid\nOP_%lX ()\n{\n", opcode->name, opcode->opcode);
/* count operands */ /* count operands */
j = 0; j = 0;
@ -87,18 +86,18 @@ write_template ()
long Opcodes[512]; long Opcodes[512];
static int curop=0; static int curop=0;
static void
check_opcodes( long op) check_opcodes( long op)
{ {
int i; int i;
for (i=0;i<curop;i++) for (i=0;i<curop;i++)
if (Opcodes[i] == op) if (Opcodes[i] == op)
fprintf(stderr,"DUPLICATE OPCODES: %x\n",op); fprintf(stderr,"DUPLICATE OPCODES: %lx\n", op);
} }
static void static void
write_opcodes () write_opcodes (void)
{ {
struct d10v_opcode *opcode; struct d10v_opcode *opcode;
int i, j; int i, j;
@ -112,7 +111,7 @@ write_opcodes ()
{ {
if (opcode->format != OPCODE_FAKE) if (opcode->format != OPCODE_FAKE)
{ {
printf (" { %ld,%d,%ld,%d,%d,%d,%d,OP_%X,", opcode->opcode, printf (" { %ld,%d,%ld,%d,%d,%d,%d,OP_%lX,", opcode->opcode,
(opcode->format & LONG_OPCODE) ? 1 : 0, opcode->mask, opcode->format, (opcode->format & LONG_OPCODE) ? 1 : 0, opcode->mask, opcode->format,
opcode->cycles, opcode->unit, opcode->exec_type, opcode->opcode); opcode->cycles, opcode->unit, opcode->exec_type, opcode->opcode);

View file

@ -1,8 +1,10 @@
#include "config.h" #include "config.h"
#include <inttypes.h>
#include <signal.h> #include <signal.h>
#include "bfd.h" #include "bfd.h"
#include "gdb/callback.h" #include "gdb/callback.h"
#include "gdb/remote-sim.h" #include "gdb/remote-sim.h"
#include "run-sim.h"
#include "d10v_sim.h" #include "d10v_sim.h"
#include "gdb/sim-d10v.h" #include "gdb/sim-d10v.h"
@ -86,9 +88,7 @@ struct hash_entry
struct hash_entry hash_table[MAX_HASH+1]; struct hash_entry hash_table[MAX_HASH+1];
INLINE static long INLINE static long
hash(insn, format) hash (long insn, int format)
long insn;
int format;
{ {
if (format & LONG_OPCODE) if (format & LONG_OPCODE)
return ((insn & 0x3F000000) >> 24); return ((insn & 0x3F000000) >> 24);
@ -97,9 +97,7 @@ hash(insn, format)
} }
INLINE static struct hash_entry * INLINE static struct hash_entry *
lookup_hash (ins, size) lookup_hash (uint32 ins, int size)
uint32 ins;
int size;
{ {
struct hash_entry *h; struct hash_entry *h;
@ -140,7 +138,7 @@ get_operands (struct simops *s, uint32 ins)
} }
bfd_vma bfd_vma
decode_pc () decode_pc (void)
{ {
asection *s; asection *s;
if (!init_text_p && prog_bfd != NULL) if (!init_text_p && prog_bfd != NULL)
@ -160,8 +158,7 @@ decode_pc ()
} }
static void static void
do_long (ins) do_long (uint32 ins)
uint32 ins;
{ {
struct hash_entry *h; struct hash_entry *h;
#ifdef DEBUG #ifdef DEBUG
@ -178,9 +175,7 @@ do_long (ins)
} }
static void static void
do_2_short (ins1, ins2, leftright) do_2_short (uint16 ins1, uint16 ins2, enum _leftright leftright)
uint16 ins1, ins2;
enum _leftright leftright;
{ {
struct hash_entry *h; struct hash_entry *h;
enum _ins_type first, second; enum _ins_type first, second;
@ -232,8 +227,7 @@ do_2_short (ins1, ins2, leftright)
} }
static void static void
do_parallel (ins1, ins2) do_parallel (uint16 ins1, uint16 ins2)
uint16 ins1, ins2;
{ {
struct hash_entry *h1, *h2; struct hash_entry *h1, *h2;
#ifdef DEBUG #ifdef DEBUG
@ -299,10 +293,7 @@ do_parallel (ins1, ins2)
} }
static char * static char *
add_commas(buf, sizeof_buf, value) add_commas (char *buf, int sizeof_buf, unsigned long value)
char *buf;
int sizeof_buf;
unsigned long value;
{ {
int comma = 3; int comma = 3;
char *endbuf = buf + sizeof_buf - 1; char *endbuf = buf + sizeof_buf - 1;
@ -322,9 +313,7 @@ add_commas(buf, sizeof_buf, value)
} }
void void
sim_size (power) sim_size (int power)
int power;
{ {
int i; int i;
for (i = 0; i < IMEM_SEGMENTS; i++) for (i = 0; i < IMEM_SEGMENTS; i++)
@ -770,22 +759,14 @@ xfer_mem (SIM_ADDR virt,
int int
sim_write (sd, addr, buffer, size) sim_write (SIM_DESC sd, SIM_ADDR addr, const unsigned char *buffer, int size)
SIM_DESC sd;
SIM_ADDR addr;
const unsigned char *buffer;
int size;
{ {
/* FIXME: this should be performing a virtual transfer */ /* FIXME: this should be performing a virtual transfer */
return xfer_mem( addr, buffer, size, 1); return xfer_mem( addr, buffer, size, 1);
} }
int int
sim_read (sd, addr, buffer, size) sim_read (SIM_DESC sd, SIM_ADDR addr, unsigned char *buffer, int size)
SIM_DESC sd;
SIM_ADDR addr;
unsigned char *buffer;
int size;
{ {
/* FIXME: this should be performing a virtual transfer */ /* FIXME: this should be performing a virtual transfer */
return xfer_mem( addr, buffer, size, 0); return xfer_mem( addr, buffer, size, 0);
@ -793,11 +774,7 @@ sim_read (sd, addr, buffer, size)
SIM_DESC SIM_DESC
sim_open (kind, callback, abfd, argv) sim_open (SIM_OPEN_KIND kind, host_callback *callback, struct bfd *abfd, char **argv)
SIM_OPEN_KIND kind;
host_callback *callback;
struct bfd *abfd;
char **argv;
{ {
struct simops *s; struct simops *s;
struct hash_entry *h; struct hash_entry *h;
@ -863,9 +840,7 @@ sim_open (kind, callback, abfd, argv)
void void
sim_close (sd, quitting) sim_close (SIM_DESC sd, int quitting)
SIM_DESC sd;
int quitting;
{ {
if (prog_bfd != NULL && prog_bfd_was_opened_p) if (prog_bfd != NULL && prog_bfd_was_opened_p)
{ {
@ -876,15 +851,13 @@ sim_close (sd, quitting)
} }
void void
sim_set_profile (n) sim_set_profile (int n)
int n;
{ {
(*d10v_callback->printf_filtered) (d10v_callback, "sim_set_profile %d\n",n); (*d10v_callback->printf_filtered) (d10v_callback, "sim_set_profile %d\n",n);
} }
void void
sim_set_profile_size (n) sim_set_profile_size (int n)
int n;
{ {
(*d10v_callback->printf_filtered) (d10v_callback, "sim_set_profile_size %d\n",n); (*d10v_callback->printf_filtered) (d10v_callback, "sim_set_profile_size %d\n",n);
} }
@ -951,8 +924,7 @@ imem_addr (uint32 offset)
static int stop_simulator = 0; static int stop_simulator = 0;
int int
sim_stop (sd) sim_stop (SIM_DESC sd)
SIM_DESC sd;
{ {
stop_simulator = 1; stop_simulator = 1;
return 1; return 1;
@ -961,9 +933,7 @@ sim_stop (sd)
/* Run (or resume) the program. */ /* Run (or resume) the program. */
void void
sim_resume (sd, step, siggnal) sim_resume (SIM_DESC sd, int step, int siggnal)
SIM_DESC sd;
int step, siggnal;
{ {
uint32 inst; uint32 inst;
uint8 *iaddr; uint8 *iaddr;
@ -1096,9 +1066,7 @@ sim_set_trace (void)
} }
void void
sim_info (sd, verbose) sim_info (SIM_DESC sd, int verbose)
SIM_DESC sd;
int verbose;
{ {
char buf1[40]; char buf1[40];
char buf2[40]; char buf2[40];
@ -1201,16 +1169,12 @@ sim_info (sd, verbose)
} }
SIM_RC SIM_RC
sim_create_inferior (sd, abfd, argv, env) sim_create_inferior (SIM_DESC sd, struct bfd *abfd, char **argv, char **env)
SIM_DESC sd;
struct bfd *abfd;
char **argv;
char **env;
{ {
bfd_vma start_address; bfd_vma start_address;
/* reset all state information */ /* reset all state information */
memset (&State.regs, 0, (int)&State.mem - (int)&State.regs); memset (&State.regs, 0, (uintptr_t)&State.mem - (uintptr_t)&State.regs);
/* There was a hack here to copy the values of argc and argv into r0 /* There was a hack here to copy the values of argc and argv into r0
and r1. The values were also saved into some high memory that and r1. The values were also saved into some high memory that
@ -1262,8 +1226,7 @@ sim_create_inferior (sd, abfd, argv, env)
void void
sim_set_callbacks (p) sim_set_callbacks (host_callback *p)
host_callback *p;
{ {
d10v_callback = p; d10v_callback = p;
} }
@ -1277,10 +1240,7 @@ sim_trace (SIM_DESC sd)
} }
void void
sim_stop_reason (sd, reason, sigrc) sim_stop_reason (SIM_DESC sd, enum sim_stop *reason, int *sigrc)
SIM_DESC sd;
enum sim_stop *reason;
int *sigrc;
{ {
/* (*d10v_callback->printf_filtered) (d10v_callback, "sim_stop_reason: PC=0x%x\n",PC<<2); */ /* (*d10v_callback->printf_filtered) (d10v_callback, "sim_stop_reason: PC=0x%x\n",PC<<2); */
@ -1314,11 +1274,7 @@ sim_stop_reason (sd, reason, sigrc)
} }
int int
sim_fetch_register (sd, rn, memory, length) sim_fetch_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
SIM_DESC sd;
int rn;
unsigned char *memory;
int length;
{ {
int size; int size;
switch ((enum sim_d10v_regs) rn) switch ((enum sim_d10v_regs) rn)
@ -1401,11 +1357,7 @@ sim_fetch_register (sd, rn, memory, length)
} }
int int
sim_store_register (sd, rn, memory, length) sim_store_register (SIM_DESC sd, int rn, unsigned char *memory, int length)
SIM_DESC sd;
int rn;
unsigned char *memory;
int length;
{ {
int size; int size;
switch ((enum sim_d10v_regs) rn) switch ((enum sim_d10v_regs) rn)
@ -1488,19 +1440,13 @@ sim_store_register (sd, rn, memory, length)
void void
sim_do_command (sd, cmd) sim_do_command (SIM_DESC sd, const char *cmd)
SIM_DESC sd;
const char *cmd;
{ {
(*d10v_callback->printf_filtered) (d10v_callback, "sim_do_command: %s\n",cmd); (*d10v_callback->printf_filtered) (d10v_callback, "sim_do_command: %s\n",cmd);
} }
SIM_RC SIM_RC
sim_load (sd, prog, abfd, from_tty) sim_load (SIM_DESC sd, const char *prog, bfd *abfd, int from_tty)
SIM_DESC sd;
const char *prog;
bfd *abfd;
int from_tty;
{ {
extern bfd *sim_load_file (); /* ??? Don't know where this should live. */ extern bfd *sim_load_file (); /* ??? Don't know where this should live. */

File diff suppressed because it is too large Load diff