[glibmm] Make class Glib::Threads::Private buildable with --enable-warnings=fatal.



commit 2269b8027962af18bdd7260329eda3e5427eea43
Author: Kjell Ahlstedt <kjell ahlstedt bredband net>
Date:   Thu Nov 24 10:37:08 2011 +0100

    Make class Glib::Threads::Private buildable with --enable-warnings=fatal.
    
    * glib/src/threads.hg: G_PRIVATE_INIT(destructor_func) is used only in an
    initialization.

 ChangeLog           |    7 +++++++
 glib/src/threads.hg |   12 ++++++------
 2 files changed, 13 insertions(+), 6 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 5a84056..b5a31d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-11-24  Kjell Ahlstedt  <kjell ahlstedt bredband net>
+
+	Make class Glib::Threads::Private buildable with --enable-warnings=fatal.
+
+	* glib/src/threads.hg: G_PRIVATE_INIT(destructor_func) is used only in an
+	initialization.
+
 2011-11-23  Murray Cumming  <murrayc murrayc com>
 
 	Add Glib::Threads::* in threads.h, deprecating everything in thread.h
diff --git a/glib/src/threads.hg b/glib/src/threads.hg
index 633189f..8069fb8 100644
--- a/glib/src/threads.hg
+++ b/glib/src/threads.hg
@@ -733,12 +733,12 @@ void Private<T>::delete_ptr(void* data)
 template <class T> inline
 Private<T>::Private(typename Private<T>::DestructorFunc destructor_func)
 {
-  //TODO: This causes this warning:
-  //extended initializer lists only available with -std=c++0x or -std=gnu++0x
-  //See glib bug: https://bugzilla.gnome.org/show_bug.cgi?id=664618
-  //We can work around this by building like so:
-  //./configure --prefix=/opt/gnome30 'CXXFLAGS=-std=c++0x'
-  gobject_ = G_PRIVATE_INIT(destructor_func);
+  // gobject_ = G_PRIVATE_INIT(destructor_func);
+  // does not compile with --enable-warnings=fatal.
+  // GPrivate is a struct, and G_PRIVATE_INIT is an initializer of type { ... }.
+  // G_PRIVATE_INIT can be used only in initializations.
+  const GPrivate temp = G_PRIVATE_INIT(destructor_func);
+  gobject_ = temp;
 }
 
 template <class T> inline



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