Avoid -Wdeprecated-copy for many event classes from clang 13

Add new macros wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN_DEF_COPY() and
wxDECLARE_NO_ASSIGN_DEF_COPY() and use them instead of
wxDECLARE_DYNAMIC_CLASS_NO_ASSIGN() and wxDECLARE_NO_ASSIGN_CLASS()
respectively to ensure that we declare a (default, if possible) copy
ctor in the classes declaring an assignment operator to avoid clang
warnings about not doing it.
This commit is contained in:
Vadim Zeitlin 2021-12-15 02:13:43 +01:00
parent e2d13c2d94
commit 6f8bc1018b
27 changed files with 77 additions and 43 deletions

View file

@ -3160,8 +3160,14 @@ typedef const void* WXWidget;
#if defined(__cplusplus) && (__cplusplus >= 201103L || wxCHECK_VISUALC_VERSION(14))
#define wxMEMBER_DELETE = delete
#define wxDECLARE_DEFAULT_COPY_CTOR(classname) \
public: \
classname(const classname&) = default;
#else
#define wxMEMBER_DELETE
// We can't do this without C++11 "= default".
#define wxDECLARE_DEFAULT_COPY_CTOR(classname)
#endif
#define wxDECLARE_NO_COPY_CLASS(classname) \
@ -3183,6 +3189,11 @@ typedef const void* WXWidget;
private: \
classname& operator=(const classname&) wxMEMBER_DELETE
#define wxDECLARE_NO_ASSIGN_DEF_COPY(classname) \
wxDECLARE_DEFAULT_COPY_CTOR(classname) \
private: \
classname& operator=(const classname&) wxMEMBER_DELETE
/* deprecated variants _not_ requiring a semicolon after them */
#define DECLARE_NO_COPY_CLASS(classname) \
wxDECLARE_NO_COPY_CLASS(classname);