From fa77097d794e2979f60eadf94c2ed101f6455f79 Mon Sep 17 00:00:00 2001 From: Marcin Kolny Date: Fri, 1 Apr 2016 22:07:03 +0200 Subject: gmmproc: _CLASS_GOBJECT(): allow provide custom move operations. If class contains movable fields, custom move constructor and move assignment operator should be provided. Use macro _CUSTOM_MOVE_OPERATIONS for NOT generating default move operations. https://bugzilla.gnome.org/show_bug.cgi?id=756593 --- tools/m4/class_gobject.m4 | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tools/m4/class_gobject.m4 b/tools/m4/class_gobject.m4 index dd9c1732..015eb287 100644 --- a/tools/m4/class_gobject.m4 +++ b/tools/m4/class_gobject.m4 @@ -32,6 +32,14 @@ define(`__BOOL_CUSTOM_DTOR__',`$1') _POP() ') +dnl For classes that need custom code for move operations. +define(`_CUSTOM_MOVE_OPERATIONS', `dnl +_PUSH() +dnl Define this macro to be tested for later. +define(`__BOOL_CUSTOM_MOVE_OPERATIONS__',`$1') +_POP() +') + dnl For classes that need custom code in their cast and construct_params dnl constructor. define(`_CUSTOM_CTOR_CAST',`dnl @@ -211,6 +219,8 @@ __CPPNAME__::__CPPNAME__`'(__CNAME__* castitem) ')dnl +ifdef(`__BOOL_CUSTOM_MOVE_OPERATIONS__',`dnl +',`dnl __CPPNAME__::__CPPNAME__`'(__CPPNAME__&& src) noexcept : __CPPPARENT__`'(std::move(src)) _IMPORT(SECTION_CC_MOVE_CONSTRUCTOR_INTERFACES) @@ -223,6 +233,8 @@ _IMPORT(SECTION_CC_MOVE_ASSIGNMENT_OPERATOR_INTERFACES) return *this; } +')dnl + ifdef(`__BOOL_CUSTOM_DTOR__',`dnl ',`dnl __CPPNAME__::~__CPPNAME__`'() noexcept @@ -272,8 +284,11 @@ protected: public: +ifdef(`__BOOL_CUSTOM_MOVE_OPERATIONS__',`dnl +',`dnl __CPPNAME__`'(__CPPNAME__&& src) noexcept; __CPPNAME__& operator=(__CPPNAME__&& src) noexcept; +')dnl _IMPORT(SECTION_DTOR_DOCUMENTATION) ~__CPPNAME__`'() noexcept override; -- cgit v1.2.1