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

@@ -340,11 +340,11 @@ static bool SetFocus(HWND hwndTV, HTREEITEM htItem)
// prevent the tree from unselecting the old focus which it
// would do by default (TreeView_SelectItem unselects the
// focused item)
TreeView_SelectItem(hwndTV, 0);
(void)TreeView_SelectItem(hwndTV, 0);
SelectItem(hwndTV, htFocus);
}
TreeView_SelectItem(hwndTV, htItem);
(void)TreeView_SelectItem(hwndTV, htItem);
if ( !wasSelected )
{
@@ -359,7 +359,7 @@ static bool SetFocus(HWND hwndTV, HTREEITEM htItem)
bool wasFocusSelected = IsItemSelected(hwndTV, htFocus);
// just clear the focus
TreeView_SelectItem(hwndTV, 0);
(void)TreeView_SelectItem(hwndTV, 0);
if ( wasFocusSelected )
{
@@ -873,7 +873,7 @@ unsigned int wxTreeCtrl::GetIndent() const
void wxTreeCtrl::SetIndent(unsigned int indent)
{
TreeView_SetIndent(GetHwnd(), indent);
(void)TreeView_SetIndent(GetHwnd(), indent);
}
void wxTreeCtrl::SetAnyImageList(wxImageList *imageList, int which)
@@ -1969,7 +1969,7 @@ void wxTreeCtrl::EnsureVisible(const wxTreeItemId& item)
wxCHECK_RET( !IsHiddenRoot(item), wxT("can't show hidden root item") );
// no error return
TreeView_EnsureVisible(GetHwnd(), HITEM(item));
(void)TreeView_EnsureVisible(GetHwnd(), HITEM(item));
}
void wxTreeCtrl::ScrollTo(const wxTreeItemId& item)
@@ -2031,7 +2031,8 @@ wxTextCtrl *wxTreeCtrl::EditLabel(const wxTreeItemId& item,
// End label editing, optionally cancelling the edit
void wxTreeCtrl::DoEndEditLabel(bool discardChanges)
{
TreeView_EndEditLabelNow(GetHwnd(), discardChanges);
if ( !TreeView_EndEditLabelNow(GetHwnd(), discardChanges) )
wxLogLastError(wxS("TreeView_EndEditLabelNow()"));
DeleteTextCtrl();
}
@@ -2170,7 +2171,8 @@ void wxTreeCtrl::SortChildren(const wxTreeItemId& item)
// OnCompareItems
if ( GetClassInfo() == wxCLASSINFO(wxTreeCtrl) )
{
TreeView_SortChildren(GetHwnd(), HITEM(item), 0);
if ( !TreeView_SortChildren(GetHwnd(), HITEM(item), 0) )
wxLogLastError(wxS("TreeView_SortChildren()"));
}
else
{
@@ -2178,7 +2180,8 @@ void wxTreeCtrl::SortChildren(const wxTreeItemId& item)
tvSort.hParent = HITEM(item);
tvSort.lpfnCompare = wxTreeSortHelper::Compare;
tvSort.lParam = (LPARAM)this;
TreeView_SortChildrenCB(GetHwnd(), &tvSort, 0 /* reserved */);
if ( !TreeView_SortChildrenCB(GetHwnd(), &tvSort, 0 /* reserved */) )
wxLogLastError(wxS("TreeView_SortChildrenCB()"));
}
}
@@ -2996,25 +2999,26 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
tviAux.hItem = HITEM(m_htClickedItem);
tviAux.mask = TVIF_STATE | TVIF_PARAM;
tviAux.stateMask = 0xffffffff;
TreeView_GetItem(GetHwnd(), &tviAux);
if ( TreeView_GetItem(GetHwnd(), &tviAux) )
{
tv.itemNew.state = tviAux.state;
tv.itemNew.lParam = tviAux.lParam;
tv.itemNew.state = tviAux.state;
tv.itemNew.lParam = tviAux.lParam;
tv.ptDrag.x = x;
tv.ptDrag.y = y;
tv.ptDrag.x = x;
tv.ptDrag.y = y;
// do it before SendMessage() call below to avoid
// reentrancies here if there is another WM_MOUSEMOVE
// in the queue already
m_htClickedItem.Unset();
// do it before SendMessage() call below to avoid
// reentrancies here if there is another WM_MOUSEMOVE
// in the queue already
m_htClickedItem.Unset();
::SendMessage(GetHwndOf(GetParent()), WM_NOTIFY,
tv.hdr.idFrom, (LPARAM)&tv );
::SendMessage(GetHwndOf(GetParent()), WM_NOTIFY,
tv.hdr.idFrom, (LPARAM)&tv );
// don't pass it to the default window proc, it would
// start dragging again
processed = true;
// don't pass it to the default window proc, it would
// start dragging again
processed = true;
}
}
}
#endif // __WXWINCE__
@@ -3028,7 +3032,8 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
// highlight the item as target (hiding drag image is
// necessary - otherwise the display will be corrupted)
m_dragImage->Hide();
TreeView_SelectDropTarget(GetHwnd(), htItem);
if ( !TreeView_SelectDropTarget(GetHwnd(), htItem) )
wxLogLastError(wxS("TreeView_SelectDropTarget()"));
m_dragImage->Show();
}
}
@@ -3101,7 +3106,8 @@ wxTreeCtrl::MSWWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
// if we don't do it, the tree seems to think that 2 items
// are selected simultaneously which is quite weird
TreeView_SelectDropTarget(GetHwnd(), 0);
if ( !TreeView_SelectDropTarget(GetHwnd(), 0) )
wxLogLastError(wxS("TreeView_SelectDropTarget(0)"));
}
#endif // wxUSE_DRAGIMAGE
@@ -3235,7 +3241,8 @@ wxTreeCtrl::MSWDefWindowProc(WXUINT nMsg, WXWPARAM wParam, WXLPARAM lParam)
// if we don't do it, the tree seems to think that 2 items
// are selected simultaneously which is quite weird
TreeView_SelectDropTarget(GetHwnd(), 0);
if ( !TreeView_SelectDropTarget(GetHwnd(), 0) )
wxLogLastError(wxS("TreeView_SelectDropTarget(0)"));
}
}
}