mirror of
https://github.com/xemu-project/imgui.git
synced 2024-11-23 18:29:51 +00:00
Fixed various Clang -Weverything warnings (#626)
This commit is contained in:
parent
efedaa5df3
commit
79ad22e1f2
@ -101,7 +101,7 @@ void ImGui_ImplGlfw_RenderDrawLists(ImDrawData* draw_data)
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
glBindTexture(GL_TEXTURE_2D, (GLuint)last_texture);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
@ -90,7 +90,7 @@ void ImGui_ImplSdl_RenderDrawLists(ImDrawData* draw_data)
|
||||
glDisableClientState(GL_COLOR_ARRAY);
|
||||
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
|
||||
glDisableClientState(GL_VERTEX_ARRAY);
|
||||
glBindTexture(GL_TEXTURE_2D, last_texture);
|
||||
glBindTexture(GL_TEXTURE_2D, (GLuint)last_texture);
|
||||
glMatrixMode(GL_MODELVIEW);
|
||||
glPopMatrix();
|
||||
glMatrixMode(GL_PROJECTION);
|
||||
|
12
imgui.cpp
12
imgui.cpp
@ -603,7 +603,6 @@
|
||||
#pragma warning (disable: 4127) // condition expression is constant
|
||||
#pragma warning (disable: 4505) // unreferenced local function has been removed (stb stuff)
|
||||
#pragma warning (disable: 4996) // 'This function or variable may be unsafe': strcpy, strdup, sprintf, vsnprintf, sscanf, fopen
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
|
||||
// Clang warnings with -Weverything
|
||||
@ -615,7 +614,6 @@
|
||||
#pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
|
||||
#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness //
|
||||
#pragma clang diagnostic ignored "-Wmissing-noreturn" // warning : function xx could be declared with attribute 'noreturn' warning // GetDefaultFontData() asserts which some implementation makes it never return.
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"// warning : 'xx' is deprecated: The POSIX name for this item.. // for strdup used in demo code (so user can copy & paste the code)
|
||||
#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int'
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
@ -4815,7 +4813,7 @@ void ImGui::SetNextWindowFocus()
|
||||
ImVec2 ImGui::GetContentRegionMax()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
ImVec2 content_region_size = ImVec2(window->SizeContentsExplicit.x ? window->SizeContentsExplicit.x : window->Size.x - window->ScrollbarSizes.x, window->SizeContentsExplicit.y ? window->SizeContentsExplicit.y : window->Size.y - window->ScrollbarSizes.y);
|
||||
ImVec2 content_region_size = ImVec2(window->SizeContentsExplicit.x != 0.0f ? window->SizeContentsExplicit.x : window->Size.x - window->ScrollbarSizes.x, window->SizeContentsExplicit.y != 0.0f ? window->SizeContentsExplicit.y : window->Size.y - window->ScrollbarSizes.y);
|
||||
ImVec2 mx = content_region_size - window->Scroll - window->WindowPadding;
|
||||
if (window->DC.ColumnsCount != 1)
|
||||
mx.x = ImGui::GetColumnOffset(window->DC.ColumnsCurrent + 1) - window->WindowPadding.x;
|
||||
@ -4843,7 +4841,7 @@ ImVec2 ImGui::GetWindowContentRegionMin()
|
||||
ImVec2 ImGui::GetWindowContentRegionMax()
|
||||
{
|
||||
ImGuiWindow* window = GetCurrentWindowRead();
|
||||
ImVec2 content_region_size = ImVec2(window->SizeContentsExplicit.x ? window->SizeContentsExplicit.x : window->Size.x, window->SizeContentsExplicit.y ? window->SizeContentsExplicit.y : window->Size.y);
|
||||
ImVec2 content_region_size = ImVec2(window->SizeContentsExplicit.x != 0.0f ? window->SizeContentsExplicit.x : window->Size.x, window->SizeContentsExplicit.y != 0.0f ? window->SizeContentsExplicit.y : window->Size.y);
|
||||
ImVec2 m = content_region_size - window->Scroll - window->WindowPadding - window->ScrollbarSizes;
|
||||
return m;
|
||||
}
|
||||
@ -9163,7 +9161,7 @@ void ImGui::Columns(int columns_count, const char* id, bool border)
|
||||
window->DC.ColumnsCount = columns_count;
|
||||
window->DC.ColumnsShowBorders = border;
|
||||
|
||||
const float content_region_width = window->SizeContentsExplicit.x ? window->SizeContentsExplicit.x : window->Size.x;
|
||||
const float content_region_width = (window->SizeContentsExplicit.x != 0.0f) ? window->SizeContentsExplicit.x : window->Size.x;
|
||||
window->DC.ColumnsMinX = window->DC.IndentX; // Lock our horizontal range
|
||||
window->DC.ColumnsMaxX = content_region_width - window->Scroll.x - ((window->Flags & ImGuiWindowFlags_NoScrollbar) ? 0 : g.Style.ScrollbarSize);// - window->WindowPadding().x;
|
||||
window->DC.ColumnsStartPosY = window->DC.CursorPos.y;
|
||||
@ -9443,7 +9441,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
ImGui::BulletText("Callback %p, user_data %p", pcmd->UserCallback, pcmd->UserCallbackData);
|
||||
continue;
|
||||
}
|
||||
bool node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "Draw %-4d %s vtx, tex = %p, clip_rect = (%.0f,%.0f)..(%.0f,%.0f)", pcmd->ElemCount, draw_list->IdxBuffer.Size > 0 ? "indexed" : "non-indexed", pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
|
||||
bool pcmd_node_open = ImGui::TreeNode((void*)(pcmd - draw_list->CmdBuffer.begin()), "Draw %-4d %s vtx, tex = %p, clip_rect = (%.0f,%.0f)..(%.0f,%.0f)", pcmd->ElemCount, draw_list->IdxBuffer.Size > 0 ? "indexed" : "non-indexed", pcmd->TextureId, pcmd->ClipRect.x, pcmd->ClipRect.y, pcmd->ClipRect.z, pcmd->ClipRect.w);
|
||||
if (show_clip_rects && ImGui::IsItemHovered())
|
||||
{
|
||||
ImRect clip_rect = pcmd->ClipRect;
|
||||
@ -9454,7 +9452,7 @@ void ImGui::ShowMetricsWindow(bool* p_open)
|
||||
clip_rect.Floor(); overlay_draw_list->AddRect(clip_rect.Min, clip_rect.Max, IM_COL32(255,255,0,255));
|
||||
vtxs_rect.Floor(); overlay_draw_list->AddRect(vtxs_rect.Min, vtxs_rect.Max, IM_COL32(255,0,255,255));
|
||||
}
|
||||
if (!node_open)
|
||||
if (!pcmd_node_open)
|
||||
continue;
|
||||
for (int i = elem_offset; i+2 < elem_offset + (int)pcmd->ElemCount; i += 3)
|
||||
{
|
||||
|
@ -25,9 +25,12 @@
|
||||
#define snprintf _snprintf
|
||||
#endif
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wold-style-cast" // warning : use of old-style cast // yes, they are more terse.
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations" // warning : 'xx' is deprecated: The POSIX name for this item.. // for strdup used in demo code (so user can copy & paste the code)
|
||||
#pragma clang diagnostic ignored "-Wint-to-void-pointer-cast" // warning : cast to 'void *' from smaller integer type 'int'
|
||||
#pragma clang diagnostic ignored "-Wformat-security" // warning : warning: format string is not a string literal
|
||||
#pragma clang diagnostic ignored "-Wexit-time-destructors" // warning : declaration requires an exit-time destructor // exit-time destruction order is undefined. if MemFree() leads to users code that has been disabled before exit it might cause problems. ImGui coding style welcomes static/globals.
|
||||
#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier //
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wint-to-pointer-cast" // warning: cast to pointer from integer of different size
|
||||
@ -2182,7 +2185,7 @@ struct ExampleAppConsole
|
||||
// A better implementation would preserve the data on the current input line along with cursor position.
|
||||
if (prev_history_pos != HistoryPos)
|
||||
{
|
||||
data->CursorPos = data->SelectionStart = data->SelectionEnd = data->BufTextLen = (int)snprintf(data->Buf, data->BufSize, "%s", (HistoryPos >= 0) ? History[HistoryPos] : "");
|
||||
data->CursorPos = data->SelectionStart = data->SelectionEnd = data->BufTextLen = (int)snprintf(data->Buf, (size_t)data->BufSize, "%s", (HistoryPos >= 0) ? History[HistoryPos] : "");
|
||||
data->BufDirty = true;
|
||||
}
|
||||
}
|
||||
@ -2340,7 +2343,7 @@ static void ShowExampleAppPropertyEditor(bool* p_open)
|
||||
|
||||
struct funcs
|
||||
{
|
||||
static void ShowDummyObject(const char* prefix, ImU32 uid)
|
||||
static void ShowDummyObject(const char* prefix, int uid)
|
||||
{
|
||||
ImGui::PushID(uid); // Use object uid as identifier. Most commonly you could also use the object pointer as a base ID.
|
||||
ImGui::AlignFirstTextHeightToWidgets(); // Text and Tree nodes are less high than regular widgets, here we add vertical spacing to make the tree lines equal high.
|
||||
@ -2357,7 +2360,7 @@ static void ShowExampleAppPropertyEditor(bool* p_open)
|
||||
ImGui::PushID(i); // Use field index as identifier.
|
||||
if (i < 2)
|
||||
{
|
||||
ShowDummyObject("Child", ImGui::GetID("foo"));
|
||||
ShowDummyObject("Child", 424242);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -37,7 +37,7 @@
|
||||
#pragma clang diagnostic ignored "-Wfloat-equal" // warning : comparing floating point with == or != is unsafe // storing and comparing against same constants ok.
|
||||
#pragma clang diagnostic ignored "-Wglobal-constructors" // warning : declaration requires a global destructor // similar to above, not sure what the exact difference it.
|
||||
#pragma clang diagnostic ignored "-Wsign-conversion" // warning : implicit conversion changes signedness //
|
||||
//#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier //
|
||||
#pragma clang diagnostic ignored "-Wreserved-id-macro" // warning : macro name is a reserved identifier //
|
||||
#endif
|
||||
#ifdef __GNUC__
|
||||
#pragma GCC diagnostic ignored "-Wunused-function" // warning: 'xxxx' defined but not used
|
||||
|
Loading…
Reference in New Issue
Block a user