[glibmm] C++11: gmmproc: Use of auto in generated files.



commit a776f52044af21d85a6aecd13f8496c7ce670e83
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Jul 15 13:01:54 2015 +0200

    C++11: gmmproc: Use of auto in generated files.

 glib/src/signalproxy.h.m4           |    2 +-
 glib/src/variant_basictypes.cc.m4   |    4 ++--
 tools/m4/class_interface.m4         |    2 +-
 tools/m4/class_opaque_copyable.m4   |    2 +-
 tools/m4/class_opaque_refcounted.m4 |    2 +-
 tools/m4/class_shared.m4            |    2 +-
 tools/m4/method.m4                  |   16 ++++++++--------
 tools/m4/signal.m4                  |   16 ++++++++--------
 tools/m4/vfunc.m4                   |   16 ++++++++--------
 9 files changed, 31 insertions(+), 31 deletions(-)
---
diff --git a/glib/src/signalproxy.h.m4 b/glib/src/signalproxy.h.m4
index a95d597..2f275f9 100644
--- a/glib/src/signalproxy.h.m4
+++ b/glib/src/signalproxy.h.m4
@@ -58,7 +58,7 @@ public:
 #ifndef DOXYGEN_SHOULD_SKIP_THIS
   static inline sigc::slot_base* data_to_slot(void* data)
   {
-    SignalProxyConnectionNode *const pConnectionNode = static_cast<SignalProxyConnectionNode*>(data);
+    const auto pConnectionNode = static_cast<SignalProxyConnectionNode*>(data);
 
     // Return 0 if the connection is blocked.
     return (!pConnectionNode->slot_.blocked()) ? &pConnectionNode->slot_ : 0;
diff --git a/glib/src/variant_basictypes.cc.m4 b/glib/src/variant_basictypes.cc.m4
index 92e50a3..4247da8 100644
--- a/glib/src/variant_basictypes.cc.m4
+++ b/glib/src/variant_basictypes.cc.m4
@@ -47,13 +47,13 @@ const VariantType& Variant<$1>::variant_type()
 
 Variant<$1> Variant<$1>::create($1 data)
 {
-  Variant<$1> result = Variant<$1>(g_variant_new_$3(data));
+  auto result = Variant<$1>(g_variant_new_$3(data));
   return result;
 }
 ifelse($4,,,[
 Variant<$1> Variant<$1>::create_$4($1 data)
 {
-  Variant<$1> result = Variant<$1>(g_variant_new_$4(data));
+  auto result = Variant<$1>(g_variant_new_$4(data));
   return result;
 }
 ])dnl
diff --git a/tools/m4/class_interface.m4 b/tools/m4/class_interface.m4
index fb6d387..8d25e6a 100644
--- a/tools/m4/class_interface.m4
+++ b/tools/m4/class_interface.m4
@@ -92,7 +92,7 @@ const Glib::Interface_Class& __CPPNAME__`'_Class::init()
 
 void __CPPNAME__`'_Class::iface_init_function(void* g_iface, void*)
 {
-  BaseClassType *const klass = static_cast<BaseClassType*>(g_iface);
+  const auto klass = static_cast<BaseClassType*>(g_iface);
 
   //This is just to avoid an "unused variable" warning when there are no vfuncs or signal handlers to 
connect.
   //This is a temporary fix until I find out why I can not seem to derive a GtkFileChooser interface. murrayc
diff --git a/tools/m4/class_opaque_copyable.m4 b/tools/m4/class_opaque_copyable.m4
index 9e53649..b98502f 100644
--- a/tools/m4/class_opaque_copyable.m4
+++ b/tools/m4/class_opaque_copyable.m4
@@ -122,7 +122,7 @@ ifelse(__OPAQUE_FUNC_COPY,NONE,`dnl
 ',`dnl else
 __CPPNAME__& __CPPNAME__::operator=(const __CPPNAME__`'& src)
 {
-  __CNAME__ *const new_gobject = (src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : 0;
+  const auto new_gobject = (src.gobject_) ? __OPAQUE_FUNC_COPY`'(src.gobject_) : 0;
 
   if(gobject_)
     __OPAQUE_FUNC_FREE`'(gobject_);
diff --git a/tools/m4/class_opaque_refcounted.m4 b/tools/m4/class_opaque_refcounted.m4
index c9242ba..cec87fa 100644
--- a/tools/m4/class_opaque_refcounted.m4
+++ b/tools/m4/class_opaque_refcounted.m4
@@ -116,7 +116,7 @@ const __CNAME__* __CPPNAME__::gobj() const
 __CNAME__* __CPPNAME__::gobj_copy() const
 {
   // See the comment at the top of this file, if you want to know why the cast works.
-  __CNAME__ *const gobject = reinterpret_cast<__CNAME__*>(const_cast<__CPPNAME__*>(this));
+  const auto gobject = reinterpret_cast<__CNAME__*>(const_cast<__CPPNAME__*>(this));
   __OPAQUE_FUNC_REF`'(gobject);
   return gobject;
 }
diff --git a/tools/m4/class_shared.m4 b/tools/m4/class_shared.m4
index 4175b57..3442ad1 100644
--- a/tools/m4/class_shared.m4
+++ b/tools/m4/class_shared.m4
@@ -190,7 +190,7 @@ ifdef(`__BOOL_DO_NOT_DERIVE_GTYPE__',`dnl
 
 void __CPPNAME__`'_Class::class_init_function(void* g_class, void* class_data)
 {
-  BaseClassType *const klass = static_cast<BaseClassType*>(g_class);
+  const auto klass = static_cast<BaseClassType*>(g_class);
   CppClassParent::class_init_function(klass, class_data);
 
 _IMPORT(SECTION_PCC_CLASS_INIT_VFUNCS)
diff --git a/tools/m4/method.m4 b/tools/m4/method.m4
index 7becc7c..fe4075d 100644
--- a/tools/m4/method.m4
+++ b/tools/m4/method.m4
@@ -28,10 +28,10 @@ dnl If a slot type has been specified insert a slot copy declaration.
 dnl See if the slot should or should not be copied
 `ifelse(`$20',,dnl
 `  // Create a copy of the slot.
-  $18* slot_copy = new $18($19); ',dnl
+  auto slot_copy = new $18($19); ',dnl
 dnl
 `  // Use the original slot (not a copy).
-  $18* slot_copy = const_cast<$18*>(&$19);')
+  auto slot_copy = const_cast<$18*>(&$19);')
 
 ')`'dnl
 dnl Insert the declarations for C output parameters
@@ -68,10 +68,10 @@ ifelse(`$18',,,dnl
 dnl See if the slot should or should not be copied
 `ifelse(`$20',,dnl
 `  // Create a copy of the slot.
-  $18* slot_copy = new $18($19); ',dnl
+  auto slot_copy = new $18($19); ',dnl
 dnl
 `  // Use the original slot (not a copy).
-  $18* slot_copy = const_cast<$18*>(&$19);')
+  auto slot_copy = const_cast<$18*>(&$19);')
 
 ')`'dnl
 dnl Insert the declarations for C output parameters
@@ -130,10 +130,10 @@ ifelse(`$15',,,dnl
 dnl See if the slot should or should not be copied
 `ifelse(`$17',,dnl
 `  // Create a copy of the slot.
-  $15* slot_copy = new $15($16); ',dnl
+  auto slot_copy = new $15($16); ',dnl
 dnl
 `  // Use the original slot (not a copy).
-  $15* slot_copy = const_cast<$15*>(&$16);')
+  auto slot_copy = const_cast<$15*>(&$16);')
 
 ')`'dnl
 dnl Insert declarations for C the output parameters
@@ -161,10 +161,10 @@ ifelse(`$15',,,dnl
 dnl See if the slot should or should not be copied
 `ifelse(`$17',,dnl
 `  // Create a copy of the slot.
-  $15* slot_copy = new $15($16); ',dnl
+  auto slot_copy = new $15($16); ',dnl
 dnl
 `  // Use the original slot (not a copy).
-  $15* slot_copy = const_cast<$15*>(&$16);')
+  auto slot_copy = const_cast<$15*>(&$16);')
 
 ')`'dnl
 dnl Insert the declarations for the C output parameters
diff --git a/tools/m4/signal.m4 b/tools/m4/signal.m4
index cb8cdf0..cc0473c 100644
--- a/tools/m4/signal.m4
+++ b/tools/m4/signal.m4
@@ -67,13 +67,13 @@ static $2 __CPPNAME__`'_signal_$4_callback`'(__CNAME__`'* self, _COMMA_SUFFIX($3
   using namespace __NAMESPACE__;
   typedef sigc::slot< $5`'_COMMA_PREFIX($6) > SlotType;
 
-  __CPPNAME__* obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
+  auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
   // Do not try to call a signal on a disassociated wrapper.
   if(obj)
   {
     try
     {
-      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot`'(data))
+      if(const auto slot = Glib::SignalProxyNormal::data_to_slot`'(data))
 ifelse(`$2',void,`dnl
         (*static_cast<SlotType*>(slot))($7);
 ',`dnl else
@@ -109,13 +109,13 @@ static $2 __CPPNAME__`'_signal_$4_notify_callback`'(__CNAME__`'* self, _COMMA_SU
   using namespace __NAMESPACE__;
   typedef sigc::slot< void`'_COMMA_PREFIX($6) > SlotType;
 
-  __CPPNAME__* obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
+  auto obj = dynamic_cast<__CPPNAME__*>(Glib::ObjectBase::_get_current_wrapper((GObject*) self));
   // Do not try to call a signal on a disassociated wrapper.
   if(obj)
   {
     try
     {
-      if(sigc::slot_base *const slot = Glib::SignalProxyNormal::data_to_slot`'(data))
+      if(const auto slot = Glib::SignalProxyNormal::data_to_slot`'(data))
         (*static_cast<SlotType*>(slot))($7);
     }
     catch(...)
@@ -235,7 +235,7 @@ $4 __CPPNAME__`'_Class::$2_callback`'($5)
 dnl  First, do a simple cast to ObjectBase. We will have to do a dynamic_cast
 dnl  eventually, but it is not necessary to check whether we need to call
 dnl  the vfunc.
-  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+  const auto obj_base = static_cast<Glib::ObjectBase*>(
       Glib::ObjectBase::_get_current_wrapper`'((GObject*)$8));
 
 _IMPORT(SECTION_CHECK)
@@ -248,7 +248,7 @@ _IMPORT(SECTION_CHECK)
   {
 dnl  We need to do a dynamic cast to get the real object type, to call the
 dnl  C++ vfunc on it.
-    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
     if(obj) // This can be NULL during destruction.
     {
       try // Trap C++ exceptions which would normally be lost because this is a C callback.
@@ -279,7 +279,7 @@ ifelse($11, `', `dnl
     }
   }
 
-  BaseClassType *const base = static_cast<BaseClassType*>(
+  const auto base = static_cast<BaseClassType*>(
 ifdef(`__BOOL_IS_INTERFACE__',`dnl
         _IFACE_PARENT_FROM_OBJECT($8)dnl
 ',`dnl
@@ -325,7 +325,7 @@ ifelse(`$9',,,`#ifdef $9'
 )dnl
 $3 __NAMESPACE__::__CPPNAME__::on_$1`'($5)
 {
-  BaseClassType *const base = static_cast<BaseClassType*>(
+  const auto base = static_cast<BaseClassType*>(
 ifdef(`__BOOL_IS_INTERFACE__',`dnl
       _IFACE_PARENT_FROM_OBJECT(gobject_)dnl
 ',`dnl
diff --git a/tools/m4/vfunc.m4 b/tools/m4/vfunc.m4
index 8cbf908..6ed4989 100644
--- a/tools/m4/vfunc.m4
+++ b/tools/m4/vfunc.m4
@@ -37,13 +37,13 @@ ifelse(`$11',,,`#ifdef $11'
 $4 __CPPNAME__`'_Class::$2_vfunc_callback`'($5)
 {
 ifelse(`$14',,,dnl
-`  const $13* slot = static_cast<$13*>($14);
+`  const auto slot = static_cast<$13*>($14);
 
 ')dnl
 dnl  First, do a simple cast to ObjectBase. We will have to do a dynamic_cast
 dnl  eventually, but it is not necessary to check whether we need to call
 dnl  the vfunc.
-  Glib::ObjectBase *const obj_base = static_cast<Glib::ObjectBase*>(
+  const auto obj_base = static_cast<Glib::ObjectBase*>(
       Glib::ObjectBase::_get_current_wrapper`'((GObject*)$8));
 
 _IMPORT(SECTION_CHECK)
@@ -56,7 +56,7 @@ _IMPORT(SECTION_CHECK)
   {
 dnl  We need to do a dynamic cast to get the real object type, to call the
 dnl  C++ vfunc on it.
-    CppObjectType *const obj = dynamic_cast<CppObjectType* const>(obj_base);
+    const auto obj = dynamic_cast<CppObjectType* const>(obj_base);
     if(obj) // This can be NULL during destruction.
     {
       try // Trap C++ exceptions which would normally be lost because this is a C callback.
@@ -70,9 +70,9 @@ ifelse($9,refreturn_ctype,`dnl Assume Glib::unwrap_copy() is correct if refretur
         return Glib::unwrap_copy`'(`obj->$1'($7));
 ',`dnl not refreturn_ctype
 ifelse($10,keep_return,`dnl
-        static GQuark quark_return_value = g_quark_from_static_string("__NAMESPACE__::__CPPNAME__::$1");
+        static auto quark_return_value = g_quark_from_static_string("__NAMESPACE__::__CPPNAME__::$1");
 
-        $3* return_value = static_cast<$3*>(g_object_get_qdata(obj_base->gobj(), quark_return_value));
+        auto return_value = static_cast<$3*>(g_object_get_qdata(obj_base->gobj(), quark_return_value));
         if (!return_value)
         {
           return_value = new $3`'();
@@ -158,13 +158,13 @@ ifelse(`$11',,,dnl
 dnl See if the slot should or should not be copied
 `ifelse(`$13',,dnl
 `  // Create a copy of the slot.
-  $11* slot_copy = new $11($12); ',dnl
+  auto slot_copy = new $11($12); ',dnl
 dnl
 `  // Use the original slot (not a copy).
-  $11* slot_copy = const_cast<$11*>(&$12);')
+  auto slot_copy = const_cast<$11*>(&$12);')
 
 ')dnl
-  BaseClassType *const base = static_cast<BaseClassType*>(
+  const auto base = static_cast<BaseClassType*>(
 ifdef(`__BOOL_IS_INTERFACE__',`dnl
       _IFACE_PARENT_FROM_OBJECT(gobject_)dnl
 ',`dnl


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]