Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed some compile warnings with Clang on Windows #3754

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backends/imgui_impl_win32.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ static void ImGui_ImplWin32_UpdateGamepads()

static BOOL CALLBACK ImGui_ImplWin32_UpdateMonitors_EnumFunc(HMONITOR monitor, HDC, LPRECT, LPARAM)
{
MONITORINFO info = { 0 };
MONITORINFO info = { 0, {0,0,0,0}, {0,0,0,0}, 0 };
info.cbSize = sizeof(MONITORINFO);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What is the warning here? Would using = {}; fixes it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Under Clang / VisualStudio2019 / Warning 4

1>....\backends\imgui_impl_win32.cpp(275,28): warning : missing field 'rcMonitor' initializer [-Wmissing-field-initializers]

={}; also Works. Will change it to that.

if (!::GetMonitorInfo(monitor, &info))
return TRUE;
Expand Down
4 changes: 3 additions & 1 deletion imgui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7696,6 +7696,7 @@ static void ImGui::ErrorCheckNewFrameSanityChecks()
for (int monitor_n = 0; monitor_n < g.PlatformIO.Monitors.Size; monitor_n++)
{
ImGuiPlatformMonitor& mon = g.PlatformIO.Monitors[monitor_n];
IM_UNUSED(mon);
IM_ASSERT(mon.MainSize.x > 0.0f && mon.MainSize.y > 0.0f && "Monitor main bounds not setup properly.");
IM_ASSERT(ImRect(mon.MainPos, mon.MainPos + mon.MainSize).Contains(ImRect(mon.WorkPos, mon.WorkPos + mon.WorkSize)) && "Monitor work bounds not setup properly. If you don't have work area information, just copy MainPos/MainSize into them.");
IM_ASSERT(mon.DpiScale != 0.0f);
Expand Down Expand Up @@ -13484,7 +13485,8 @@ bool ImGui::DockNodeBeginAmendTabBar(ImGuiDockNode* node)
Begin(node->HostWindow->Name);
PushOverrideID(node->ID);
bool ret = BeginTabBarEx(node->TabBar, node->TabBar->BarRect, node->TabBar->Flags, node);
IM_ASSERT(ret);
IM_UNUSED(ret);
IM_ASSERT(ret);
return true;
}

Expand Down
3 changes: 2 additions & 1 deletion imgui_widgets.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7305,7 +7305,8 @@ static ImU32 ImGui::TabBarCalcTabID(ImGuiTabBar* tab_bar, const char* label, I
{
if (docked_window != NULL)
{
IM_ASSERT(tab_bar->Flags & ImGuiTabBarFlags_DockNode);
IM_UNUSED(tab_bar);
IM_ASSERT(tab_bar->Flags & ImGuiTabBarFlags_DockNode);
ImGuiID id = ImHashStr(label);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a minor detail (probably more important for other PR) try to configure your IDE to trim trailing spaces.

I do know that VS2019 doesn't honor editor-config exactly like specs requires it (only trim trailing spaces when pressing Enter) but shouldn't be affected here.

KeepAliveID(id);
return id;
Expand Down