Work around or suppress gcc -Wunused-value warnings in wxMSW code.

TDM-GCC 4.9.2 gave many of these warnings for the calls to Windows common
controls macros, avoid them by adding error reporting where it makes sense or
just suppressing the warning by explicitly casting to void elsewhere (e.g. for
the macros which have no meaningful return value at all or return something
that we're not interested in instead of just success/failure indicator).
This commit is contained in:
Vadim Zeitlin
2015-07-27 03:55:01 +02:00
parent 73a5c20613
commit b17b0ab151
4 changed files with 63 additions and 45 deletions

View File

@@ -360,7 +360,7 @@ int wxNotebook::SetSelection(size_t nPage)
UpdateSelection(nPage);
TabCtrl_SetCurSel(GetHwnd(), nPage);
(void)TabCtrl_SetCurSel(GetHwnd(), nPage);
SendPageChangedEvent(selectionOld, nPage);
}
@@ -406,7 +406,7 @@ int wxNotebook::ChangeSelection(size_t nPage)
if ( m_selection == wxNOT_FOUND || nPage != (size_t)m_selection )
{
TabCtrl_SetCurSel(GetHwnd(), nPage);
(void)TabCtrl_SetCurSel(GetHwnd(), nPage);
UpdateSelection(nPage);
}
@@ -508,7 +508,7 @@ wxRect wxNotebook::GetPageSize() const
// The value of 20 is chosen arbitrarily but seems to work
if ( rc.right > 20 && rc.bottom > 20 )
{
TabCtrl_AdjustRect(GetHwnd(), false, &rc);
(void)TabCtrl_AdjustRect(GetHwnd(), false, &rc);
wxCopyRECTToRect(rc, r);
}
@@ -525,7 +525,7 @@ void wxNotebook::SetPageSize(const wxSize& size)
rc.right = size.x;
rc.bottom = size.y;
TabCtrl_AdjustRect(GetHwnd(), true, &rc);
(void)TabCtrl_AdjustRect(GetHwnd(), true, &rc);
// and now set it
SetSize(rc.right - rc.left, rc.bottom - rc.top);
@@ -552,9 +552,11 @@ wxSize wxNotebook::CalcSizeFromPage(const wxSize& sizePage) const
if ( GetPageCount() > 0 )
{
RECT rect;
TabCtrl_GetItemRect(GetHwnd(), 0, &rect);
tabSize.x = rect.right - rect.left;
tabSize.y = rect.bottom - rect.top;
if ( TabCtrl_GetItemRect(GetHwnd(), 0, &rect) )
{
tabSize.x = rect.right - rect.left;
tabSize.y = rect.bottom - rect.top;
}
}
const int rows = GetRowCount();
@@ -601,7 +603,8 @@ wxNotebookPage *wxNotebook::DoRemovePage(size_t nPage)
// selected page is visible and others are hidden:
pageRemoved->Show(false);
TabCtrl_DeleteItem(GetHwnd(), nPage);
if ( !TabCtrl_DeleteItem(GetHwnd(), nPage) )
wxLogLastError(wxS("TabCtrl_DeleteItem()"));
if ( m_pages.IsEmpty() )
{
@@ -654,7 +657,8 @@ bool wxNotebook::DeleteAllPages()
m_pages.Clear();
TabCtrl_DeleteAllItems(GetHwnd());
if ( !TabCtrl_DeleteAllItems(GetHwnd()) )
wxLogLastError(wxS("TabCtrl_DeleteAllItems()"));
m_selection = wxNOT_FOUND;
@@ -986,7 +990,7 @@ void wxNotebook::OnSize(wxSizeEvent& event)
UpdateBgBrush();
#endif // wxUSE_UXTHEME
TabCtrl_AdjustRect(GetHwnd(), false, &rc);
(void)TabCtrl_AdjustRect(GetHwnd(), false, &rc);
int width = rc.right - rc.left,
height = rc.bottom - rc.top;