[warnings] fix warnings across the entire code base

Fix or squelch all warnings in all code covered by buildall.
This commit is contained in:
Travis Geiselbrecht
2018-12-16 17:33:22 -08:00
parent e608867d71
commit f98cef7992
19 changed files with 52 additions and 38 deletions

View File

@@ -247,7 +247,7 @@ __NO_INLINE static void bench_sincos(void)
#endif // WITH_LIB_LIBM
void benchmarks(void)
int benchmarks(int argc, const cmd_args *argv)
{
bench_set_overhead();
bench_memset();
@@ -269,5 +269,7 @@ void benchmarks(void)
#if WITH_LIB_LIBM
bench_sincos();
#endif
return NO_ERROR;
}

View File

@@ -30,7 +30,7 @@
#include <kernel/event.h>
#include <platform.h>
void clock_tests(void)
int clock_tests(int argc, const cmd_args *argv)
{
uint32_t c;
lk_time_t t;
@@ -118,4 +118,6 @@ void clock_tests(void)
cycles = arch_cycle_count() - cycles;
printf("%u cycles per second\n", cycles);
}
return NO_ERROR;
}

View File

@@ -27,13 +27,13 @@
int cbuf_tests(int argc, const cmd_args *argv);
int fibo(int argc, const cmd_args *argv);
int port_tests(void);
int port_tests(int argc, const cmd_args *argv);
int spinner(int argc, const cmd_args *argv);
int thread_tests(void);
void benchmarks(void);
void clock_tests(void);
void printf_tests(void);
void printf_tests_float(void);
int thread_tests(int argc, const cmd_args *argv);
int benchmarks(int argc, const cmd_args *argv);
int clock_tests(int argc, const cmd_args *argv);
int printf_tests(int argc, const cmd_args *argv);
int printf_tests_float(int argc, const cmd_args *argv);
#endif

View File

@@ -21,11 +21,12 @@
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
#include <app/tests.h>
#include <err.h>
#include <stdio.h>
#include <string.h>
#include <debug.h>
void printf_tests(void)
int printf_tests(int argc, const cmd_args *argv)
{
printf("printf tests\n");
@@ -116,11 +117,13 @@ void printf_tests(void)
err = snprintf(buf, 15, "0123456789abcdef012345678");
printf("snprintf returns %d\n", err);
hexdump8(buf, sizeof(buf));
return NO_ERROR;
}
#include "float_test_vec.c"
void printf_tests_float(void)
int printf_tests_float(int argc, const cmd_args *argv)
{
printf("floating point printf tests\n");
@@ -128,6 +131,7 @@ void printf_tests_float(void)
PRINT_FLOAT;
}
return NO_ERROR;
}

View File

@@ -29,14 +29,14 @@
#include <lib/console.h>
STATIC_COMMAND_START
STATIC_COMMAND("printf_tests", "test printf", (console_cmd)&printf_tests)
STATIC_COMMAND("printf_tests_float", "test printf with floating point", (console_cmd)&printf_tests_float)
STATIC_COMMAND("thread_tests", "test the scheduler", (console_cmd)&thread_tests)
STATIC_COMMAND("port_tests", "test the ports", (console_cmd)&port_tests)
STATIC_COMMAND("clock_tests", "test clocks", (console_cmd)&clock_tests)
STATIC_COMMAND("bench", "miscellaneous benchmarks", (console_cmd)&benchmarks)
STATIC_COMMAND("fibo", "threaded fibonacci", (console_cmd)&fibo)
STATIC_COMMAND("spinner", "create a spinning thread", (console_cmd)&spinner)
STATIC_COMMAND("printf_tests", "test printf", &printf_tests)
STATIC_COMMAND("printf_tests_float", "test printf with floating point", &printf_tests_float)
STATIC_COMMAND("thread_tests", "test the scheduler", &thread_tests)
STATIC_COMMAND("port_tests", "test the ports", &port_tests)
STATIC_COMMAND("clock_tests", "test clocks", &clock_tests)
STATIC_COMMAND("bench", "miscellaneous benchmarks", &benchmarks)
STATIC_COMMAND("fibo", "threaded fibonacci", &fibo)
STATIC_COMMAND("spinner", "create a spinning thread", &spinner)
STATIC_COMMAND("cbuf_tests", "test lib/cbuf", &cbuf_tests)
STATIC_COMMAND_END(tests);
@@ -48,6 +48,6 @@ static void tests_init(const struct app_descriptor *app)
APP_START(tests)
.init = tests_init,
.flags = 0,
APP_END
.flags = 0,
APP_END

View File

