From 7237eb3f1c480d6bc7fe2832ddd36f2137fb69d9 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Thu, 15 Feb 2024 11:18:34 -0300 Subject: Fixed warnings from different compilers --- lauxlib.c | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'lauxlib.c') diff --git a/lauxlib.c b/lauxlib.c index f48060ed..634c85cd 100644 --- a/lauxlib.c +++ b/lauxlib.c @@ -1131,8 +1131,11 @@ static void warnfon (void *ud, const char *message, int tocont) { /* Size for the buffer in int's, rounded up */ #define BUFSEED ((BUFSEEDB + sizeof(int) - 1) / sizeof(int)) - -#define addbuff(b,v) (memcpy(b, &(v), sizeof(v)), b += sizeof(v)) +/* +** Copy the contents of variable 'v' into the buffer pointed by 'b'. +** (The '&b[0]' disguises 'b' to fix an absurd warning from clang.) +*/ +#define addbuff(b,v) (memcpy(&b[0], &(v), sizeof(v)), b += sizeof(v)) static unsigned int luai_makeseed (void) { @@ -1146,7 +1149,7 @@ static unsigned int luai_makeseed (void) { /* fill (rare but possible) remain of the buffer with zeros */ memset(b, 0, sizeof(buff) - BUFSEEDB); res = buff[0]; - for (i = 0; i < BUFSEED; i++) + for (i = 1; i < BUFSEED; i++) res ^= (res >> 3) + (res << 7) + buff[i]; return res; } -- cgit v1.2.3-55-g6feb