[warnings] add -Wshadow which helps detect local variables that override globals
Nothing particularly bad showed up but cleaned up a bit of code.
This commit is contained in:
@@ -129,13 +129,11 @@ static int do_boot(lkb_t *lkb, size_t len, const char **result) {
|
||||
/* sniff it to see if it's a bootimage or a raw image */
|
||||
bootimage_t *bi;
|
||||
if (bootimage_open(buf, len, &bi) >= 0) {
|
||||
size_t len;
|
||||
|
||||
/* it's a bootimage */
|
||||
TRACEF("detected bootimage\n");
|
||||
|
||||
/* find the lk image */
|
||||
if (bootimage_get_file_section(bi, TYPE_LK, &ptr, &len) >= 0) {
|
||||
if (bootimage_get_file_section(bi, TYPE_LK, &ptr, NULL) >= 0) {
|
||||
TRACEF("found lk section at %p\n", ptr);
|
||||
|
||||
/* add the boot image to the argument list */
|
||||
@@ -378,9 +376,9 @@ int lkb_handle_command(lkb_t *lkb, const char *cmd, const char *arg, size_t len,
|
||||
return do_boot(lkb, len, result);
|
||||
} else if (!strcmp(cmd, "getsysparam")) {
|
||||
const void *ptr;
|
||||
size_t len;
|
||||
if (sysparam_get_ptr(arg, &ptr, &len) == 0) {
|
||||
lkb_write(lkb, ptr, len);
|
||||
size_t len_local;
|
||||
if (sysparam_get_ptr(arg, &ptr, &len_local) == 0) {
|
||||
lkb_write(lkb, ptr, len_local);
|
||||
}
|
||||
} else if (!strcmp(cmd, "reboot")) {
|
||||
thread_resume(thread_create("reboot", &do_reboot, NULL,
|
||||
|
||||
@@ -23,8 +23,8 @@ static uint8_t *dst2;
|
||||
#define ITERATIONS (256*1024*1024 / BUFFER_SIZE) // enough iterations to have to copy/set 256MB of memory
|
||||
|
||||
#if 1
|
||||
static inline void *mymemcpy(void *dst, const void *src, size_t len) { return memcpy(dst, src, len); }
|
||||
static inline void *mymemset(void *dst, int c, size_t len) { return memset(dst, c, len); }
|
||||
static inline void *mymemcpy(void *dest, const void *source, size_t len) { return memcpy(dest, source, len); }
|
||||
static inline void *mymemset(void *dest, int c, size_t len) { return memset(dest, c, len); }
|
||||
#else
|
||||
// if we're testing our own memcpy, use this
|
||||
extern void *mymemcpy(void *dst, const void *src, size_t len);
|
||||
@@ -37,17 +37,17 @@ typedef long word;
|
||||
#define lsize sizeof(word)
|
||||
#define lmask (lsize - 1)
|
||||
|
||||
static void *c_memmove(void *dest, void const *src, size_t count) {
|
||||
static void *c_memmove(void *dest, void const *source, size_t count) {
|
||||
char *d = (char *)dest;
|
||||
const char *s = (const char *)src;
|
||||
const char *s = (const char *)source;
|
||||
int len;
|
||||
|
||||
if (count == 0 || dest == src)
|
||||
if (count == 0 || dest == source)
|
||||
return dest;
|
||||
|
||||
if ((long)d < (long)s) {
|
||||
if (((long)d | (long)s) & lmask) {
|
||||
// src and/or dest do not align on word boundary
|
||||
// source and/or dest do not align on word boundary
|
||||
if ((((long)d ^ (long)s) & lmask) || (count < lsize))
|
||||
len = count; // copy the rest of the buffer with the byte mover
|
||||
else
|
||||
@@ -122,8 +122,8 @@ static void *c_memset(void *s, int c, size_t count) {
|
||||
return s;
|
||||
}
|
||||
|
||||
static void *null_memcpy(void *dst, const void *src, size_t len) {
|
||||
return dst;
|
||||
static void *null_memcpy(void *dest, const void *source, size_t len) {
|
||||
return dest;
|
||||
}
|
||||
|
||||
static lk_time_t bench_memcpy_routine(void *memcpy_routine(void *, const void *, size_t), size_t srcalign, size_t dstalign) {
|
||||
|
||||
@@ -294,7 +294,7 @@ int two_threads_basic(void) {
|
||||
// wait for the pong port to be created, the two threads race to do it.
|
||||
port_t r_port;
|
||||
while (true) {
|
||||
status_t st = port_open("pong_port", NULL, &r_port);
|
||||
st = port_open("pong_port", NULL, &r_port);
|
||||
if (st == NO_ERROR) {
|
||||
break;
|
||||
} else if (st == ERR_NOT_FOUND) {
|
||||
@@ -402,8 +402,8 @@ typedef struct {
|
||||
} watcher_cmd;
|
||||
|
||||
status_t send_watcher_cmd(port_t cmd_port, action_t action, port_t port) {
|
||||
watcher_cmd cmd = {action, port};
|
||||
return port_write(cmd_port, ((port_packet_t *) &cmd), 1);;
|
||||
watcher_cmd _cmd = {action, port};
|
||||
return port_write(cmd_port, ((port_packet_t *) &_cmd), 1);;
|
||||
}
|
||||
|
||||
static int group_watcher_thread(void *arg) {
|
||||
|
||||
@@ -101,7 +101,7 @@ static void zynq_common_target_init(uint level) {
|
||||
/* we were loaded from spi flash, go look at it to see if we can find it */
|
||||
if (spi) {
|
||||
void *ptr = 0;
|
||||
int err = bio_ioctl(spi, BIO_IOCTL_GET_MEM_MAP, (void *)&ptr);
|
||||
err = bio_ioctl(spi, BIO_IOCTL_GET_MEM_MAP, (void *)&ptr);
|
||||
if (err >= 0) {
|
||||
put_bio_memmap = true;
|
||||
ptr = (uint8_t *)ptr + bootimage_phys;
|
||||
|
||||
Reference in New Issue
Block a user