CI: Extra warnings for builds with Clang. Backends: OpenGL3: Fix sign conversion warnings.
diff --git a/examples/example_null/Makefile b/examples/example_null/Makefile
index 0ccee11..15c547a 100644
--- a/examples/example_null/Makefile
+++ b/examples/example_null/Makefile
@@ -40,7 +40,10 @@
ifeq ($(UNAME_S), Linux) #LINUX
ECHO_MESSAGE = "Linux"
ifneq ($(WITH_EXTRA_WARNINGS), 0)
- CXXFLAGS += -Wextra -pedantic
+ CXXFLAGS += -Wextra -Wpedantic
+ ifeq ($(shell $(CXX) -v 2>&1 | grep -c "clang version"), 1)
+ CXXFLAGS += -Wshadow -Wsign-conversion
+ endif
endif
CFLAGS = $(CXXFLAGS)
endif
@@ -56,7 +59,7 @@
ifeq ($(findstring MINGW,$(UNAME_S)),MINGW)
ECHO_MESSAGE = "MinGW"
ifneq ($(WITH_EXTRA_WARNINGS), 0)
- CXXFLAGS += -Wextra -pedantic
+ CXXFLAGS += -Wextra -Wpedantic
endif
CFLAGS = $(CXXFLAGS)
endif
diff --git a/examples/imgui_impl_opengl3.cpp b/examples/imgui_impl_opengl3.cpp
index 3ad04a4..028a704 100644
--- a/examples/imgui_impl_opengl3.cpp
+++ b/examples/imgui_impl_opengl3.cpp
@@ -132,8 +132,8 @@
static char g_GlslVersionString[32] = ""; // Specified by user or detected based on compile time GL settings.
static GLuint g_FontTexture = 0;
static GLuint g_ShaderHandle = 0, g_VertHandle = 0, g_FragHandle = 0;
-static int g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0; // Uniforms location
-static int g_AttribLocationVtxPos = 0, g_AttribLocationVtxUV = 0, g_AttribLocationVtxColor = 0; // Vertex attributes location
+static GLint g_AttribLocationTex = 0, g_AttribLocationProjMtx = 0; // Uniforms location
+static GLuint g_AttribLocationVtxPos = 0, g_AttribLocationVtxUV = 0, g_AttribLocationVtxColor = 0; // Vertex attributes location
static unsigned int g_VboHandle = 0, g_ElementsHandle = 0;
// Functions
@@ -144,7 +144,7 @@
GLint major, minor;
glGetIntegerv(GL_MAJOR_VERSION, &major);
glGetIntegerv(GL_MINOR_VERSION, &minor);
- g_GlVersion = major * 100 + minor * 10;
+ g_GlVersion = (GLuint)(major * 100 + minor * 10);
#else
g_GlVersion = 200; // GLES 2
#endif
@@ -292,14 +292,14 @@
// Backup GL state
GLenum last_active_texture; glGetIntegerv(GL_ACTIVE_TEXTURE, (GLint*)&last_active_texture);
glActiveTexture(GL_TEXTURE0);
- GLint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, &last_program);
- GLint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, &last_texture);
+ GLuint last_program; glGetIntegerv(GL_CURRENT_PROGRAM, (GLint*)&last_program);
+ GLuint last_texture; glGetIntegerv(GL_TEXTURE_BINDING_2D, (GLint*)&last_texture);
#ifdef GL_SAMPLER_BINDING
- GLint last_sampler; glGetIntegerv(GL_SAMPLER_BINDING, &last_sampler);
+ GLuint last_sampler; glGetIntegerv(GL_SAMPLER_BINDING, (GLint*)&last_sampler);
#endif
- GLint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, &last_array_buffer);
+ GLuint last_array_buffer; glGetIntegerv(GL_ARRAY_BUFFER_BINDING, (GLint*)&last_array_buffer);
#ifndef IMGUI_IMPL_OPENGL_ES2
- GLint last_vertex_array_object; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, &last_vertex_array_object);
+ GLuint last_vertex_array_object; glGetIntegerv(GL_VERTEX_ARRAY_BINDING, (GLint*)&last_vertex_array_object);
#endif
#ifdef GL_POLYGON_MODE
GLint last_polygon_mode[2]; glGetIntegerv(GL_POLYGON_MODE, last_polygon_mode);
@@ -336,8 +336,8 @@
const ImDrawList* cmd_list = draw_data->CmdLists[n];
// Upload vertex/index buffers
- glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
- glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);
+ glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)cmd_list->VtxBuffer.Size * (int)sizeof(ImDrawVert), (const GLvoid*)cmd_list->VtxBuffer.Data, GL_STREAM_DRAW);
+ glBufferData(GL_ELEMENT_ARRAY_BUFFER, (GLsizeiptr)cmd_list->IdxBuffer.Size * (int)sizeof(ImDrawIdx), (const GLvoid*)cmd_list->IdxBuffer.Data, GL_STREAM_DRAW);
for (int cmd_i = 0; cmd_i < cmd_list->CmdBuffer.Size; cmd_i++)
{
@@ -643,9 +643,9 @@
g_AttribLocationTex = glGetUniformLocation(g_ShaderHandle, "Texture");
g_AttribLocationProjMtx = glGetUniformLocation(g_ShaderHandle, "ProjMtx");
- g_AttribLocationVtxPos = glGetAttribLocation(g_ShaderHandle, "Position");
- g_AttribLocationVtxUV = glGetAttribLocation(g_ShaderHandle, "UV");
- g_AttribLocationVtxColor = glGetAttribLocation(g_ShaderHandle, "Color");
+ g_AttribLocationVtxPos = (GLuint)glGetAttribLocation(g_ShaderHandle, "Position");
+ g_AttribLocationVtxUV = (GLuint)glGetAttribLocation(g_ShaderHandle, "UV");
+ g_AttribLocationVtxColor = (GLuint)glGetAttribLocation(g_ShaderHandle, "Color");
// Create buffers
glGenBuffers(1, &g_VboHandle);