From 624841257ca2ca8381d3dc5e98f2d0930b71cf24 Mon Sep 17 00:00:00 2001 From: hendricks266 Date: Mon, 18 Feb 2013 08:50:08 +0000 Subject: [PATCH] Wii: Fix most warnings. Three remain: two are labeled with FIXMEs; the third consists of signed/unsigned comparisons involving LSWAPIB() in kplib.c. git-svn-id: https://svn.eduke32.com/eduke32@3496 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/Makefile.common | 1 + polymer/eduke32/build/Makefile | 2 +- polymer/eduke32/build/include/compat.h | 11 +++++++++ polymer/eduke32/build/src/compat.c | 1 + polymer/eduke32/build/src/engine.c | 12 +++++++--- polymer/eduke32/build/src/pragmas.c | 1 + polymer/eduke32/source/enet/src/unix.c | 28 ++++++++++++++++++++--- polymer/eduke32/source/jaudiolib/Makefile | 4 +++- 8 files changed, 52 insertions(+), 8 deletions(-) diff --git a/polymer/eduke32/Makefile.common b/polymer/eduke32/Makefile.common index af3bfa173..3ddbb711f 100644 --- a/polymer/eduke32/Makefile.common +++ b/polymer/eduke32/Makefile.common @@ -390,6 +390,7 @@ BASECOMMONFLAGS=$(debug) $(OPTOPT) $(CWARNS) \ ifneq (0,$(CLANG)) BASECOMMONFLAGS+= -Wno-unused-value -Wno-parentheses endif +BASECOMMONFLAGS+= -Wno-char-subscripts ifeq (0,$(NETCODE)) BASECOMMONFLAGS+= -DNETCODE_DISABLE diff --git a/polymer/eduke32/build/Makefile b/polymer/eduke32/build/Makefile index 49ed5c909..9c2dcc97d 100644 --- a/polymer/eduke32/build/Makefile +++ b/polymer/eduke32/build/Makefile @@ -32,7 +32,7 @@ endif include Makefile.shared -OURCOMMONFLAGS=$(BASECOMMONFLAGS) -Wno-char-subscripts -I$(INC) +OURCOMMONFLAGS=$(BASECOMMONFLAGS) -I$(INC) OURCFLAGS=$(OURCOMMONFLAGS) $(BASECFLAGS) OURCONLYFLAGS=$(BASECONLYFLAGS) OURCXXFLAGS=$(BASECXXFLAGS) diff --git a/polymer/eduke32/build/include/compat.h b/polymer/eduke32/build/include/compat.h index 8209773ed..7728860f0 100644 --- a/polymer/eduke32/build/include/compat.h +++ b/polymer/eduke32/build/include/compat.h @@ -42,6 +42,17 @@ #ifdef HAVE_INTTYPES # include # include + +// Ghetto. Blame devkitPPC's faulty headers. +#ifdef GEKKO +# undef PRIdPTR +# define PRIdPTR "d" +# undef PRIxPTR +# define PRIxPTR "x" +# undef SCNx32 +# define SCNx32 "x" +#endif + #elif defined(_MSC_VER) # include "msvc/inttypes.h" // from http://code.google.com/p/msinttypes/ #endif diff --git a/polymer/eduke32/build/src/compat.c b/polymer/eduke32/build/src/compat.c index 2b9575f41..d3e6e2ac7 100644 --- a/polymer/eduke32/build/src/compat.c +++ b/polymer/eduke32/build/src/compat.c @@ -878,6 +878,7 @@ int access(const char *pathname, int mode) return -1; // TODO: Check mode against st_mode + UNREFERENCED_PARAMETER(mode); return 0; } diff --git a/polymer/eduke32/build/src/engine.c b/polymer/eduke32/build/src/engine.c index 3b1af3a6e..94f955262 100644 --- a/polymer/eduke32/build/src/engine.c +++ b/polymer/eduke32/build/src/engine.c @@ -5516,6 +5516,8 @@ static void drawsprite_opengl(int32_t snum) bglDisable(GL_ALPHA_TEST); } # endif +#else + UNREFERENCED_PARAMETER(snum); #endif //============================================================================= //POLYMOST ENDS } @@ -14325,7 +14327,7 @@ void completemirror(void) for (dy=mirrorsy2-mirrorsy1-1; dy>=0; dy--) { copybufbyte((void *)(p+1),tempbuf,mirrorsx2+1); - tempbuf[mirrorsx2] = tempbuf[mirrorsx2-1]; + tempbuf[mirrorsx2] = tempbuf[mirrorsx2-1]; // FIXME: with GEKKO, array subscripts are below array bounds copybufreverse(&tempbuf[mirrorsx2],(void *)(p+i),mirrorsx2+1); p += ylookup[1]; faketimerhandler(); @@ -16187,10 +16189,14 @@ static int32_t screencapture_png(const char *filename, char inverseit, const cha static int32_t screencapture_tga(const char *filename, char inverseit) { - int32_t i,j; + int32_t i; char *ptr, head[18] = { 0,1,1,0,0,0,1,24,0,0,0,0,0/*wlo*/,0/*whi*/,0/*hlo*/,0/*hhi*/,8,0 }; //char palette[4*256]; - char *fn = Bstrdup(filename), *inversebuf; + char *fn = Bstrdup(filename); +# ifdef USE_OPENGL + int32_t j; + char *inversebuf; +# endif BFILE *fil; i = screencapture_common1(fn, "tga", &fil); diff --git a/polymer/eduke32/build/src/pragmas.c b/polymer/eduke32/build/src/pragmas.c index 70944cd03..09bf1da42 100644 --- a/polymer/eduke32/build/src/pragmas.c +++ b/polymer/eduke32/build/src/pragmas.c @@ -15,6 +15,7 @@ int32_t dmval; #if defined(__GNUC__) && defined(GEKKO) // naked function (no prolog/epilog) +// FIXME: this function produces unused parameter warnings and a missing return warning int32_t scale(int32_t a, int32_t d, int32_t c) { // return ((int64_t)a * d) / c; diff --git a/polymer/eduke32/source/enet/src/unix.c b/polymer/eduke32/source/enet/src/unix.c index f0e57b17f..5d4754476 100644 --- a/polymer/eduke32/source/enet/src/unix.c +++ b/polymer/eduke32/source/enet/src/unix.c @@ -4,6 +4,10 @@ */ #ifndef WIN32 +#ifndef UNREFERENCED_PARAMETER + #define UNREFERENCED_PARAMETER(x) x=x +#endif + #if defined(GEKKO) # include # define gethostbyname net_gethostbyname @@ -172,8 +176,9 @@ enet_address_get_host_ip (const ENetAddress * address, char * name, size_t nameL int enet_address_get_host (const ENetAddress * address, char * name, size_t nameLength) { - struct in_addr in; struct hostent * hostEntry = NULL; +#ifndef GEKKO + struct in_addr in; #ifdef HAS_GETHOSTBYADDR_R struct hostent hostData; char buffer [2048]; @@ -190,6 +195,7 @@ enet_address_get_host (const ENetAddress * address, char * name, size_t nameLeng in.s_addr = address -> host; hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET); +#endif #endif if (hostEntry == NULL) @@ -342,9 +348,10 @@ enet_socket_send (ENetSocket socket, const ENetBuffer * buffers, size_t bufferCount) { + int sentLength = -1; +#ifndef GEKKO struct msghdr msgHdr; struct sockaddr_in sin; - int sentLength; memset (& msgHdr, 0, sizeof (struct msghdr)); @@ -364,6 +371,12 @@ enet_socket_send (ENetSocket socket, msgHdr.msg_iovlen = bufferCount; sentLength = sendmsg (socket, & msgHdr, MSG_NOSIGNAL); +#else + UNREFERENCED_PARAMETER(socket); + UNREFERENCED_PARAMETER(address); + UNREFERENCED_PARAMETER(buffers); + UNREFERENCED_PARAMETER(bufferCount); +#endif if (sentLength == -1) { @@ -382,9 +395,10 @@ enet_socket_receive (ENetSocket socket, ENetBuffer * buffers, size_t bufferCount) { + int recvLength = -1; +#ifndef GEKKO struct msghdr msgHdr; struct sockaddr_in sin; - int recvLength; memset (& msgHdr, 0, sizeof (struct msghdr)); @@ -398,6 +412,12 @@ enet_socket_receive (ENetSocket socket, msgHdr.msg_iovlen = bufferCount; recvLength = recvmsg (socket, & msgHdr, MSG_NOSIGNAL); +#else + UNREFERENCED_PARAMETER(socket); + UNREFERENCED_PARAMETER(address); + UNREFERENCED_PARAMETER(buffers); + UNREFERENCED_PARAMETER(bufferCount); +#endif if (recvLength == -1) { @@ -407,6 +427,7 @@ enet_socket_receive (ENetSocket socket, return -1; } +#ifndef GEKKO #ifdef HAS_MSGHDR_FLAGS if (msgHdr.msg_flags & MSG_TRUNC) return -1; @@ -417,6 +438,7 @@ enet_socket_receive (ENetSocket socket, address -> host = (enet_uint32) sin.sin_addr.s_addr; address -> port = ENET_NET_TO_HOST_16 (sin.sin_port); } +#endif return recvLength; } diff --git a/polymer/eduke32/source/jaudiolib/Makefile b/polymer/eduke32/source/jaudiolib/Makefile index b23d50157..185ecb15e 100644 --- a/polymer/eduke32/source/jaudiolib/Makefile +++ b/polymer/eduke32/source/jaudiolib/Makefile @@ -69,7 +69,9 @@ ifeq ($(RENDERTYPE),SDL) endif ifneq ($(PLATFORM),DARWIN) ifneq ($(PLATFORM),WINDOWS) - OURCOMMONFLAGS+=`pkg-config --cflags vorbis` + ifneq ($(PLATFORM),WII) + OURCOMMONFLAGS+=`pkg-config --cflags vorbis` + endif endif endif OBJECTS+= $(OBJ)/driver_sdl.o