From: Dave Marples Date: Thu, 7 May 2020 08:26:46 +0000 (+0100) Subject: Small fixups to address compiler warnings etc. X-Git-Tag: 24jan2021_ls180~374^2~1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=967e38bb574d38ebb39f282aaa3fcc7bb93b45d5;p=litex.git Small fixups to address compiler warnings etc. --- diff --git a/litex/soc/interconnect/wishbonebridge.py b/litex/soc/interconnect/wishbonebridge.py index 3f5fc89f..00ec4a0c 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 448b2f67..a8af6cdf 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 be48cf65..7a2728bb 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 4df3987a..7fab2f4d 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 e79a1eeb..38b4b391 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 e056d328..1785676f 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;