jwzgles: fix warnings when compiling on Linux

git-svn-id: https://svn.eduke32.com/eduke32@5525 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-01-08 01:33:15 +00:00
parent 8d73dca2d2
commit ff80e020ad
2 changed files with 50 additions and 14 deletions

View file

@ -28,6 +28,7 @@
# define GLdouble double # define GLdouble double
# define GL_ACCUM_BUFFER_BIT 0x00000200 # define GL_ACCUM_BUFFER_BIT 0x00000200
# undef GL_ALL_ATTRIB_BITS
# define GL_ALL_ATTRIB_BITS 0x000FFFFF # define GL_ALL_ATTRIB_BITS 0x000FFFFF
# define GL_AUTO_NORMAL 0x0D80 # define GL_AUTO_NORMAL 0x0D80
# define GL_BLEND_SRC_ALPHA 0x80CB # define GL_BLEND_SRC_ALPHA 0x80CB

View file

@ -98,6 +98,11 @@
#include "jwzglesI.h" #include "jwzglesI.h"
#if !defined(_MSC_VER) || _MSC_FULL_VER < 180031101
# undef UNREFERENCED_PARAMETER
# define UNREFERENCED_PARAMETER(x) (x) = (x)
#endif
#define STRINGIFY(X) #X #define STRINGIFY(X) #X
#undef countof #undef countof
@ -114,8 +119,10 @@
#ifdef HAVE_COCOA #ifdef HAVE_COCOA
extern void jwxyz_abort (const char *fmt, ...) __dead2; extern void jwxyz_abort (const char *fmt, ...) __dead2;
# define Have_Assert
# define Assert(C,S) do { if (!(C)) { jwxyz_abort ("%s",S); }} while(0) # define Assert(C,S) do { if (!(C)) { jwxyz_abort ("%s",S); }} while(0)
#elif defined __ANDROID__ #elif defined __ANDROID__
# define Have_Assert
# define Assert(C,S) do { \ # define Assert(C,S) do { \
if (!(C)) { \ if (!(C)) { \
LOGE ( "ASSERT jwzgles: %s\n", S); \ LOGE ( "ASSERT jwzgles: %s\n", S); \
@ -282,20 +289,20 @@ static jwzgles_state *state = 0;
LOGD("jwzgles: "A "\n",B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R) LOGD("jwzgles: "A "\n",B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R)
# define CHECK(S) check_gl_error(S) # define CHECK(S) check_gl_error(S)
#else #else
// "" defeats -Wempty-body static inline void jklmnop_donothing(void) { };
# define LOG(A) "" # define LOG(A) jklmnop_donothing()
# define LOG1(A,B) "" # define LOG1(A,B) jklmnop_donothing()
# define LOG2(A,B,C) "" # define LOG2(A,B,C) jklmnop_donothing()
# define LOG3(A,B,C,D) "" # define LOG3(A,B,C,D) jklmnop_donothing()
# define LOG4(A,B,C,D,E) "" # define LOG4(A,B,C,D,E) jklmnop_donothing()
# define LOG5(A,B,C,D,E,F) "" # define LOG5(A,B,C,D,E,F) jklmnop_donothing()
# define LOG6(A,B,C,D,E,F,G) "" # define LOG6(A,B,C,D,E,F,G) jklmnop_donothing()
# define LOG7(A,B,C,D,E,F,G,H) "" # define LOG7(A,B,C,D,E,F,G,H) jklmnop_donothing()
# define LOG8(A,B,C,D,E,F,G,H,I) "" # define LOG8(A,B,C,D,E,F,G,H,I) jklmnop_donothing()
# define LOG9(A,B,C,D,E,F,G,H,I,J) "" # define LOG9(A,B,C,D,E,F,G,H,I,J) jklmnop_donothing()
# define LOG10(A,B,C,D,E,F,G,H,I,J,K) "" # define LOG10(A,B,C,D,E,F,G,H,I,J,K) jklmnop_donothing()
# define LOG17(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R) "" # define LOG17(A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R) jklmnop_donothing()
# define CHECK(S) "" # define CHECK(S) jklmnop_donothing()
#endif #endif
#ifdef DEBUG #ifdef DEBUG
@ -515,6 +522,8 @@ make_room (const char *name, void **array, int span, int *count, int *size)
/* LOG3("%s: grew %d -> %d", name, *size, new_size); */ /* LOG3("%s: grew %d -> %d", name, *size, new_size); */
*size = new_size; *size = new_size;
} }
UNREFERENCED_PARAMETER(name);
} }
@ -605,6 +614,10 @@ jwzgles_glNewList (int id, int mode)
state->list_enabled = state->enabled; state->list_enabled = state->enabled;
LOG1("glNewList -> %d", id); LOG1("glNewList -> %d", id);
#ifndef Have_Assert
UNREFERENCED_PARAMETER(mode);
#endif
} }
@ -1411,6 +1424,9 @@ jwzgles_glColorMaterial (GLenum face, GLenum mode)
arrays don't distinguish between "color" and "material", */ arrays don't distinguish between "color" and "material", */
Assert (0, "glColorMaterial: unimplemented mode"); Assert (0, "glColorMaterial: unimplemented mode");
} }
#else
UNREFERENCED_PARAMETER(face);
UNREFERENCED_PARAMETER(mode);
#endif #endif
} }
@ -1654,7 +1670,9 @@ static int
cq2t (unsigned char **arrayP, int stride, int count) cq2t (unsigned char **arrayP, int stride, int count)
{ {
int count2 = count * 6 / 4; int count2 = count * 6 / 4;
# ifdef Have_Assert
int size = stride * count; int size = stride * count;
# endif
int size2 = stride * count2; int size2 = stride * count2;
const unsigned char *oarray, *in; const unsigned char *oarray, *in;
unsigned char *array2, *oarray2, *out; unsigned char *array2, *oarray2, *out;
@ -2453,6 +2471,8 @@ copy_array_data (draw_array *A, int count, const char *name)
# ifdef DEBUG # ifdef DEBUG
dump_array_data (A, count, "saved", name, 0); dump_array_data (A, count, "saved", name, 0);
# else
UNREFERENCED_PARAMETER(name);
# endif # endif
} }
@ -2466,7 +2486,9 @@ restore_arrays (list_fn *F, int count)
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
{ {
# ifdef DEBUG
const char *name = 0; const char *name = 0;
# endif
if (!A[i].size) if (!A[i].size)
continue; continue;
@ -2479,19 +2501,27 @@ restore_arrays (list_fn *F, int count)
switch (i) { switch (i) {
case 0: glVertexPointer (A[i].size, A[i].type, A[i].stride, A[i].data); case 0: glVertexPointer (A[i].size, A[i].type, A[i].stride, A[i].data);
# ifdef DEBUG
name = "vertex "; name = "vertex ";
# endif
CHECK("glVertexPointer"); CHECK("glVertexPointer");
break; break;
case 1: glNormalPointer ( A[i].type, A[i].stride, A[i].data); case 1: glNormalPointer ( A[i].type, A[i].stride, A[i].data);
# ifdef DEBUG
name = "normal "; name = "normal ";
# endif
CHECK("glNormalPointer"); CHECK("glNormalPointer");
break; break;
case 2: glTexCoordPointer(A[i].size, A[i].type, A[i].stride, A[i].data); case 2: glTexCoordPointer(A[i].size, A[i].type, A[i].stride, A[i].data);
# ifdef DEBUG
name = "texture"; name = "texture";
# endif
CHECK("glTexCoordPointer"); CHECK("glTexCoordPointer");
break; break;
case 3: glColorPointer (A[i].size, A[i].type, A[i].stride, A[i].data); case 3: glColorPointer (A[i].size, A[i].type, A[i].stride, A[i].data);
# ifdef DEBUG
name = "color "; name = "color ";
# endif
CHECK("glColorPointer"); CHECK("glColorPointer");
break; break;
default: Assert (0, "wat"); break; default: Assert (0, "wat"); break;
@ -2503,6 +2533,10 @@ restore_arrays (list_fn *F, int count)
} }
glBindBuffer (GL_ARRAY_BUFFER, 0); /* Keep out of others' hands */ glBindBuffer (GL_ARRAY_BUFFER, 0); /* Keep out of others' hands */
# ifndef DEBUG
UNREFERENCED_PARAMETER(count);
# endif
} }
@ -2816,6 +2850,7 @@ void
jwzgles_glPushAttrib(int flags) jwzgles_glPushAttrib(int flags)
{ {
//Assert (0, "glPushAttrib unimplemented"); //Assert (0, "glPushAttrib unimplemented");
UNREFERENCED_PARAMETER(flags);
} }
void void