Merge branch 'gcc-wextra'
Enable -Wextra for the Unix CI builds after fixing all the existing warnings. See #23662.
This commit is contained in:
commit
d1ee86df3c
22 changed files with 72 additions and 48 deletions
6
.github/workflows/ci.yml
vendored
6
.github/workflows/ci.yml
vendored
|
|
@ -93,6 +93,7 @@ jobs:
|
|||
compiler: g++-4.8
|
||||
container: ubuntu:18.04
|
||||
configure_flags: --disable-shared
|
||||
allow_extra_warnings: true
|
||||
use_xvfb: true
|
||||
- name: Ubuntu 18.04 wxGTK 3 compatible 3.0
|
||||
runner: ubuntu-latest
|
||||
|
|
@ -233,7 +234,10 @@ jobs:
|
|||
esac
|
||||
|
||||
if [ -z ${{ matrix.allow_warnings }} ]; then
|
||||
error_opts="-Werror $allow_warn_opt"
|
||||
if [ -z ${{ matrix.allow_extra_warnings }} ]; then
|
||||
error_opts="-Wextra"
|
||||
fi
|
||||
error_opts="$error_opts -Werror $allow_warn_opt"
|
||||
echo "wxMAKEFILE_ERROR_CXXFLAGS=$error_opts" >> $GITHUB_ENV
|
||||
echo "wxMAKEFILE_CXXFLAGS=$wxMAKEFILE_CXXFLAGS $error_opts" >> $GITHUB_ENV
|
||||
fi
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@
|
|||
#include "wx/thread.h"
|
||||
|
||||
const wxEventType wxEVT_WORKER = wxNewEventType();
|
||||
#define EVT_WORKER(func) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_WORKER, -1, -1, (wxObjectEventFunction) (wxEventFunction) (WorkerEventFunction) & func, (wxObject *) nullptr ),
|
||||
#define EVT_WORKER(func) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_WORKER, -1, -1, wxEVENT_HANDLER_CAST(WorkerEventFunction, func), (wxObject *) nullptr ),
|
||||
|
||||
const int timeout_val = 1000;
|
||||
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ const char *GetSocketErrorMsg(int pSockError)
|
|||
//event sent by workers to server class
|
||||
//after client is served
|
||||
const wxEventType wxEVT_WORKER = wxNewEventType();
|
||||
#define EVT_WORKER(func) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_WORKER, -1, -1, (wxObjectEventFunction) (wxEventFunction) (WorkerEventFunction) & func, (wxObject *) nullptr ),
|
||||
#define EVT_WORKER(func) wxDECLARE_EVENT_TABLE_ENTRY( wxEVT_WORKER, -1, -1, wxEVENT_HANDLER_CAST(WorkerEventFunction, func), (wxObject *) nullptr ),
|
||||
|
||||
class WorkerEvent : public wxEvent
|
||||
{
|
||||
|
|
|
|||
|
|
@ -170,7 +170,9 @@ public:
|
|||
);
|
||||
#endif // GTK+ 3.6/earlier
|
||||
|
||||
wxGCC_WARNING_SUPPRESS(ignored-qualifiers)
|
||||
g_object_ref_sink(widget);
|
||||
wxGCC_WARNING_RESTORE(ignored-qualifiers)
|
||||
|
||||
(void)Create(parent, wxID_ANY, widget);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,6 +15,8 @@
|
|||
|
||||
#include "wx/palette.h"
|
||||
|
||||
#include <vector>
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// wxPalette
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -24,34 +26,20 @@ struct wxPaletteEntry
|
|||
unsigned char red, green, blue;
|
||||
};
|
||||
|
||||
class wxPaletteRefData : public wxGDIRefData
|
||||
struct wxPaletteRefData : public wxGDIRefData
|
||||
{
|
||||
public:
|
||||
wxPaletteRefData();
|
||||
wxPaletteRefData(const wxPaletteRefData& palette);
|
||||
virtual ~wxPaletteRefData();
|
||||
wxPaletteRefData() = default;
|
||||
wxPaletteRefData(const wxPaletteRefData& other);
|
||||
|
||||
int m_count;
|
||||
wxPaletteEntry *m_entries;
|
||||
std::vector<wxPaletteEntry> m_entries;
|
||||
};
|
||||
|
||||
wxPaletteRefData::wxPaletteRefData()
|
||||
{
|
||||
m_count = 0;
|
||||
m_entries = nullptr;
|
||||
}
|
||||
|
||||
// We need to define the copy ctor explicitly because the base class copy
|
||||
// ctor is deleted.
|
||||
wxPaletteRefData::wxPaletteRefData(const wxPaletteRefData& palette)
|
||||
: wxGDIRefData()
|
||||
{
|
||||
m_count = palette.m_count;
|
||||
m_entries = new wxPaletteEntry[m_count];
|
||||
for ( int i = 0; i < m_count; i++ )
|
||||
m_entries[i] = palette.m_entries[i];
|
||||
}
|
||||
|
||||
wxPaletteRefData::~wxPaletteRefData()
|
||||
{
|
||||
delete[] m_entries;
|
||||
m_entries = palette.m_entries;
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
|
@ -77,7 +65,7 @@ wxPalette::~wxPalette()
|
|||
int wxPalette::GetColoursCount() const
|
||||
{
|
||||
if (m_refData)
|
||||
return M_PALETTEDATA->m_count;
|
||||
return M_PALETTEDATA->m_entries.size();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -90,15 +78,16 @@ bool wxPalette::Create(int n,
|
|||
UnRef();
|
||||
m_refData = new wxPaletteRefData();
|
||||
|
||||
M_PALETTEDATA->m_count = n;
|
||||
M_PALETTEDATA->m_entries = new wxPaletteEntry[n];
|
||||
M_PALETTEDATA->m_entries.resize(n);
|
||||
|
||||
wxPaletteEntry *e = M_PALETTEDATA->m_entries;
|
||||
for (int i = 0; i < n; i++, e++)
|
||||
int i = 0;
|
||||
for ( wxPaletteEntry& e : M_PALETTEDATA->m_entries )
|
||||
{
|
||||
e->red = red[i];
|
||||
e->green = green[i];
|
||||
e->blue = blue[i];
|
||||
e.red = red[i];
|
||||
e.green = green[i];
|
||||
e.blue = blue[i];
|
||||
|
||||
++i;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -113,15 +102,17 @@ int wxPalette::GetPixel( unsigned char red,
|
|||
int closest = 0;
|
||||
double d,distance = 1000.0; // max. dist is 256
|
||||
|
||||
wxPaletteEntry *e = M_PALETTEDATA->m_entries;
|
||||
for (int i = 0; i < M_PALETTEDATA->m_count; i++, e++)
|
||||
int i = 0;
|
||||
for ( const wxPaletteEntry& e : M_PALETTEDATA->m_entries )
|
||||
{
|
||||
if ((d = 0.299 * abs(red - e->red) +
|
||||
0.587 * abs(green - e->green) +
|
||||
0.114 * abs(blue - e->blue)) < distance) {
|
||||
if ((d = 0.299 * abs(red - e.red) +
|
||||
0.587 * abs(green - e.green) +
|
||||
0.114 * abs(blue - e.blue)) < distance) {
|
||||
distance = d;
|
||||
closest = i;
|
||||
}
|
||||
|
||||
++i;
|
||||
}
|
||||
return closest;
|
||||
}
|
||||
|
|
@ -134,7 +125,7 @@ bool wxPalette::GetRGB(int pixel,
|
|||
if ( !m_refData )
|
||||
return false;
|
||||
|
||||
if ( pixel < 0 || pixel >= M_PALETTEDATA->m_count )
|
||||
if ( pixel < 0 || (unsigned)pixel >= M_PALETTEDATA->m_entries.size() )
|
||||
return false;
|
||||
|
||||
wxPaletteEntry& p = M_PALETTEDATA->m_entries[pixel];
|
||||
|
|
|
|||
|
|
@ -356,12 +356,16 @@ wxgtk_webview_handle_method_call(GDBusConnection*,
|
|||
}
|
||||
} // extern "C"
|
||||
|
||||
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
|
||||
|
||||
static const GDBusInterfaceVTable interface_vtable = {
|
||||
wxgtk_webview_handle_method_call,
|
||||
nullptr,
|
||||
nullptr
|
||||
};
|
||||
|
||||
wxGCC_WARNING_RESTORE(missing-field-initializers)
|
||||
|
||||
static
|
||||
gboolean
|
||||
wxgtk_webview_dbus_peer_is_authorized(GCredentials *peer_credentials)
|
||||
|
|
|
|||
|
|
@ -248,7 +248,7 @@ public:
|
|||
if ( !m_state )
|
||||
{
|
||||
m_ctx = xkb_context_new(XKB_CONTEXT_NO_FLAGS);
|
||||
struct xkb_rule_names names = {0};
|
||||
xkb_rule_names names{};
|
||||
names.layout = "us";
|
||||
m_keymap = xkb_keymap_new_from_names(m_ctx, &names, XKB_KEYMAP_COMPILE_NO_FLAGS);
|
||||
m_state = xkb_state_new(m_keymap);
|
||||
|
|
|
|||
|
|
@ -68,7 +68,8 @@ class wxBrushRefData: public wxGDIRefData
|
|||
}
|
||||
|
||||
wxBrushRefData( const wxBrushRefData& data )
|
||||
: m_qtBrush(data.m_qtBrush)
|
||||
: wxGDIRefData(),
|
||||
m_qtBrush(data.m_qtBrush)
|
||||
{
|
||||
m_style = data.m_style;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -50,7 +50,8 @@ class wxCursorRefData: public wxGDIRefData
|
|||
{
|
||||
public:
|
||||
wxCursorRefData() {}
|
||||
wxCursorRefData( const wxCursorRefData& data ) : m_qtCursor(data.m_qtCursor) {}
|
||||
wxCursorRefData( const wxCursorRefData& data )
|
||||
: wxGDIRefData(), m_qtCursor(data.m_qtCursor) {}
|
||||
wxCursorRefData( QCursor &c ) : m_qtCursor(c) {}
|
||||
|
||||
QCursor m_qtCursor;
|
||||
|
|
|
|||
|
|
@ -361,6 +361,7 @@ wxRegionIterator::wxRegionIterator(const wxRegion& region)
|
|||
}
|
||||
|
||||
wxRegionIterator::wxRegionIterator(const wxRegionIterator& ri)
|
||||
: wxObject()
|
||||
{
|
||||
m_qtRects = new QVector< QRect >( *ri.m_qtRects );
|
||||
m_pos = ri.m_pos;
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
Subproject commit 7cab74cefa54851e99b8c06bd6e2cd659b4958ae
|
||||
Subproject commit e1fc0520777932a6c2d5d82eca4911ee264e7b8d
|
||||
|
|
@ -1 +1 @@
|
|||
Subproject commit b662e55b3d8143bdad94e9a373679c0bfa3f834d
|
||||
Subproject commit 0b90f31ced23241054e8088abb50babe9a44ae67
|
||||
|
|
@ -1392,7 +1392,10 @@ wxThreadError wxThread::Run()
|
|||
|
||||
void wxThread::SetPriority(unsigned int prio)
|
||||
{
|
||||
wxCHECK_RET( wxPRIORITY_MIN <= prio && prio <= wxPRIORITY_MAX,
|
||||
// Don't compare with wxPRIORITY_MIN as long as it is 0, as the comparison
|
||||
// would be always true.
|
||||
static_assert( wxPRIORITY_MIN == 0, "update the check below" );
|
||||
wxCHECK_RET( /* wxPRIORITY_MIN <= prio && */ prio <= wxPRIORITY_MAX,
|
||||
wxT("invalid thread priority") );
|
||||
|
||||
wxCriticalSectionLocker lock(m_critsect);
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ wxMask::wxMask()
|
|||
}
|
||||
|
||||
wxMask::wxMask(const wxMask& mask)
|
||||
: wxObject()
|
||||
{
|
||||
m_display = mask.m_display;
|
||||
if ( !mask.m_bitmap )
|
||||
|
|
@ -285,6 +286,7 @@ wxBitmapRefData::wxBitmapRefData()
|
|||
}
|
||||
|
||||
wxBitmapRefData::wxBitmapRefData(const wxBitmapRefData& data)
|
||||
: wxGDIRefData()
|
||||
{
|
||||
m_pixmap = 0;
|
||||
m_bitmap = 0;
|
||||
|
|
|
|||
|
|
@ -32,6 +32,7 @@ public:
|
|||
}
|
||||
|
||||
wxBrushRefData( const wxBrushRefData& data )
|
||||
: wxGDIRefData()
|
||||
{
|
||||
m_style = data.m_style;
|
||||
m_stipple = data.m_stipple;
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ public:
|
|||
}
|
||||
|
||||
wxColourRefData(const wxColourRefData& data)
|
||||
: wxGDIRefData()
|
||||
{
|
||||
m_color = data.m_color;
|
||||
m_colormap = data.m_colormap;
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ public:
|
|||
}
|
||||
|
||||
wxPenRefData( const wxPenRefData& data )
|
||||
: wxGDIRefData()
|
||||
{
|
||||
m_style = data.m_style;
|
||||
m_width = data.m_width;
|
||||
|
|
|
|||
|
|
@ -39,6 +39,7 @@ public:
|
|||
}
|
||||
|
||||
wxRegionRefData(const wxRegionRefData& refData)
|
||||
: wxGDIRefData()
|
||||
{
|
||||
m_region = XCreateRegion();
|
||||
XUnionRegion( refData.m_region, m_region, m_region );
|
||||
|
|
|
|||
|
|
@ -479,8 +479,8 @@ class wxMyVariantData : public wxVariantData
|
|||
{
|
||||
public:
|
||||
wxMyVariantData(const MyClass& value)
|
||||
: m_value(value)
|
||||
{
|
||||
m_value = value;
|
||||
}
|
||||
|
||||
virtual bool Eq(wxVariantData& WXUNUSED(data)) const override
|
||||
|
|
|
|||
|
|
@ -165,10 +165,13 @@ TEST_CASE("Event::BuiltinConnect", "[event][connect]")
|
|||
handler.Connect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle), nullptr, &handler);
|
||||
handler.Disconnect(wxEVT_IDLE, wxIdleEventHandler(MyHandler::OnIdle), nullptr, &handler);
|
||||
|
||||
// using casts like this is even uglier than using wxIdleEventHandler but
|
||||
// it should still continue to work for compatibility
|
||||
// using casts like this is even uglier than using wxIdleEventHandler and
|
||||
// results in warnings with gcc, but it should still continue to work for
|
||||
// compatibility
|
||||
wxGCC_WARNING_SUPPRESS_CAST_FUNCTION_TYPE()
|
||||
handler.Connect(wxEVT_IDLE, (wxObjectEventFunction)(wxEventFunction)&MyHandler::OnIdle);
|
||||
handler.Disconnect(wxEVT_IDLE, (wxObjectEventFunction)(wxEventFunction)&MyHandler::OnIdle);
|
||||
wxGCC_WARNING_RESTORE_CAST_FUNCTION_TYPE()
|
||||
|
||||
handler.Bind(wxEVT_IDLE, GlobalOnIdle);
|
||||
handler.Unbind(wxEVT_IDLE, GlobalOnIdle);
|
||||
|
|
|
|||
|
|
@ -497,6 +497,8 @@ struct MyStruct
|
|||
class MyHash
|
||||
{
|
||||
public:
|
||||
MyHash() = default;
|
||||
MyHash(const MyHash&) = default;
|
||||
unsigned long operator()(const MyStruct& s) const
|
||||
{ return m_dummy(s.ptr); }
|
||||
MyHash& operator=(const MyHash&) { return *this; }
|
||||
|
|
@ -507,6 +509,8 @@ private:
|
|||
class MyEqual
|
||||
{
|
||||
public:
|
||||
MyEqual() = default;
|
||||
MyEqual(const MyEqual&) = default;
|
||||
bool operator()(const MyStruct& s1, const MyStruct& s2) const
|
||||
{ return s1.ptr == s2.ptr; }
|
||||
MyEqual& operator=(const MyEqual&) { return *this; }
|
||||
|
|
|
|||
|
|
@ -252,6 +252,8 @@ wxIMPLEMENT_APP_CONSOLE(XmlResApp);
|
|||
|
||||
int XmlResApp::OnRun()
|
||||
{
|
||||
wxGCC_WARNING_SUPPRESS(missing-field-initializers)
|
||||
|
||||
static const wxCmdLineEntryDesc cmdLineDesc[] =
|
||||
{
|
||||
{ wxCMD_LINE_SWITCH, "h", "help", "show help message", wxCMD_LINE_VAL_NONE, wxCMD_LINE_OPTION_HELP },
|
||||
|
|
@ -275,6 +277,8 @@ int XmlResApp::OnRun()
|
|||
wxCMD_LINE_DESC_END
|
||||
};
|
||||
|
||||
wxGCC_WARNING_RESTORE(missing-field-initializers)
|
||||
|
||||
wxCmdLineParser parser(cmdLineDesc, argc, argv);
|
||||
|
||||
switch (parser.Parse())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue