From b8bbaaef3abb6c8dd4f768c51684f3ad97173b07 Mon Sep 17 00:00:00 2001 From: Tim 'mithro' Ansell Date: Sun, 19 Apr 2015 16:54:57 +1000 Subject: [PATCH] Fixing shadowing of global index function. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes the following warnings; ``` cc -Wall -O2 -fPIC -Wall -Wshadow -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -I/usr/include/iverilog -c -o ipc.o ipc.c ipc.c: In function ‘ipc_receive’: ipc.c:98:17: warning: declaration of ‘index’ shadows a global declaration [-Wshadow] ipc.c:113:17: warning: declaration of ‘index’ shadows a global declaration [-Wshadow] ``` Fixes https://github.com/m-labs/migen/issues/14 --- vpi/ipc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/vpi/ipc.c b/vpi/ipc.c index ee1920e5e..8b1357c71 100644 --- a/vpi/ipc.c +++ b/vpi/ipc.c @@ -95,29 +95,29 @@ int ipc_receive(struct ipc_softc *sc) char *name; int nchunks; unsigned char *chunks; - unsigned int index; + unsigned int chunk_index; name = (char *)&buffer[i]; i += strlen(name) + 1; assert((i+4) < l); - index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24; + chunk_index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24; i += 4; nchunks = buffer[i++]; assert(i + nchunks == l); chunks = (unsigned char *)&buffer[i]; - return sc->h_write(name, index, nchunks, chunks, sc->user); + return sc->h_write(name, chunk_index, nchunks, chunks, sc->user); } case MESSAGE_READ: { char *name; - unsigned int index; + unsigned int name_index; name = (char *)&buffer[i]; i += strlen(name) + 1; assert((i+4) == l); - index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24; + name_index = buffer[i] | buffer[i+1] << 8 | buffer[i+2] << 16 | buffer[i+3] << 24; - return sc->h_read(name, index, sc->user); + return sc->h_read(name, name_index, sc->user); } default: return 0;