Kill unused variables

Mark those that are unused but can't be killed accordingly.
This commit is contained in:
Tamas TEVESZ 2011-11-14 19:38:19 +01:00 committed by Daniel Beer
parent b77a482d7d
commit d98d990752
19 changed files with 97 additions and 21 deletions

View File

@ -208,6 +208,8 @@ static void bsl_destroy(device_t dev_base)
static int bsl_ctl(device_t dev_base, device_ctl_t type)
{
(void)dev_base;
switch (type) {
case DEVICE_CTL_HALT:
/* Ignore halt requests */
@ -226,17 +228,25 @@ static int bsl_ctl(device_t dev_base, device_ctl_t type)
static device_status_t bsl_poll(device_t dev_base)
{
(void)dev_base;
return DEVICE_STATUS_HALTED;
}
static int bsl_getregs(device_t dev_base, address_t *regs)
{
(void)dev_base;
(void)regs;
printc_err("bsl: register fetch is not implemented\n");
return -1;
}
static int bsl_setregs(device_t dev_base, const address_t *regs)
{
(void)dev_base;
(void)regs;
printc_err("bsl: register store is not implemented\n");
return -1;
}
@ -308,6 +318,8 @@ static int bsl_erase(device_t dev_base, device_erase_type_t type,
{
struct bsl_device *dev = (struct bsl_device *)dev_base;
(void)addr;
if (type != DEVICE_ERASE_MAIN) {
printc_err("bsl: only main erase is supported\n");
return -1;

View File

@ -437,6 +437,8 @@ static int flash_bsl_unlock(struct flash_bsl_device *dev)
static int flash_bsl_ctl(device_t dev_base, device_ctl_t type)
{
(void)dev_base;
switch (type) {
case DEVICE_CTL_HALT:
/* Ignore halt requests */
@ -455,17 +457,25 @@ static int flash_bsl_ctl(device_t dev_base, device_ctl_t type)
static device_status_t flash_bsl_poll(device_t dev_base)
{
(void)dev_base;
return DEVICE_STATUS_HALTED;
}
static int flash_bsl_getregs(device_t dev_base, address_t *regs)
{
(void)dev_base;
(void)regs;
printc_err("flash_bsl: register fetch is not implemented\n");
return -1;
}
static int flash_bsl_setregs(device_t dev_base, const address_t *regs)
{
(void)dev_base;
(void)regs;
printc_err("flash_bsl: register store is not implemented\n");
return -1;
}

View File

@ -299,6 +299,9 @@ static int gdbc_erase(device_t dev_base, device_erase_type_t type,
char buf[GDB_BUF_SIZE];
int len;
(void)type;
(void)addr;
gdb_packet_start(&dev->gdb);
gdb_printf(&dev->gdb, "qRcmd,");
while (*cmd)

View File

@ -726,6 +726,8 @@ static device_t sim_open(const struct device_args *args)
{
struct sim_device *dev = malloc(sizeof(*dev));
(void)args;
if (!dev) {
pr_error("can't allocate memory for simulation");
return NULL;

View File

@ -104,6 +104,9 @@ static void event_notify(unsigned int msg_id, unsigned int w_param,
{
struct tilib_device *dev = (struct tilib_device *)client_handle;
(void)w_param;
(void)l_param;
threads_lock_acquire(&dev->mb_lock);
dev->mailbox |= msg_id;
threads_lock_release(&dev->mb_lock);
@ -435,6 +438,8 @@ static void fw_progress(unsigned int msg_id, unsigned long w_param,
{
struct tilib_device *dev = (struct tilib_device *)client_handle;
(void)l_param;
switch (msg_id) {
case BL_DATA_BLOCK_PROGRAMMED:
if (w_param > 100)

View File

@ -28,7 +28,7 @@ int ihex_check(FILE *in)
return fgetc(in) == ':';
}
static int feed_line(FILE *in, uint8_t *data, int nbytes, binfile_imgcb_t cb,
static int feed_line(uint8_t *data, int nbytes, binfile_imgcb_t cb,
void *user_data, address_t *segment_offset)
{
uint8_t cksum = 0;
@ -134,7 +134,7 @@ int ihex_extract(FILE *in, binfile_imgcb_t cb, void *user_data)
}
/* Handle the line */
if (feed_line(in, data, nbytes, cb, user_data,
if (feed_line(data, nbytes, cb, user_data,
&segment_offset) < 0) {
printc_err("ihex: error on line %d\n", lno);
return -1;

View File

@ -159,6 +159,8 @@ static int cmd_devices(char **arg_text)
{
struct list_node *n;
(void)arg_text;
for (n = device_list.next; n != &device_list; n = n->next) {
struct simio_device *dev = (struct simio_device *)n;
int irq = -1;
@ -181,6 +183,8 @@ static int cmd_classes(char **arg_text)
struct vector v;
int i;
(void)arg_text;
vector_init(&v, sizeof(const char *));
for (i = 0; i < ARRAY_LEN(class_db); i++) {
if (vector_push(&v, &class_db[i]->name, 1) < 0) {

View File

@ -53,6 +53,8 @@ static struct simio_device *gpio_create(char **arg_text)
{
struct gpio *g;
(void)arg_text;
g = malloc(sizeof(*g));
if (!g) {
pr_error("gpio: can't allocate memory");

View File

@ -49,6 +49,8 @@ struct simio_device *hwmult_create(char **arg_text)
{
struct hwmult *h = malloc(sizeof(*h));
(void)arg_text;
if (!h) {
pr_error("hwmult: can't allocate memory");
return NULL;

View File

@ -417,6 +417,8 @@ static void timer_step(struct simio_device *dev,
int pulse_count;
int i;
(void)status;
/* Count input clock pulses */
i = (tr->tactl >> 8) & 3;
if (i == 2)

View File

@ -265,6 +265,8 @@ static int tracer_read(struct simio_device *dev,
{
struct tracer *tr = (struct tracer *)dev;
(void)data;
event_rec(tr, EVENT_READ_16, addr, 0);
return 1;
}
@ -283,6 +285,8 @@ static int tracer_read_b(struct simio_device *dev,
{
struct tracer *tr = (struct tracer *)dev;
(void)data;
event_rec(tr, EVENT_READ_8, addr, 0);
return 1;
}

View File

@ -62,6 +62,8 @@ struct simio_device *wdt_create(char **arg_text)
{
struct wdt *w = malloc(sizeof(*w));
(void)arg_text;
if (!w) {
pr_error("wdt: can't allocate memory");
return NULL;
@ -220,6 +222,8 @@ static void wdt_step(struct simio_device *dev, uint16_t status_register,
struct wdt *w = (struct wdt *)dev;
int max = 1;
(void)status_register;
/* If on hold, nothing happens */
if (w->wdtctl & WDTHOLD)
return;

View File

@ -38,6 +38,8 @@ int cmd_regs(char **arg)
uint8_t code[16];
int len = sizeof(code);
(void)arg;
if (device_getregs(regs) < 0)
return -1;
show_regs(regs);
@ -134,6 +136,8 @@ int cmd_mw(char **arg)
int cmd_reset(char **arg)
{
(void)arg;
return device_ctl(DEVICE_CTL_RESET);
}
@ -199,6 +203,8 @@ int cmd_run(char **arg)
device_status_t status;
address_t regs[DEVICE_NUM_REGS];
(void)arg;
if (device_getregs(regs) < 0) {
printc_err("warning: device: can't fetch registers\n");
} else {
@ -354,7 +360,7 @@ static int hexout_start(struct hexout_data *hexout, const char *filename)
return 0;
}
static int hexout_write(FILE *out, int len, uint16_t addr, int type,
static int hexout_write(FILE *out, int len, uint16_t addr,
const uint8_t *payload)
{
int i;
@ -393,13 +399,13 @@ static int hexout_flush(struct hexout_data *hexout)
if (segoff != hexout->segoff) {
uint8_t offset_data[] = {segoff >> 8, segoff & 0xff};
if (hexout_write(hexout->file, 2, 0, 4, offset_data) < 0)
if (hexout_write(hexout->file, 2, 0, offset_data) < 0)
return -1;
hexout->segoff = segoff;
}
if (hexout_write(hexout->file, hexout->len, addr_low,
0, hexout->buf) < 0)
hexout->buf) < 0)
return -1;
hexout->len = 0;
return 0;
@ -628,6 +634,8 @@ int cmd_break(char **arg)
{
int i;
(void)arg;
printc("%d breakpoints available:\n", device_default->max_breakpoints);
for (i = 0; i < device_default->max_breakpoints; i++) {
const struct device_breakpoint *bp =

View File

@ -210,7 +210,7 @@ static int write_memory(struct gdb_data *data, char *text)
return gdb_send(data, "OK");
}
static int run_set_pc(struct gdb_data *data, char *buf)
static int run_set_pc(char *buf)
{
address_t regs[DEVICE_NUM_REGS];
@ -257,7 +257,7 @@ static int single_step(struct gdb_data *data, char *buf)
{
printc("Single stepping\n");
if (run_set_pc(data, buf) < 0 ||
if (run_set_pc(buf) < 0 ||
device_ctl(DEVICE_CTL_STEP) < 0)
gdb_send(data, "E00");
@ -268,7 +268,7 @@ static int run(struct gdb_data *data, char *buf)
{
printc("Running\n");
if (run_set_pc(data, buf) < 0 ||
if (run_set_pc(buf) < 0 ||
device_ctl(DEVICE_CTL_RUN) < 0)
return gdb_send(data, "E00");
@ -372,7 +372,7 @@ static int gdb_send_supported(struct gdb_data *data)
return gdb_flush_ack(data);
}
static int process_gdb_command(struct gdb_data *data, char *buf, int len)
static int process_gdb_command(struct gdb_data *data, char *buf)
{
#ifdef DEBUG_GDB
printc("process_gdb_command: %s\n", buf);
@ -434,7 +434,7 @@ static void gdb_reader_loop(struct gdb_data *data)
len = gdb_read_packet(data, buf);
if (len < 0)
return;
if (len && process_gdb_command(data, buf, len) < 0)
if (len && process_gdb_command(data, buf) < 0)
return;
}
}

View File

@ -55,6 +55,8 @@ static int isearch_opcode(const char *term, char **arg,
const char *opname = get_arg(arg);
int opc;
(void)term;
if (q->flags & ISEARCH_OPCODE) {
printc_err("isearch: opcode already specified\n");
return -1;
@ -79,6 +81,8 @@ static int isearch_opcode(const char *term, char **arg,
static int isearch_bw(const char *term, char **arg,
struct isearch_query *q)
{
(void)arg;
if (q->flags & ISEARCH_DSIZE) {
printc_err("isearch: operand size already specified\n");
return -1;
@ -105,6 +109,8 @@ static int isearch_bw(const char *term, char **arg,
static int isearch_type(const char *term, char **arg,
struct isearch_query *q)
{
(void)arg;
if (q->flags & ISEARCH_TYPE) {
printc_err("isearch: instruction type already "
"specified\n");

View File

@ -47,6 +47,8 @@ static const char *type_text(opdb_type_t type)
static int push_option_name(void *user_data, const struct opdb_key *key,
const union opdb_value *value)
{
(void)value;
return vector_push((struct vector *)user_data, &key->name, 1);
}
@ -138,6 +140,8 @@ static int parse_option(opdb_type_t type, union opdb_value *value,
static int display_option(void *user_data, const struct opdb_key *key,
const union opdb_value *value)
{
(void)user_data;
printc("%32s = ", key->name);
switch (key->type) {
@ -203,6 +207,8 @@ int cmd_read(char **arg)
int cmd_exit(char **arg)
{
(void)arg;
reader_exit();
return 0;
}

View File

@ -130,6 +130,8 @@ static int cmd_sym_savemap(char **arg)
static int print_sym(void *user_data, const char *name, address_t value)
{
(void)user_data;
printc("0x%04x: %s\n", value, name);
return 0;
}
@ -221,6 +223,8 @@ static int find_renames(void *user_data, const char *name, address_t value)
struct rename_data *rename = (struct rename_data *)user_data;
regmatch_t pmatch;
(void)value;
if (!regexec(&rename->preg, name, 1, &pmatch, 0) &&
pmatch.rm_so >= 0 && pmatch.rm_eo > pmatch.rm_so) {
struct rename_record r;

View File

@ -32,8 +32,8 @@
/* Disassembler
*/
static int decode_00xx(const uint8_t *code, address_t offset,
address_t len, struct msp430_instruction *insn)
static int decode_00xx(const uint8_t *code, address_t len,
struct msp430_instruction *insn)
{
uint16_t op = code[0] | (code[1] << 8);
int subtype = (op >> 4) & 0xf;
@ -155,8 +155,8 @@ static int decode_00xx(const uint8_t *code, address_t offset,
return -1;
}
static int decode_13xx(const uint8_t *code, address_t offset,
address_t len, struct msp430_instruction *insn)
static int decode_13xx(const uint8_t *code, address_t len,
struct msp430_instruction *insn)
{
uint16_t op = code[0] | (code[1] << 8);
int subtype = (op >> 4) & 0xf;
@ -218,8 +218,8 @@ static int decode_13xx(const uint8_t *code, address_t offset,
return 4;
}
static int decode_14xx(const uint8_t *code, address_t offset,
address_t size, struct msp430_instruction *insn)
static int decode_14xx(const uint8_t *code,
struct msp430_instruction *insn)
{
uint16_t op = (code[1] << 8) | code[0];
@ -384,7 +384,7 @@ static int decode_double(const uint8_t *code, address_t offset,
* All jump instructions are one word in length, so this function
* always returns 2 (to indicate the consumption of 2 bytes).
*/
static int decode_jump(const uint8_t *code, address_t offset, address_t len,
static int decode_jump(const uint8_t *code, address_t offset,
struct msp430_instruction *insn)
{
uint16_t op = (code[1] << 8) | code[0];
@ -790,15 +790,15 @@ int dis_decode(const uint8_t *code, address_t offset, address_t len,
insn->dsize |= 2;
} else {
if ((op & 0xf000) == 0x0000)
ret = decode_00xx(code, offset, len, insn);
ret = decode_00xx(code, len, insn);
else if ((op & 0xfc00) == 0x1400)
ret = decode_14xx(code, offset, len, insn);
ret = decode_14xx(code, insn);
else if ((op & 0xff00) == 0x1300)
ret = decode_13xx(code, offset, len, insn);
ret = decode_13xx(code, len, insn);
else if ((op & 0xf000) == 0x1000)
ret = decode_single(code, offset, len, insn);
else if ((op & 0xf000) >= 0x2000 && (op & 0xf000) < 0x4000)
ret = decode_jump(code, offset, len, insn);
ret = decode_jump(code, offset, insn);
else if ((op & 0xf000) >= 0x4000)
ret = decode_double(code, offset, len, insn);
else

View File

@ -92,6 +92,8 @@ static volatile int ctrlc_flag;
static void sigint_handler(int signum)
{
(void)signum;
ctrlc_flag = 1;
}