From: Stafford Horne Date: Thu, 4 Oct 2018 14:07:48 +0000 (+0900) Subject: Fix compiler warnings from GCC 8.1 X-Git-Tag: 24jan2021_ls180~1571^2~1 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=dafdb8df7269a9e083a04245e1e65ccf12c6ea4f;p=litex.git Fix compiler warnings from GCC 8.1 Fix these 2 warnings: litex/build/sim/core/libdylib.c:42:5: warning: 'strncpy' specified bound 2048 equals destination size [-Wstringop-truncation] strncpy(last_err, s, ERR_MAX_SIZE); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In function 'set_last_error', litex/soc/software/libbase/exception.c:28:13: warning: function declaration isn't a prototype [-Wstrict-prototypes] static char emerg_getc() --- diff --git a/litex/build/sim/core/libdylib.c b/litex/build/sim/core/libdylib.c index ba8cdb6a..aaf08228 100644 --- a/litex/build/sim/core/libdylib.c +++ b/litex/build/sim/core/libdylib.c @@ -39,7 +39,7 @@ static void set_last_error(const char *s) if (!s) s = "NULL error"; last_err_set = 1; - strncpy(last_err, s, ERR_MAX_SIZE); + strncpy(last_err, s, ERR_MAX_SIZE-1); } static dylib_ref dylib_ref_alloc (void *handle, const char *path) diff --git a/litex/soc/software/libbase/exception.c b/litex/soc/software/libbase/exception.c index b758e58e..09b26399 100644 --- a/litex/soc/software/libbase/exception.c +++ b/litex/soc/software/libbase/exception.c @@ -25,7 +25,7 @@ static void emerg_printf(const char *fmt, ...) } } -static char emerg_getc() +static char emerg_getc(void) { while(uart_rxempty_read()); char c = uart_rxtx_read();