@@ -616,7 +616,7 @@ static void spinlock_test(void)
#undef COUNT
}
int thread_tests(void)
int thread_tests(int argc, const cmd_args *argv)
{
mutex_test();
semaphore_test();

View File

@@ -35,5 +35,7 @@ MODULE_SRCS += \
$(LOCAL_DIR)/lpc_chip_15xx/src/uart_15xx.c \
$(LOCAL_DIR)/lpc_chip_15xx/src/wwdt_15xx.c \
MODULE_COMPILEFLAGS += -Wno-error
include make/module.mk

View File

@@ -323,7 +323,7 @@ MPURegionSet(unsigned long ulRegion, unsigned long ulAddr,
// Check the arguments.
//
ASSERT(ulRegion < 8);
ASSERT((ulAddr & ~0 << (((ulFlags & NVIC_MPU_ATTR_SIZE_M) >> 1) + 1))
ASSERT((ulAddr & ~0u << (((ulFlags & NVIC_MPU_ATTR_SIZE_M) >> 1) + 1))
== ulAddr);
//

View File

@@ -46,4 +46,6 @@ MODULE_SRCS += $(LOCAL_DIR)/stm32f0xx_hal.c \
$(LOCAL_DIR)/stm32f0xx_hal_usart.c \
$(LOCAL_DIR)/stm32f0xx_hal_wwdg.c
MODULE_COMPILEFLAGS += -Wno-error
include make/module.mk

View File

@@ -392,8 +392,6 @@ static void SetSysClock(void)
/* Wait till the main PLL is used as system clock source */
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL);
{
}
}
else
{ /* If HSE fails to start-up, the application will have wrong clock

View File

@@ -753,8 +753,6 @@ static void SetSysClock(void)
/* Wait till the main PLL is used as system clock source */
while ((RCC->CFGR & (uint32_t)RCC_CFGR_SWS ) != RCC_CFGR_SWS_PLL);
{
}
}
else
{ /* If HSE fails to start-up, the application will have wrong clock

View File

@@ -71,5 +71,7 @@ MODULE_SRCS += \
include $(LOCAL_DIR)/CMSIS/rules.mk
MODULE_COMPILEFLAGS += -Wno-error
include make/module.mk

View File

@@ -186,7 +186,8 @@ void uthread_context_switch(thread_t *oldthread, thread_t *newthread);
#endif
/* called on every timer tick for the scheduler to do quantum expiration */
enum handler_return thread_timer_tick(void);
struct timer;
enum handler_return thread_timer_tick(struct timer *, lk_time_t now, void *arg);
/* the current thread */
thread_t *get_current_thread(void);

View File

@@ -565,7 +565,7 @@ void thread_resched(void)
dprintf(ALWAYS, "arch_context_switch: start preempt, cpu %d, old %p (%s), new %p (%s)\n",
cpu, oldthread, oldthread->name, newthread, newthread->name);
#endif
timer_set_periodic(&preempt_timer[cpu], 10, (timer_callback)thread_timer_tick, NULL);
timer_set_periodic(&preempt_timer[cpu], 10, thread_timer_tick, NULL);
}
#endif
@@ -726,7 +726,7 @@ void thread_unblock(thread_t *t, bool resched)
thread_resched();
}
enum handler_return thread_timer_tick(void)
enum handler_return thread_timer_tick(struct timer *t, lk_time_t now, void *arg)
{
thread_t *current_thread = get_current_thread();

View File

@@ -291,7 +291,7 @@ static enum handler_return timer_tick(void *arg, lk_time_t now)
/* let the scheduler have a shot to do quantum expiration, etc */
/* in case of dynamic timer, the scheduler will set up a periodic timer */
if (thread_timer_tick() == INT_RESCHEDULE)
if (thread_timer_tick(NULL, now, NULL) == INT_RESCHEDULE)
ret = INT_RESCHEDULE;
#endif

View File

@@ -265,9 +265,9 @@ static bool test_full_toc(const char *dev_name)
filenum[1] += (i / 10) % 10;
filenum[2] += i % 10;
strncat(test_file_name, MNT_PATH, strlen(MNT_PATH));
strncat(test_file_name, "/", 1);
strncat(test_file_name, filenum, strlen(filenum));
strlcat(test_file_name, MNT_PATH, sizeof(test_file_name));
strlcat(test_file_name, "/", sizeof(test_file_name));
strlcat(test_file_name, filenum, sizeof(test_file_name));
status_t status =
fs_create_file(test_file_name, &handle, 1);

View File

@@ -735,10 +735,11 @@ status_t ptable_create_default(const char *bdev_name, uint64_t offset)
/* Publish the ptable partition */
struct ptable_entry ptable_entry;
memset(&ptable_entry, 0, sizeof(ptable_entry));
ptable_entry.offset = offset;
ptable_entry.length = len;
ptable_entry.flags = 0;
strncpy((char *)ptable_entry.name, PTABLE_PART_NAME, sizeof(ptable_entry.name));
strlcpy((char *)ptable_entry.name, PTABLE_PART_NAME, sizeof(ptable_entry.name));
err = ptable_publish(&ptable_entry);
if (err < 0) {
LTRACEF("Failed to publish ptable partition\n");
@@ -816,10 +817,11 @@ status_t ptable_add(const char *name, uint64_t min_len, uint32_t flags)
/* Attempt to publish the partition */
struct ptable_entry ptable_entry;
memset(&ptable_entry, 0, sizeof(ptable_entry));
ptable_entry.offset = part_loc;
ptable_entry.length = min_len;
ptable_entry.flags = 0;
strncpy((char *)ptable_entry.name, name, sizeof(ptable_entry.name));
strlcpy((char *)ptable_entry.name, name, sizeof(ptable_entry.name));
status_t err = ptable_publish(&ptable_entry);
if (err < 0) {
LTRACEF("Failed to publish\n");

View File

@@ -106,7 +106,7 @@ int uart_getc(int port, bool wait)
}
}
void uart_irq_handler(void)
enum handler_return uart_irq_handler(void *arg)
{
while ( (UARTREG(uart_base, S912D_UART_STATUS) & S912D_UART_STATUS_RXCOUNT_MASK) > 0 ) {
if (cbuf_space_avail(&uart_rx_buf) == 0) {
@@ -115,6 +115,8 @@ void uart_irq_handler(void)
char c = UARTREG(uart_base, S912D_UART_RFIFO);
cbuf_write_char(&uart_rx_buf, c,false);
}
return INT_RESCHEDULE;
}
void uart_init_early(void)
@@ -177,4 +179,4 @@ void uart_init(void)
// enable interrupts
unmask_interrupt(uart_irq);
}
}

View File

@@ -32,7 +32,6 @@
#include <kernel/thread.h>
static lk_time_t system_time = 0;
static volatile lk_time_t ticks = 0;
static lk_time_t tick_interval;