From 3d3ebb75c82c4d8c66d9c2029dac16a1d4758dd2 Mon Sep 17 00:00:00 2001 From: David 'Digit' Turner Date: Thu, 27 Mar 2014 17:23:17 +0100 Subject: emulator/opengl: Fix misc. compiler warnings. These warnings appear when building the sources through the emulator's standalone build system, not the platform one. Change-Id: Ib5d51cf6211f32763be00c7436ae14c06f76b436 --- .../opengl/host/libs/Translator/EGL/EglImp.cpp | 30 +++++++++++----------- .../host/libs/Translator/EGL/EglWindowsApi.cpp | 13 +++++----- .../host/libs/Translator/GLES_CM/GLEScmImp.cpp | 4 --- .../host/libs/Translator/GLES_V2/GLESv2Imp.cpp | 1 - .../host/libs/Translator/GLES_V2/ShaderParser.cpp | 3 +-- .../host/libs/Translator/GLcommon/GLDispatch.cpp | 8 +++--- .../host/libs/Translator/GLcommon/GLEScontext.cpp | 3 --- emulator/opengl/host/tools/emugen/ApiGen.cpp | 4 +-- .../shared/OpenglCodecCommon/GLSharedGroup.cpp | 2 +- .../shared/OpenglCodecCommon/SocketStream.cpp | 1 - .../shared/OpenglCodecCommon/Win32PipeStream.cpp | 2 -- emulator/opengl/shared/emugl/common/pod_vector.cpp | 1 - emulator/opengl/shared/emugl/common/pod_vector.h | 2 -- .../tests/translator_tests/GLES_CM/triangleCM.cpp | 3 --- .../tests/translator_tests/GLES_V2/triangleV2.cpp | 14 ---------- 15 files changed, 29 insertions(+), 62 deletions(-) diff --git a/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp b/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp index d88b473..58180ed 100644 --- a/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp +++ b/emulator/opengl/host/libs/Translator/EGL/EglImp.cpp @@ -273,28 +273,31 @@ EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay display, const EGLint * } //selection defaults + // NOTE: Some variables below are commented out to reduce compiler warnings. + // TODO(digit): Look if these variables are really needed or not, and if so + // fix the code to do it properly. EGLint surface_type = EGL_WINDOW_BIT; EGLint renderable_type = EGL_OPENGL_ES_BIT; - EGLBoolean bind_to_tex_rgb = EGL_DONT_CARE; - EGLBoolean bind_to_tex_rgba = EGL_DONT_CARE; + //EGLBoolean bind_to_tex_rgb = EGL_DONT_CARE; + //EGLBoolean bind_to_tex_rgba = EGL_DONT_CARE; EGLenum caveat = EGL_DONT_CARE; EGLint config_id = EGL_DONT_CARE; EGLBoolean native_renderable = EGL_DONT_CARE; EGLint native_visual_type = EGL_DONT_CARE; - EGLint max_swap_interval = EGL_DONT_CARE; - EGLint min_swap_interval = EGL_DONT_CARE; + //EGLint max_swap_interval = EGL_DONT_CARE; + //EGLint min_swap_interval = EGL_DONT_CARE; EGLint trans_red_val = EGL_DONT_CARE; EGLint trans_green_val = EGL_DONT_CARE; EGLint trans_blue_val = EGL_DONT_CARE; EGLenum transparent_type = EGL_NONE; - EGLint buffer_size = 0; + //EGLint buffer_size = 0; EGLint red_size = 0; EGLint green_size = 0; EGLint blue_size = 0; EGLint alpha_size = 0; EGLint depth_size = 0; EGLint frame_buffer_level = 0; - EGLint sample_buffers_num = 0; + //EGLint sample_buffers_num = 0; EGLint samples_per_pixel = 0; EGLint stencil_size = 0; @@ -318,7 +321,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay display, const EGLint * if(attrib_list[i+1] < 0) { RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE); } - buffer_size = attrib_list[i+1]; + //buffer_size = attrib_list[i+1]; break; case EGL_RED_SIZE: if(attrib_list[i+1] < 0) { @@ -345,10 +348,10 @@ EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay display, const EGLint * alpha_size = attrib_list[i+1]; break; case EGL_BIND_TO_TEXTURE_RGB: - bind_to_tex_rgb = attrib_list[i+1]; + //bind_to_tex_rgb = attrib_list[i+1]; break; case EGL_BIND_TO_TEXTURE_RGBA: - bind_to_tex_rgba = attrib_list[i+1]; + //bind_to_tex_rgba = attrib_list[i+1]; break; case EGL_CONFIG_CAVEAT: if(attrib_list[i+1] != EGL_NONE && attrib_list[i+1] != EGL_SLOW_CONFIG && attrib_list[i+1] != EGL_NON_CONFORMANT_CONFIG) { @@ -373,13 +376,13 @@ EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay display, const EGLint * if(attrib_list[i+1] < 0) { RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE); } - max_swap_interval = attrib_list[i+1]; + //max_swap_interval = attrib_list[i+1]; break; case EGL_MIN_SWAP_INTERVAL: if(attrib_list[i+1] < 0) { RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE); } - min_swap_interval = attrib_list[i+1]; + //min_swap_interval = attrib_list[i+1]; break; case EGL_NATIVE_RENDERABLE: native_renderable = attrib_list[i+1]; @@ -394,7 +397,7 @@ EGLAPI EGLBoolean EGLAPIENTRY eglChooseConfig(EGLDisplay display, const EGLint * RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE); } case EGL_SAMPLE_BUFFERS: - sample_buffers_num = attrib_list[i+1]; + //sample_buffers_num = attrib_list[i+1]; break; if(attrib_list[i+1] < 0) { RETURN_ERROR(EGL_FALSE,EGL_BAD_ATTRIBUTE); @@ -635,13 +638,11 @@ EGLAPI EGLContext EGLAPIENTRY eglCreateContext(EGLDisplay display, EGLConfig con } ContextPtr sharedCtxPtr; - EGLNativeContextType nativeShared = NULL; if(share_context != EGL_NO_CONTEXT) { sharedCtxPtr = dpy->getContext(share_context); if(!sharedCtxPtr.Ptr()) { RETURN_ERROR(EGL_NO_CONTEXT,EGL_BAD_CONTEXT); } - nativeShared = sharedCtxPtr->nativeType(); } EGLNativeContextType globalSharedContext = dpy->getGlobalSharedContext(); @@ -1014,7 +1015,6 @@ EglImage *attachEGLImage(unsigned int imageId) void detachEGLImage(unsigned int imageId) { ThreadInfo* thread = getThreadInfo(); - EglDisplay* dpy = static_cast(thread->eglDisplay); ContextPtr ctx = thread->eglContext; if (ctx.Ptr()) { ctx->detachImage(imageId); diff --git a/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp b/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp index 5628165..c245ba5 100644 --- a/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp +++ b/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp @@ -193,7 +193,8 @@ HWND createDummyWindow(){ wcx.lpszClassName = "DummyWin"; // name of window class wcx.hIconSm = (HICON) NULL; // small class icon - ATOM winClass = RegisterClassEx(&wcx); + RegisterClassEx(&wcx); + HWND hwnd = CreateWindowEx(WS_EX_CLIENTEDGE, "DummyWin", "Dummy", @@ -340,7 +341,7 @@ EglConfig* pixelFormatToConfig(EGLNativeInternalDisplayType display,int renderab EGLint transparentType,samples; EGLint tRed,tGreen,tBlue; EGLint pMaxWidth,pMaxHeight,pMaxPixels; - EGLint configId,level; + EGLint level; EGLint window,bitmap,pbuffer,transparent; HDC dpy = getDummyDC(display,WinDisplay::DEFAULT_DISPLAY); @@ -497,7 +498,7 @@ EGLNativeSurfaceType createPbufferSurface(EGLNativeInternalDisplayType display,E if(!s_wglExtProcs->wglCreatePbufferARB) return NULL; EGLNativePbufferType pb = s_wglExtProcs->wglCreatePbufferARB(dpy,cfg->nativeId(),width,height,pbAttribs); if(!pb) { - DWORD err = GetLastError(); + GetLastError(); return NULL; } return new SrfcInfo(pb); @@ -507,7 +508,7 @@ bool releasePbuffer(EGLNativeInternalDisplayType display,EGLNativeSurfaceType pb if (!pb) return false; if(!s_wglExtProcs->wglReleasePbufferDCARB || !s_wglExtProcs->wglDestroyPbufferARB) return false; if(!s_wglExtProcs->wglReleasePbufferDCARB(pb->getPbuffer(),pb->getDC()) || !s_wglExtProcs->wglDestroyPbufferARB(pb->getPbuffer())){ - DWORD err = GetLastError(); + GetLastError(); return false; } return true; @@ -539,7 +540,7 @@ EGLNativeContextType createContext(EGLNativeInternalDisplayType display,EglConfi bool destroyContext(EGLNativeInternalDisplayType dpy,EGLNativeContextType ctx) { if(!wglDeleteContext(ctx)) { - DWORD err = GetLastError(); + GetLastError(); return false; } return true; @@ -566,7 +567,7 @@ bool makeCurrent(EGLNativeInternalDisplayType display,EglSurface* read,EglSurfac void swapBuffers(EGLNativeInternalDisplayType display,EGLNativeSurfaceType srfc){ if(srfc && !SwapBuffers(srfc->getDC())) { - DWORD err = GetLastError(); + GetLastError(); } } diff --git a/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp b/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp index 28ebca9..7ab177f 100644 --- a/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp +++ b/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp @@ -699,8 +699,6 @@ GL_API void GL_APIENTRY glGetBooleanv( GLenum pname, GLboolean *params) { return; } - GLint i; - switch(pname) { case GL_FRAMEBUFFER_BINDING_OES: @@ -745,7 +743,6 @@ GL_API void GL_APIENTRY glGetBufferParameteriv( GLenum target, GLenum pname, GL GET_CTX() SET_ERROR_IF(!(GLEScmValidate::bufferTarget(target) && GLEScmValidate::bufferParam(pname)),GL_INVALID_ENUM); SET_ERROR_IF(!ctx->isBindedBuffer(target),GL_INVALID_OPERATION); - bool ret = true; switch(pname) { case GL_BUFFER_SIZE: ctx->getBufferSize(target,params); @@ -787,7 +784,6 @@ GL_API void GL_APIENTRY glGetFixedv( GLenum pname, GLfixed *params) { size_t nParams = glParamSize(pname); GLfloat fParams[16]; - GLint i; switch(pname) { diff --git a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp index c3886d3..c96ba52 100644 --- a/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp +++ b/emulator/opengl/host/libs/Translator/GLES_V2/GLESv2Imp.cpp @@ -867,7 +867,6 @@ GL_APICALL void GL_APIENTRY glGetBufferParameteriv(GLenum target, GLenum pname, GET_CTX(); SET_ERROR_IF(!(GLESv2Validate::bufferTarget(target) && GLESv2Validate::bufferParam(pname)),GL_INVALID_ENUM); SET_ERROR_IF(!ctx->isBindedBuffer(target),GL_INVALID_OPERATION); - bool ret = true; switch(pname) { case GL_BUFFER_SIZE: ctx->getBufferSize(target,params); diff --git a/emulator/opengl/host/libs/Translator/GLES_V2/ShaderParser.cpp b/emulator/opengl/host/libs/Translator/GLES_V2/ShaderParser.cpp index 311a9ed..940538a 100644 --- a/emulator/opengl/host/libs/Translator/GLES_V2/ShaderParser.cpp +++ b/emulator/opengl/host/libs/Translator/GLES_V2/ShaderParser.cpp @@ -224,8 +224,7 @@ void ShaderParser::parseOmitPrecision(){ SEMICOLON } statementState = PRECISION; const char *precision = NULL; - const char *delimiter = NULL; - + enum { PARSE_NONE, PARSE_IN_C_COMMENT, diff --git a/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp b/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp index 54aa200..c0e3c5c 100644 --- a/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp +++ b/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp @@ -49,19 +49,19 @@ static GL_FUNC_PTR getGLFuncAddress(const char *funcName) { if(name == NULL){ \ funcAddrs = (void *)getGLFuncAddress(#name); \ if(funcAddrs){ \ - *(void**)(&name) = funcAddrs; \ + *(void**)(void*)(&name) = funcAddrs; \ } else { \ fprintf(stderr,"could not load func %s\n",#name); \ - *(void**)(&name) = (void *)dummy_##name; \ + *(void**)(void*)(&name) = (void *)dummy_##name; \ } \ } \ } -#define LOAD_GLEXT_FUNC(name) { void * funcAddrs = NULL; \ +#define LOAD_GLEXT_FUNC(name) { void * funcAddrs = NULL; \ if(name == NULL){ \ funcAddrs = (void *)getGLFuncAddress(#name); \ if(funcAddrs) \ - *(void**)(&name) = funcAddrs; \ + *(void**)(void*)(&name) = funcAddrs; \ } \ } diff --git a/emulator/opengl/host/libs/Translator/GLcommon/GLEScontext.cpp b/emulator/opengl/host/libs/Translator/GLcommon/GLEScontext.cpp index 46f039c..c0519c4 100644 --- a/emulator/opengl/host/libs/Translator/GLcommon/GLEScontext.cpp +++ b/emulator/opengl/host/libs/Translator/GLcommon/GLEScontext.cpp @@ -330,10 +330,8 @@ void GLEScontext::convertDirectVBO(GLESConversionArrays& cArrs,GLint first,GLsiz RangeList ranges; RangeList conversions; GLushort* indices = NULL; - GLenum type = p->getType(); int attribSize = p->getSize(); int stride = p->getStride()?p->getStride():sizeof(GLfixed)*attribSize; - unsigned int size = p->getStride()?p->getStride()*count:attribSize*count*sizeof(GLfixed); char* data = (char*)p->getBufferData() + (first*stride); if(p->bufferNeedConversion()) { @@ -389,7 +387,6 @@ void GLEScontext::convertIndirectVBO(GLESConversionArrays& cArrs,GLsizei count,G RangeList ranges; RangeList conversions; GLushort* conversionIndices = NULL; - GLenum type = p->getType(); int attribSize = p->getSize(); int stride = p->getStride()?p->getStride():sizeof(GLfixed)*attribSize; char* data = static_cast(p->getBufferData()); diff --git a/emulator/opengl/host/tools/emugen/ApiGen.cpp b/emulator/opengl/host/tools/emugen/ApiGen.cpp index 2c331b9..6d6742d 100644 --- a/emulator/opengl/host/tools/emugen/ApiGen.cpp +++ b/emulator/opengl/host/tools/emugen/ApiGen.cpp @@ -776,12 +776,10 @@ int ApiGen::genDecoderImpl(const std::string &filename) \tchar lastCall[256] = {0}; \n\ #endif \n\ \twhile ((len - pos >= 8) && !unknownOpcode) { \n\ -\t\tvoid *params[%u]; \n\ \t\tint opcode = *(int *)ptr; \n\ \t\tunsigned int packetLen = *(int *)(ptr + 4);\n\ \t\tif (len - pos < packetLen) return pos; \n\ -\t\tswitch(opcode) {\n", - (unsigned) m_maxEntryPointsParams); +\t\tswitch(opcode) {\n"); for (size_t f = 0; f < n; f++) { enum Pass_t { PASS_TmpBuffAlloc = 0, PASS_MemAlloc, PASS_DebugPrint, PASS_FunctionCall, PASS_Epilog, PASS_LAST }; diff --git a/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp b/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp index db7f418..59f7b97 100644 --- a/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp +++ b/emulator/opengl/shared/OpenglCodecCommon/GLSharedGroup.cpp @@ -258,7 +258,7 @@ GLenum GLSharedGroup::subUpdateBufferData(GLuint bufferId, GLintptr offset, GLsi void GLSharedGroup::deleteBufferData(GLuint bufferId) { emugl::Mutex::AutoLock _lock(m_lock); - ssize_t idx = m_buffers.remove(bufferId); + (void) m_buffers.remove(bufferId); } void GLSharedGroup::addProgramData(GLuint program) diff --git a/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp b/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp index 3ef4c6f..726d359 100644 --- a/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp +++ b/emulator/opengl/shared/OpenglCodecCommon/SocketStream.cpp @@ -112,7 +112,6 @@ int SocketStream::writeFully(const void* buffer, size_t size) const unsigned char *SocketStream::readFully(void *buf, size_t len) { - const unsigned char* ret = NULL; if (!valid()) return NULL; if (!buf) { return NULL; // do not allow NULL buf in that implementation diff --git a/emulator/opengl/shared/OpenglCodecCommon/Win32PipeStream.cpp b/emulator/opengl/shared/OpenglCodecCommon/Win32PipeStream.cpp index 76907a0..dcfb0c0 100644 --- a/emulator/opengl/shared/OpenglCodecCommon/Win32PipeStream.cpp +++ b/emulator/opengl/shared/OpenglCodecCommon/Win32PipeStream.cpp @@ -193,8 +193,6 @@ int Win32PipeStream::commitBuffer(size_t size) const unsigned char *Win32PipeStream::readFully(void *buf, size_t len) { - const unsigned char* ret = NULL; - if (m_pipe == INVALID_HANDLE_VALUE) return NULL; diff --git a/emulator/opengl/shared/emugl/common/pod_vector.cpp b/emulator/opengl/shared/emugl/common/pod_vector.cpp index 3fe8f15..c8ec3a6 100644 --- a/emulator/opengl/shared/emugl/common/pod_vector.cpp +++ b/emulator/opengl/shared/emugl/common/pod_vector.cpp @@ -90,7 +90,6 @@ void PodVectorBase::resize(size_t newSize, size_t itemSize) { } void PodVectorBase::reserve(size_t newSize, size_t itemSize) { - const size_t kMaxSize = maxItemCapacity(itemSize); if (newSize == 0) { ::free(mBegin); mBegin = NULL; diff --git a/emulator/opengl/shared/emugl/common/pod_vector.h b/emulator/opengl/shared/emugl/common/pod_vector.h index 22a8a1d..c4e184b 100644 --- a/emulator/opengl/shared/emugl/common/pod_vector.h +++ b/emulator/opengl/shared/emugl/common/pod_vector.h @@ -73,12 +73,10 @@ protected: const void* end() const { return mEnd; } void* itemAt(size_t pos, size_t itemSize) { - const size_t kMaxCapacity = SIZE_MAX / itemSize; return mBegin + pos * itemSize; } const void* itemAt(size_t pos, size_t itemSize) const { - const size_t kMaxCapacity = SIZE_MAX / itemSize; return mBegin + pos * itemSize; } diff --git a/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp b/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp index ce65cca..60118b7 100644 --- a/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp +++ b/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp @@ -148,9 +148,6 @@ int main(int argc, char **argv) bool useCopy = false; bool useSubCopy = false; - int c; - extern char *optarg; - #ifdef _WIN32 HWND windowId = NULL; #elif __linux__ diff --git a/emulator/opengl/tests/translator_tests/GLES_V2/triangleV2.cpp b/emulator/opengl/tests/translator_tests/GLES_V2/triangleV2.cpp index 732a19a..3a8ff0f 100644 --- a/emulator/opengl/tests/translator_tests/GLES_V2/triangleV2.cpp +++ b/emulator/opengl/tests/translator_tests/GLES_V2/triangleV2.cpp @@ -313,20 +313,6 @@ int WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int n int main(int argc, char **argv) #endif { - GLuint ui32Vbo = 0; // Vertex buffer object handle - GLuint ui32IndexVbo; - GLuint ui32Texture; - - int nframes = 100; - bool immidateMode = false; - bool useIndices = false; - bool useTexture = true; - bool useCompTexture = false; - bool useFixed = true; - bool usePoints = false; - bool useCopy = false; - bool useSubCopy = false; - #ifdef _WIN32 int argc; char **argv = parseCmdLine(lpCmdLine, &argc); -- cgit v1.1