mirror of
https://github.com/wxWidgets/wxWidgets.git
synced 2026-09-25 00:43:39 +08:00
Explicitly define copy ctors etc in classes with virtual dtors
This avoids gcc 14 giving -Wdeprecated-copy-dtor for these classes.
This warning was fixed by fc35ad92bb (Remove unnecessary empty
destructors, 2024-01-26) in master, but we can't remove the dtors in
this branch, so add copy ctors and assignment operators here using new
wxDECLARE_DEFAULT_COPY() and wxDECLARE_DEFAULT_COPY_AND_DEF() macros,
which can be fine-tuned later (e.g. to do it only for gcc 14, if it has
any adverse effects on some other compiler) if necessary.
Note that this also required adding some default ctors, as adding the
copy ctor suppressed the generation of the default compiler-generated
default ctor.
Closes #24502.
This commit is contained in:
@@ -298,6 +298,7 @@ wxGTK:
|
|||||||
- Fix handling binary data in wxSecretStore (Martin Corino, #24351).
|
- Fix handling binary data in wxSecretStore (Martin Corino, #24351).
|
||||||
- Make GTKSuppressDiagnostics(), broken since 3.2.1, work again (#24432).
|
- Make GTKSuppressDiagnostics(), broken since 3.2.1, work again (#24432).
|
||||||
- Fix wxTE_PROCESS_ENTER in wxGTK comboboxes with autocomplete (#24394).
|
- Fix wxTE_PROCESS_ENTER in wxGTK comboboxes with autocomplete (#24394).
|
||||||
|
- Fix -Wdeprecated-copy-dtor warnings in the headers with gcc 14 (#24502).
|
||||||
|
|
||||||
wxMSW:
|
wxMSW:
|
||||||
|
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ enum wxBrushStyle
|
|||||||
class WXDLLIMPEXP_CORE wxBrushBase: public wxGDIObject
|
class WXDLLIMPEXP_CORE wxBrushBase: public wxGDIObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
wxDECLARE_DEFAULT_COPY_AND_DEF(wxBrushBase)
|
||||||
virtual ~wxBrushBase() { }
|
virtual ~wxBrushBase() { }
|
||||||
|
|
||||||
virtual void SetColour(const wxColour& col) = 0;
|
virtual void SetColour(const wxColour& col) = 0;
|
||||||
|
|||||||
+2
-1
@@ -88,7 +88,8 @@ public:
|
|||||||
// type of a single colour component
|
// type of a single colour component
|
||||||
typedef unsigned char ChannelType;
|
typedef unsigned char ChannelType;
|
||||||
|
|
||||||
wxColourBase() {}
|
wxDECLARE_DEFAULT_COPY_AND_DEF(wxColourBase)
|
||||||
|
|
||||||
virtual ~wxColourBase() {}
|
virtual ~wxColourBase() {}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3232,14 +3232,28 @@ typedef const void* WXWidget;
|
|||||||
|
|
||||||
#if defined(__cplusplus) && (__cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(14))
|
#if defined(__cplusplus) && (__cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(14))
|
||||||
#define wxMEMBER_DELETE = delete
|
#define wxMEMBER_DELETE = delete
|
||||||
|
|
||||||
|
// Note that all these macros don't require a semicolon after them because
|
||||||
|
// they are empty in the "#else" branch and can't be followed by a
|
||||||
|
// semicolon in that case.
|
||||||
#define wxDECLARE_DEFAULT_COPY_CTOR(classname) \
|
#define wxDECLARE_DEFAULT_COPY_CTOR(classname) \
|
||||||
public: \
|
public: \
|
||||||
classname(const classname&) = default;
|
classname(const classname&) = default;
|
||||||
|
|
||||||
|
#define wxDECLARE_DEFAULT_COPY(classname) \
|
||||||
|
wxDECLARE_DEFAULT_COPY_CTOR(classname) \
|
||||||
|
classname& operator=(const classname&) = default;
|
||||||
|
|
||||||
|
#define wxDECLARE_DEFAULT_COPY_AND_DEF(classname) \
|
||||||
|
classname() = default; \
|
||||||
|
wxDECLARE_DEFAULT_COPY(classname)
|
||||||
#else
|
#else
|
||||||
#define wxMEMBER_DELETE
|
#define wxMEMBER_DELETE
|
||||||
|
|
||||||
// We can't do this without C++11 "= default".
|
// We can't do this without C++11 "= default".
|
||||||
#define wxDECLARE_DEFAULT_COPY_CTOR(classname)
|
#define wxDECLARE_DEFAULT_COPY_CTOR(classname)
|
||||||
|
#define wxDECLARE_DEFAULT_COPY(classname)
|
||||||
|
#define wxDECLARE_DEFAULT_COPY_AND_DEF(classname)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define wxDECLARE_NO_COPY_CLASS(classname) \
|
#define wxDECLARE_NO_COPY_CLASS(classname) \
|
||||||
|
|||||||
+2
-1
@@ -341,7 +341,8 @@ public:
|
|||||||
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
wxFontEncoding encoding = wxFONTENCODING_DEFAULT);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// creator function
|
wxDECLARE_DEFAULT_COPY_AND_DEF(wxFontBase)
|
||||||
|
|
||||||
virtual ~wxFontBase();
|
virtual ~wxFontBase();
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,9 @@ class WXDLLIMPEXP_CORE wxAcceleratorTable : public wxObject
|
|||||||
public:
|
public:
|
||||||
wxAcceleratorTable();
|
wxAcceleratorTable();
|
||||||
wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]);
|
wxAcceleratorTable(int n, const wxAcceleratorEntry entries[]);
|
||||||
|
|
||||||
|
wxDECLARE_DEFAULT_COPY(wxAcceleratorTable)
|
||||||
|
|
||||||
virtual ~wxAcceleratorTable();
|
virtual ~wxAcceleratorTable();
|
||||||
|
|
||||||
bool Ok() const { return IsOk(); }
|
bool Ok() const { return IsOk(); }
|
||||||
|
|||||||
@@ -22,10 +22,7 @@ public:
|
|||||||
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
DEFINE_STD_WXCOLOUR_CONSTRUCTORS
|
||||||
|
|
||||||
// copy ctors and assignment operators
|
// copy ctors and assignment operators
|
||||||
wxColour(const wxColour& col)
|
wxDECLARE_DEFAULT_COPY_CTOR(wxColour)
|
||||||
{
|
|
||||||
*this = col;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxColour& operator=(const wxColour& col);
|
wxColour& operator=(const wxColour& col);
|
||||||
|
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ class WXDLLIMPEXP_CORE wxPalette: public wxPaletteBase
|
|||||||
public:
|
public:
|
||||||
wxPalette();
|
wxPalette();
|
||||||
wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue );
|
wxPalette( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue );
|
||||||
|
|
||||||
|
wxDECLARE_DEFAULT_COPY(wxPalette)
|
||||||
|
|
||||||
virtual ~wxPalette();
|
virtual ~wxPalette();
|
||||||
|
|
||||||
bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
|
bool Create( int n, const unsigned char *red, const unsigned char *green, const unsigned char *blue);
|
||||||
|
|||||||
@@ -129,6 +129,9 @@ class WXDLLIMPEXP_CORE wxGraphicsObject : public wxObject
|
|||||||
public:
|
public:
|
||||||
wxGraphicsObject();
|
wxGraphicsObject();
|
||||||
wxGraphicsObject( wxGraphicsRenderer* renderer );
|
wxGraphicsObject( wxGraphicsRenderer* renderer );
|
||||||
|
|
||||||
|
wxDECLARE_DEFAULT_COPY(wxGraphicsObject)
|
||||||
|
|
||||||
virtual ~wxGraphicsObject();
|
virtual ~wxGraphicsObject();
|
||||||
|
|
||||||
bool IsNull() const;
|
bool IsNull() const;
|
||||||
@@ -209,6 +212,8 @@ class WXDLLIMPEXP_CORE wxGraphicsMatrix : public wxGraphicsObject
|
|||||||
public:
|
public:
|
||||||
wxGraphicsMatrix() {}
|
wxGraphicsMatrix() {}
|
||||||
|
|
||||||
|
wxDECLARE_DEFAULT_COPY(wxGraphicsMatrix)
|
||||||
|
|
||||||
virtual ~wxGraphicsMatrix() {}
|
virtual ~wxGraphicsMatrix() {}
|
||||||
|
|
||||||
// concatenates the matrix
|
// concatenates the matrix
|
||||||
|
|||||||
@@ -79,6 +79,9 @@ public:
|
|||||||
#endif // wxUSE_IMAGE
|
#endif // wxUSE_IMAGE
|
||||||
wxBitmap(GdkPixbuf* pixbuf, int depth = 0);
|
wxBitmap(GdkPixbuf* pixbuf, int depth = 0);
|
||||||
explicit wxBitmap(const wxCursor& cursor);
|
explicit wxBitmap(const wxCursor& cursor);
|
||||||
|
|
||||||
|
wxDECLARE_DEFAULT_COPY(wxBitmap)
|
||||||
|
|
||||||
virtual ~wxBitmap();
|
virtual ~wxBitmap();
|
||||||
|
|
||||||
bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) wxOVERRIDE;
|
bool Create(int width, int height, int depth = wxBITMAP_SCREEN_DEPTH) wxOVERRIDE;
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ public:
|
|||||||
|
|
||||||
wxBrush( const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID );
|
wxBrush( const wxColour &colour, wxBrushStyle style = wxBRUSHSTYLE_SOLID );
|
||||||
wxBrush( const wxBitmap &stippleBitmap );
|
wxBrush( const wxBitmap &stippleBitmap );
|
||||||
|
|
||||||
|
wxDECLARE_DEFAULT_COPY(wxBrush)
|
||||||
|
|
||||||
virtual ~wxBrush();
|
virtual ~wxBrush();
|
||||||
|
|
||||||
bool operator==(const wxBrush& brush) const;
|
bool operator==(const wxBrush& brush) const;
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ public:
|
|||||||
wxColour(const GdkRGBA& gdkRGBA);
|
wxColour(const GdkRGBA& gdkRGBA);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
wxDECLARE_DEFAULT_COPY(wxColour)
|
||||||
|
|
||||||
virtual ~wxColour();
|
virtual ~wxColour();
|
||||||
|
|
||||||
bool operator==(const wxColour& col) const;
|
bool operator==(const wxColour& col) const;
|
||||||
|
|||||||
@@ -35,6 +35,8 @@ public:
|
|||||||
const char maskBits[] = NULL,
|
const char maskBits[] = NULL,
|
||||||
const wxColour* fg = NULL, const wxColour* bg = NULL);
|
const wxColour* fg = NULL, const wxColour* bg = NULL);
|
||||||
|
|
||||||
|
wxDECLARE_DEFAULT_COPY(wxCursor)
|
||||||
|
|
||||||
virtual wxPoint GetHotSpot() const wxOVERRIDE;
|
virtual wxPoint GetHotSpot() const wxOVERRIDE;
|
||||||
|
|
||||||
virtual ~wxCursor();
|
virtual ~wxCursor();
|
||||||
|
|||||||
@@ -50,6 +50,8 @@ public:
|
|||||||
SetPixelSize(pixelSize);
|
SetPixelSize(pixelSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
wxDECLARE_DEFAULT_COPY(wxFont)
|
||||||
|
|
||||||
bool Create(int size,
|
bool Create(int size,
|
||||||
wxFontFamily family,
|
wxFontFamily family,
|
||||||
wxFontStyle style,
|
wxFontStyle style,
|
||||||
|
|||||||
@@ -22,6 +22,8 @@ public:
|
|||||||
|
|
||||||
wxPen( const wxPenInfo& info );
|
wxPen( const wxPenInfo& info );
|
||||||
|
|
||||||
|
wxDECLARE_DEFAULT_COPY(wxPen)
|
||||||
|
|
||||||
virtual ~wxPen();
|
virtual ~wxPen();
|
||||||
|
|
||||||
bool operator==(const wxPen& pen) const;
|
bool operator==(const wxPen& pen) const;
|
||||||
|
|||||||
@@ -22,6 +22,8 @@
|
|||||||
class WXDLLIMPEXP_CORE wxPaletteBase: public wxGDIObject
|
class WXDLLIMPEXP_CORE wxPaletteBase: public wxGDIObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
wxDECLARE_DEFAULT_COPY_AND_DEF(wxPaletteBase)
|
||||||
|
|
||||||
virtual ~wxPaletteBase() { }
|
virtual ~wxPaletteBase() { }
|
||||||
|
|
||||||
virtual int GetColoursCount() const { wxFAIL_MSG( wxT("not implemented") ); return 0; }
|
virtual int GetColoursCount() const { wxFAIL_MSG( wxT("not implemented") ); return 0; }
|
||||||
|
|||||||
@@ -63,6 +63,7 @@ private:
|
|||||||
class WXDLLIMPEXP_CORE wxPenBase : public wxGDIObject
|
class WXDLLIMPEXP_CORE wxPenBase : public wxGDIObject
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
wxDECLARE_DEFAULT_COPY_AND_DEF(wxPenBase)
|
||||||
virtual ~wxPenBase() { }
|
virtual ~wxPenBase() { }
|
||||||
|
|
||||||
virtual void SetColour(const wxColour& col) = 0;
|
virtual void SetColour(const wxColour& col) = 0;
|
||||||
|
|||||||
Reference in New Issue
Block a user