diff options
author | David 'Digit' Turner <digit@google.com> | 2014-04-28 12:37:51 +0200 |
---|---|---|
committer | David 'Digit' Turner <digit@google.com> | 2014-04-28 12:45:16 +0200 |
commit | 88a8c6a97f1214871348afe30a5b4ef54e99a0a4 (patch) | |
tree | ca5573aa6131ff65ccda71e63fb3d83f7ccf480b /emulator | |
parent | 0c5d08da8a14a3ec54578270036012829de97ef2 (diff) | |
download | sdk-88a8c6a97f1214871348afe30a5b4ef54e99a0a4.zip sdk-88a8c6a97f1214871348afe30a5b4ef54e99a0a4.tar.gz sdk-88a8c6a97f1214871348afe30a5b4ef54e99a0a4.tar.bz2 |
emulator/opengl: Fix GCC 4.8 warnings.
This fixes a few compiler warnings when building the GPU emulation
libraries with GCC 4.8. Note that GLbyte is defined as khronos_int8_t
which is signed!
Change-Id: I52027cd2eb20d6162983319f22d4da150ff514ed
Diffstat (limited to 'emulator')
5 files changed, 32 insertions, 31 deletions
diff --git a/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp b/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp index c245ba5..5b48fcb 100644 --- a/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp +++ b/emulator/opengl/host/libs/Translator/EGL/EglWindowsApi.cpp @@ -20,8 +20,7 @@ #include <stdio.h> #define IS_TRUE(a) \ - if(a != true) return false; - + if(a != true) return NULL; struct DisplayInfo{ DisplayInfo():dc(NULL),hwnd(NULL),isPixelFormatSet(false){}; @@ -48,9 +47,7 @@ static TlsData *getTLS() { class WinDisplay{ public: - typedef enum { - DEFAULT_DISPLAY = 0 - }; + enum { DEFAULT_DISPLAY = 0 }; WinDisplay(){}; DisplayInfo& getInfo(int configurationIndex){ return getTLS()->m_map[configurationIndex];} HDC getDC(int configId){return getTLS()->m_map[configId].dc;} diff --git a/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp b/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp index 7ab177f..3443f59 100644 --- a/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp +++ b/emulator/opengl/host/libs/Translator/GLES_CM/GLEScmImp.cpp @@ -2230,10 +2230,12 @@ void glDrawTexOES (T x, T y, T z, T width, T height) { GLint viewport[4]; z = (z>1 ? 1 : (z<0 ? 0 : z)); - T vertices[4*3] = {x , y, z, - x , y+height, z, - x+width, y+height, z, - x+width, y, z}; + T vertices[4*3] = { + x , y, z, + x , static_cast<T>(y+height), z, + static_cast<T>(x+width), static_cast<T>(y+height), z, + static_cast<T>(x+width), y, z + }; GLfloat texels[ctx->getMaxTexUnits()][4*2]; memset((void*)texels, 0, ctx->getMaxTexUnits()*4*2*sizeof(GLfloat)); diff --git a/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp b/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp index c0e3c5c..7b217fd 100644 --- a/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp +++ b/emulator/opengl/host/libs/Translator/GLcommon/GLDispatch.cpp @@ -45,25 +45,26 @@ static GL_FUNC_PTR getGLFuncAddress(const char *funcName) { return ret; } -#define LOAD_GL_FUNC(name) { void * funcAddrs = NULL; \ - if(name == NULL){ \ - funcAddrs = (void *)getGLFuncAddress(#name); \ - if(funcAddrs){ \ - *(void**)(void*)(&name) = funcAddrs; \ - } else { \ - fprintf(stderr,"could not load func %s\n",#name); \ - *(void**)(void*)(&name) = (void *)dummy_##name; \ - } \ - } \ - } +#define LOAD_GL_FUNC(name) do { \ + if (!name) { \ + void* funcAddress = (void *)getGLFuncAddress(#name); \ + if (funcAddress) { \ + name = (__typeof__(name))(funcAddress); \ + } else { \ + fprintf(stderr, "Could not load func %s\n", #name); \ + name = (__typeof__(name))(dummy_##name); \ + } \ + } \ + } while (0) -#define LOAD_GLEXT_FUNC(name) { void * funcAddrs = NULL; \ - if(name == NULL){ \ - funcAddrs = (void *)getGLFuncAddress(#name); \ - if(funcAddrs) \ - *(void**)(void*)(&name) = funcAddrs; \ - } \ - } +#define LOAD_GLEXT_FUNC(name) do { \ + if (!name) { \ + void* funcAddress = (void *)getGLFuncAddress(#name); \ + if (funcAddress) { \ + name = (__typeof__(name))(funcAddress); \ + } \ + } \ + } while (0) /* initializing static GLDispatch members*/ diff --git a/emulator/opengl/shared/emugl/common/sockets.cpp b/emulator/opengl/shared/emugl/common/sockets.cpp index feb6d38..2a13d72 100644 --- a/emulator/opengl/shared/emugl/common/sockets.cpp +++ b/emulator/opengl/shared/emugl/common/sockets.cpp @@ -27,6 +27,7 @@ #endif #include <stddef.h> +#include <stdint.h> #include <string.h> #include <unistd.h> @@ -36,7 +37,7 @@ namespace { static void socketSetReuseAddress(int s) { #ifdef _WIN32 - // The default behaviour on WIndows is equivalent to SO_REUSEADDR + // The default behaviour on Windows is equivalent to SO_REUSEADDR // so we don't need to set this option. Moreover, one should never // set this option with WinSock because it's badly implemented and // generates a huge security issue. See: diff --git a/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp b/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp index 60118b7..0e86166 100644 --- a/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp +++ b/emulator/opengl/tests/translator_tests/GLES_CM/triangleCM.cpp @@ -279,17 +279,17 @@ int main(int argc, char **argv) #define MIN_T 0 GLbyte byteVertices[] = { -1,-1,0, // Position - 255,0,0,255, // Color + (GLbyte)255,0,0,(GLbyte)255, // Color MIN_T, MIN_T, // texture 12, //point size 1,-1,0, - 0,255,0,255, + 0,(GLbyte)255,0,(GLbyte)255, MAX_T,MIN_T, 47, 0,1,0, - 0,0,255,255, + 0,0,(GLbyte)255,(GLbyte)255, MID_T, MAX_T, 14 }; |