Skip to content

Commit

Permalink
Merge branch 'warn-more-unused' of https://github.com/lanurmi/wxWidgets
Browse files Browse the repository at this point in the history
Add the wxWARN_UNUSED attribute to more classes.

See wxWidgets#24873.
  • Loading branch information
vadz committed Oct 12, 2024
2 parents 27a58fe + 00df475 commit fcf4883
Show file tree
Hide file tree
Showing 19 changed files with 21 additions and 32 deletions.
4 changes: 2 additions & 2 deletions include/wx/arrstr.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ inline int wxCMPFUNC_CONV wxNaturalStringSortDescending(const wxString& s1, cons

typedef int (wxCMPFUNC_CONV *CMPFUNCwxString)(wxString*, wxString*);

class WXDLLIMPEXP_BASE wxArrayString : public wxBaseArray<wxString>
class WXDLLIMPEXP_BASE wxWARN_UNUSED wxArrayString : public wxBaseArray<wxString>
{
public:
// type of function used by wxArrayString::Sort()
Expand Down Expand Up @@ -155,7 +155,7 @@ class WXDLLIMPEXP_BASE wxSortedArrayString : public wxSortedArrayStringBase
#include <iterator>
#include "wx/afterstd.h"

class WXDLLIMPEXP_BASE wxArrayString
class WXDLLIMPEXP_BASE wxWARN_UNUSED wxArrayString
{
public:
// type of function used by wxArrayString::Sort()
Expand Down
2 changes: 1 addition & 1 deletion include/wx/datetime.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ extern WXDLLIMPEXP_DATA_BASE(const wxDateTime) wxDefaultDateTime;
// wxDateTime represents an absolute moment in the time
// ----------------------------------------------------------------------------

class WXDLLIMPEXP_BASE wxDateTime
class WXDLLIMPEXP_BASE wxWARN_UNUSED wxDateTime
{
public:
// types
Expand Down
8 changes: 4 additions & 4 deletions include/wx/gdicmn.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ enum wxEllipsizeMode
// wxSize
// ---------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxSize
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxSize
{
public:
// members are public for compatibility, don't use them directly.
Expand Down Expand Up @@ -450,7 +450,7 @@ class WXDLLIMPEXP_CORE wxSize
// Point classes: with real or integer coordinates
// ---------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxRealPoint
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxRealPoint
{
public:
double x;
Expand Down Expand Up @@ -600,7 +600,7 @@ class WXDLLIMPEXP_CORE wxRealPoint
// wxPoint: 2D point with integer coordinates
// ----------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxPoint
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxPoint
{
public:
int x, y;
Expand Down Expand Up @@ -766,7 +766,7 @@ WX_DECLARE_LIST_WITH_DECL(wxPoint, wxPointList, class WXDLLIMPEXP_CORE);
// wxRect
// ---------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxRect
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxRect
{
public:
wxRect()
Expand Down
2 changes: 1 addition & 1 deletion include/wx/generic/colour.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "wx/object.h"

// Colour
class WXDLLIMPEXP_CORE wxColour: public wxColourBase
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxColour: public wxColourBase
{
public:
// constructors
Expand Down
2 changes: 1 addition & 1 deletion include/wx/gtk/colour.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ typedef struct _GdkRGBA GdkRGBA;
// wxColour
//-----------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxColour : public wxColourBase
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxColour : public wxColourBase
{
public:
// constructors
Expand Down
8 changes: 4 additions & 4 deletions include/wx/longlong.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@

#if wxUSE_LONGLONG_NATIVE

class WXDLLIMPEXP_BASE wxLongLongNative
class WXDLLIMPEXP_BASE wxWARN_UNUSED wxLongLongNative
{
public:
// ctors
Expand Down Expand Up @@ -356,7 +356,7 @@ class WXDLLIMPEXP_BASE wxLongLongNative
};


class WXDLLIMPEXP_BASE wxULongLongNative
class WXDLLIMPEXP_BASE wxWARN_UNUSED wxULongLongNative
{
public:
// ctors
Expand Down Expand Up @@ -598,7 +598,7 @@ wxLongLongNative& wxLongLongNative::operator=(const wxULongLongNative &ll)

#if wxUSE_LONGLONG_WX

class WXDLLIMPEXP_BASE wxLongLongWx
class WXDLLIMPEXP_BASE wxWARN_UNUSED wxLongLongWx
{
public:
// ctors
Expand Down Expand Up @@ -860,7 +860,7 @@ class WXDLLIMPEXP_BASE wxLongLongWx
};


class WXDLLIMPEXP_BASE wxULongLongWx
class WXDLLIMPEXP_BASE wxWARN_UNUSED wxULongLongWx
{
public:
// ctors
Expand Down
2 changes: 1 addition & 1 deletion include/wx/msw/colour.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// Colour
// ----------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxColour : public wxColourBase
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxColour : public wxColourBase
{
public:
// constructors
Expand Down
2 changes: 1 addition & 1 deletion include/wx/osx/core/colour.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
struct RGBColor;

// Colour
class WXDLLIMPEXP_CORE wxColour: public wxColourBase
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxColour: public wxColourBase
{
public:
// constructors
Expand Down
2 changes: 1 addition & 1 deletion include/wx/qt/colour.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

class QColor;

class WXDLLIMPEXP_CORE wxColour : public wxColourBase
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxColour : public wxColourBase
{
public:
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
Expand Down
2 changes: 1 addition & 1 deletion include/wx/tokenzr.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ enum wxStringTokenizerMode
// wxStringTokenizer: replaces infamous strtok() and has some other features
// ----------------------------------------------------------------------------

class WXDLLIMPEXP_BASE wxStringTokenizer : public wxObject
class WXDLLIMPEXP_BASE wxWARN_UNUSED wxStringTokenizer : public wxObject
{
public:
// ctors and initializers
Expand Down
2 changes: 1 addition & 1 deletion include/wx/x11/colour.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class WXDLLIMPEXP_FWD_CORE wxColour;
// wxColour
//-----------------------------------------------------------------------------

class WXDLLIMPEXP_CORE wxColour : public wxColourBase
class WXDLLIMPEXP_CORE wxWARN_UNUSED wxColour : public wxColourBase
{
public:
// constructors
Expand Down
2 changes: 1 addition & 1 deletion samples/propgrid/propgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2787,7 +2787,7 @@ void FormMain::OnColourScheme( wxCommandEvent& event )
m_propGridManager->Freeze();
m_propGridManager->GetGrid()->SetMarginColour( my_grey_1 );
m_propGridManager->GetGrid()->SetCaptionBackgroundColour( my_grey_1 );
m_propGridManager->GetGrid()->SetLineColour( my_grey_1 );
m_propGridManager->GetGrid()->SetLineColour( my_grey_2 );
m_propGridManager->Thaw();
}
else if ( id == ID_COLOURSCHEME4 )
Expand Down
2 changes: 0 additions & 2 deletions src/aui/auibar.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2549,8 +2549,6 @@ void wxAuiToolBar::OnPaint(wxPaintEvent& WXUNUSED(evt))

void wxAuiToolBar::OnLeftDown(wxMouseEvent& evt)
{
wxRect cli_rect(wxPoint(0,0), GetClientSize());

if (m_gripperSizerItem)
{
wxRect gripper_rect = m_gripperSizerItem->GetRect();
Expand Down
1 change: 0 additions & 1 deletion src/common/http.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,6 @@ void wxHTTP::SendHeaders()
bool wxHTTP::ParseHeaders()
{
wxString line;
wxStringTokenizer tokenzr;

ClearHeaders();
ClearCookies();
Expand Down
1 change: 0 additions & 1 deletion src/generic/gridsel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,6 @@ wxGridSelection::DeselectBlock(const wxGridBlockCoords& block,
void wxGridSelection::ClearSelection()
{
size_t n;
wxRect r;
wxGridCellCoords coords1, coords2;

if ( m_grid->UsesOverlaySelection() )
Expand Down
4 changes: 0 additions & 4 deletions src/richtext/richtextbuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10116,7 +10116,6 @@ bool wxRichTextTable::Draw(wxDC& dc, wxRichTextDrawingContext& context, const wx
wxRichTextCell* cell = GetCell(row, col);
if (cell && cell->IsShown() && !cell->GetRange().IsOutside(range))
{
wxRect childRect(cell->GetPosition(), cell->GetCachedSize());
wxRichTextAttr attr(cell->GetAttributes());
cell->AdjustAttributes(attr, context);
if (row != 0)
Expand Down Expand Up @@ -10395,8 +10394,6 @@ bool wxRichTextTable::Layout(wxReadOnlyDC& dc, wxRichTextDrawingContext& context
spanningWidths.Add(0, m_colCount);
spanningWidthsSpanLengths.Add(0, m_colCount);

wxSize tableSize(tableWidth, 0);

int i, j, k;

for (i = 0; i < m_colCount; i++)
Expand Down Expand Up @@ -12782,7 +12779,6 @@ bool wxRichTextImage::Draw(wxDC& dc, wxRichTextDrawingContext& context, const wx

DrawBoxAttributes(dc, GetBuffer(), attr, wxRect(position, GetCachedSize()));

wxSize imageSize(m_imageCache.GetWidth(), m_imageCache.GetHeight());
wxRect marginRect, borderRect, contentRect, paddingRect, outlineRect;
marginRect = wxRect(position, GetCachedSize()); // outer rectangle, will calculate contentRect
GetBoxRects(dc, GetBuffer(), attr, marginRect, borderRect, contentRect, paddingRect, outlineRect);
Expand Down
4 changes: 2 additions & 2 deletions tests/controls/gridtest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1420,9 +1420,9 @@ TEST_CASE_METHOD(GridTestCase, "Grid::CellFormatting", "[grid]")

CHECK(m_grid->GetCellBackgroundColour(0, 0) == back);

back = m_grid->GetDefaultCellTextColour();
text = m_grid->GetDefaultCellTextColour();

CHECK(m_grid->GetCellTextColour(0, 0) == back);
CHECK(m_grid->GetCellTextColour(0, 0) == text);

m_grid->SetCellAlignment(0, 0, wxALIGN_LEFT, wxALIGN_BOTTOM);
m_grid->GetCellAlignment(0, 0, &cellhoriz, &cellvert);
Expand Down
2 changes: 0 additions & 2 deletions tests/graphics/bitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,6 @@ TEST_CASE("BitmapTestCase::ToImage", "[bitmap][image][convertto]")
#endif // __WXMSW__ || __WXOSX__
{
const wxColour clrFg(*wxCYAN);
const wxColour clrBg(*wxGREEN);
const unsigned char alpha = 92;

#ifdef wxHAS_PREMULTIPLIED_ALPHA
Expand Down Expand Up @@ -489,7 +488,6 @@ TEST_CASE("BitmapTestCase::ToImage", "[bitmap][image][convertto]")
#endif // __WXMSW__ || __WXOSX__
{
const wxColour clrFg(*wxCYAN);
const wxColour clrBg(*wxGREEN);
const unsigned char alpha = 92;
#ifdef wxHAS_PREMULTIPLIED_ALPHA
// premultiplied values
Expand Down
1 change: 0 additions & 1 deletion tests/graphics/graphbitmap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ wxBitmap CreateBitmapRGBA(int w, int h, bool withMask)
#endif // __WXMSW__ || __WXOSX__
{
const wxColour clrFg(*wxCYAN);
const wxColour clrBg(*wxGREEN);
const unsigned char alpha = 51;

#ifdef wxHAS_PREMULTIPLIED_ALPHA
Expand Down

0 comments on commit fcf4883

Please sign in to comment.