Avoid Clang -Wcomma warnings

For the few cases that are not trivially avoidable,
use a cast to void to silence the warning.
This commit is contained in:
Paul Cornett 2023-11-23 09:17:21 -08:00
parent 4e679c4649
commit 222883d98f
15 changed files with 41 additions and 20 deletions

View file

@ -72,7 +72,7 @@ ChessBoard::ChessBoard(wxWindow* parent)
return false; // not on a square
}
file = FileLetters[colIdx],
file = FileLetters[colIdx];
// convert rowIdx (top to down 0 to 7) to rank (top to down 8 to 1)
rank = static_cast<wxUint8>(SquaresPerSide - rowIdx);

View file

@ -87,7 +87,10 @@ static CharsetItem* BuildReverseTable(const wxUint16 *tbl)
CharsetItem *rev = new CharsetItem[128];
for (int i = 0; i < 128; i++)
rev[i].c = wxUint8(128 + i), rev[i].u = tbl[i];
{
rev[i].c = wxUint8(128 + i);
rev[i].u = tbl[i];
}
qsort(rev, 128, sizeof(CharsetItem), CompareCharsetItems);

View file

@ -438,9 +438,9 @@ wxString wxArchiveFSHandler::FindFirst(const wxString& spec, int flags)
switch (flags)
{
case wxFILE:
m_AllowDirs = false, m_AllowFiles = true; break;
m_AllowDirs = false; m_AllowFiles = true; break;
case wxDIR:
m_AllowDirs = true, m_AllowFiles = false; break;
m_AllowDirs = true; m_AllowFiles = false; break;
default:
m_AllowDirs = m_AllowFiles = true; break;
}

View file

@ -158,8 +158,8 @@ bool wxIFFDecoder::ConvertToImage(wxImage *image) const
}
}
pal[3 * transparent + 0] = 255,
pal[3 * transparent + 1] = 0,
pal[3 * transparent + 0] = 255;
pal[3 * transparent + 1] = 0;
pal[3 * transparent + 2] = 255;
image->SetMaskColour(255, 0, 255);

View file

@ -739,7 +739,10 @@ WXDLLIMPEXP_BASE int wxCRT_StrnicmpW(const wchar_t *s1, const wchar_t *s2, size_
{
// initialize the variables just to suppress stupid gcc warning
wchar_t c1 = 0, c2 = 0;
while (n && ((c1 = wxTolower(*s1)) == (c2 = wxTolower(*s2)) ) && c1) n--, s1++, s2++;
while (n && ((c1 = wxTolower(*s1)) == (c2 = wxTolower(*s2)) ) && c1)
{
n--; s1++; s2++;
}
if (n) {
if (c1 < c2) return -1;
if (c1 > c2) return 1;

View file

@ -4939,9 +4939,15 @@ void wxGrid::ProcessGridCellMouseEvent(wxMouseEvent& event, wxGridWindow *eventG
DisableCellEditControl();
if ( event.LeftDown() )
handled = (DoGridCellLeftDown(event, coords, pos), true);
{
DoGridCellLeftDown(event, coords, pos);
handled = true;
}
else if ( event.LeftDClick() )
handled = (DoGridCellLeftDClick(event, coords, pos), true);
{
DoGridCellLeftDClick(event, coords, pos);
handled = true;
}
else if ( event.RightDown() )
handled = SendEvent(wxEVT_GRID_CELL_RIGHT_CLICK, coords, event) != Event_Unhandled;
else if ( event.RightDClick() )

View file

@ -652,7 +652,7 @@ void wxHeaderCtrl::OnMouse(wxMouseEvent& mevent)
// find if the event is over a column at all
bool onSeparator;
const unsigned col = mevent.Leaving()
? (onSeparator = false, COL_NONE)
? ((void)(onSeparator = false), COL_NONE)
: FindColumnAtPoint(xPhysical, &onSeparator);

View file

@ -1588,7 +1588,8 @@ wxHtmlWidgetCell::wxHtmlWidgetCell(wxWindow *wnd, int w)
int sx, sy;
m_Wnd = wnd;
m_Wnd->GetSize(&sx, &sy);
m_Width = sx, m_Height = sy;
m_Width = sx;
m_Height = sy;
m_WidthFloat = w;
}

View file

@ -407,9 +407,15 @@ wxHtmlTag::wxHtmlTag(wxHtmlTag *parent,
if (!IS_WHITE(c))
{
if (c == wxT('"') || c == wxT('\''))
quote = c, pvalue = wxGetEmptyString();
{
quote = c;
pvalue.clear();
}
else
quote = 0, pvalue = c;
{
quote = 0;
pvalue = c;
}
state = ST_VALUE;
}
break;

View file

@ -589,7 +589,8 @@ void wxHtmlImageCell::Draw(wxDC& dc, int x, int y,
dc.SetBrush(*wxTRANSPARENT_BRUSH);
dc.SetPen(*wxBLACK_PEN);
dc.DrawRectangle(x + m_PosX, y + m_PosY, m_Width, m_Height);
x++, y++;
x++;
y++;
}
if ( m_bitmap && m_Width && m_Height )
{

View file

@ -342,7 +342,8 @@ void wxHtmlWinParser::AddText(const wxString& txt)
const wxChar d = temp[templen++] = *i;
if ((d == wxT('\n')) || (d == wxT('\r')) || (d == wxT(' ')) || (d == wxT('\t')))
{
++i, ++x;
++i;
++x;
while ( (i < end) &&
(*i == wxT('\n') || *i == wxT('\r') ||
*i == wxT(' ') || *i == wxT('\t')) )

View file

@ -581,12 +581,12 @@ miCreateETandAET(int count, const wxPoint * pts, EdgeTable *ET, EdgeTableEntry *
*/
if (PrevPt->y > CurrPt->y)
{
bottom = PrevPt, top = CurrPt;
bottom = PrevPt; top = CurrPt;
pETEs->ClockWise = 0;
}
else
{
bottom = CurrPt, top = PrevPt;
bottom = CurrPt; top = PrevPt;
pETEs->ClockWise = 1;
}

View file

@ -376,7 +376,7 @@ int wxListBox::DoInsertItems(const wxArrayStringsAdapter& items,
{
const wxString& item = items[i];
idx = IsSorted() ? m_strings.sorted->Add(item)
: (m_strings.unsorted->Insert(item, pos), pos++);
: ((void)m_strings.unsorted->Insert(item, pos), pos++);
m_itemsClientData.Insert(nullptr, idx);
AssignNewItemClientData(idx, clientData, i, type);

View file

@ -678,7 +678,7 @@ public:
{
#ifdef wxPG_TEXTCTRLXADJUST
textCtrlXAdjust = wxPG_TEXTCTRLXADJUST -
(wxPG_XBEFOREWIDGET+wxPG_CONTROL_MARGIN+1) - 1,
(wxPG_XBEFOREWIDGET+wxPG_CONTROL_MARGIN+1) - 1;
#endif
wxOwnerDrawnComboBox::PositionTextCtrl(
textCtrlXAdjust + wxPG_TEXTCTRLXADJUST3,

View file

@ -56,6 +56,6 @@ void wxColour::Init()
void wxColour::InitRGBA(ChannelType r, ChannelType g, ChannelType b, ChannelType a)
{
m_red = r, m_green = g, m_blue = b, m_alpha = a;
m_red = r; m_green = g; m_blue = b; m_alpha = a;
m_valid = true;
}