From 967e38bb574d38ebb39f282aaa3fcc7bb93b45d5 Mon Sep 17 00:00:00 2001 From: Dave Marples Date: Thu, 7 May 2020 09:26:46 +0100 Subject: [PATCH] Small fixups to address compiler warnings etc. --- litex/soc/interconnect/wishbonebridge.py | 2 +- litex/soc/software/include/base/stdlib.h | 2 +- litex/soc/software/libbase/libc.c | 6 +++--- litex/soc/software/libbase/qsort.c | 6 +++--- litex/soc/software/libbase/strtod.c | 4 ++-- litex/soc/software/libbase/vsnprintf.c | 1 + 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/litex/soc/interconnect/wishbonebridge.py b/litex/soc/interconnect/wishbonebridge.py index 3f5fc89f5..00ec4a0ce 100644 --- a/litex/soc/interconnect/wishbonebridge.py +++ b/litex/soc/interconnect/wishbonebridge.py @@ -67,7 +67,7 @@ class WishboneStreamingBridge(Module): ] fsm = ResetInserter()(FSM(reset_state="IDLE")) - timer = WaitTimer(clk_freq//10) + timer = WaitTimer(int(clk_freq//10)) self.submodules += fsm, timer self.comb += [ fsm.reset.eq(timer.done), diff --git a/litex/soc/software/include/base/stdlib.h b/litex/soc/software/include/base/stdlib.h index 448b2f670..a8af6cdf2 100644 --- a/litex/soc/software/include/base/stdlib.h +++ b/litex/soc/software/include/base/stdlib.h @@ -46,7 +46,7 @@ static inline long int labs(long int x) return x > 0 ? x : -x; } -unsigned long strtoul(const char *nptr, char **endptr, int base); +unsigned long strtoul(const char *nptr, char **endptr, unsigned int base); long strtol(const char *nptr, char **endptr, int base); double strtod(const char *str, char **endptr); diff --git a/litex/soc/software/libbase/libc.c b/litex/soc/software/libbase/libc.c index be48cf651..7a2728bb7 100644 --- a/litex/soc/software/libbase/libc.c +++ b/litex/soc/software/libbase/libc.c @@ -374,7 +374,7 @@ void *memchr(const void *s, int c, size_t n) * @endptr: A pointer to the end of the parsed string will be placed here * @base: The number base to use */ -unsigned long strtoul(const char *nptr, char **endptr, int base) +unsigned long strtoul(const char *nptr, char **endptr, unsigned int base) { unsigned long result = 0,value; @@ -535,7 +535,7 @@ char *number(char *buf, char *end, unsigned long num, int base, int size, int pr */ int vscnprintf(char *buf, size_t size, const char *fmt, va_list args) { - int i; + size_t i; i=vsnprintf(buf,size,fmt,args); return (i >= size) ? (size - 1) : i; @@ -579,7 +579,7 @@ int snprintf(char * buf, size_t size, const char *fmt, ...) int scnprintf(char * buf, size_t size, const char *fmt, ...) { va_list args; - int i; + size_t i; va_start(args, fmt); i = vsnprintf(buf, size, fmt, args); diff --git a/litex/soc/software/libbase/qsort.c b/litex/soc/software/libbase/qsort.c index 4df3987a0..7fab2f4dc 100644 --- a/litex/soc/software/libbase/qsort.c +++ b/litex/soc/software/libbase/qsort.c @@ -196,15 +196,15 @@ loop: pn = (char *) base + nmemb * size; r = min(pa - (char *)base, pb - pa); vecswap(base, pb - r, r); - r = min(pd - pc, pn - pd - size); + r = min(pd - pc, pn - pd - (int)size); vecswap(pb, pn - r, r); - if ((r = pb - pa) > size) + if ((r = pb - pa) > (int)size) { qsort(base, r / size, size, compar); } - if ((r = pd - pc) > size) + if ((r = pd - pc) > (int)size) { /* Iterate rather than recurse to save stack space */ base = pn - r; diff --git a/litex/soc/software/libbase/strtod.c b/litex/soc/software/libbase/strtod.c index e79a1eeb6..38b4b3913 100644 --- a/litex/soc/software/libbase/strtod.c +++ b/litex/soc/software/libbase/strtod.c @@ -107,7 +107,7 @@ double strtod(const char *str, char **endptr) switch (*p) { case '-': - negative = 1; /* Fall through to increment position */ + negative = 1; /* FALLTHRU */ /* to increment position */ case '+': p++; } @@ -166,7 +166,7 @@ double strtod(const char *str, char **endptr) switch(*++p) { case '-': - negative = 1; /* Fall through to increment pos */ + negative = 1; /* FALLTHRU */ /* to increment pos */ case '+': p++; } diff --git a/litex/soc/software/libbase/vsnprintf.c b/litex/soc/software/libbase/vsnprintf.c index e056d328b..1785676f3 100644 --- a/litex/soc/software/libbase/vsnprintf.c +++ b/litex/soc/software/libbase/vsnprintf.c @@ -262,6 +262,7 @@ int vsnprintf(char *buf, size_t size, const char *fmt, va_list args) case 'X': flags |= PRINTF_LARGE; + /* FALLTHRU */ case 'x': base = 16; break;