summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMurray Cumming <murrayc@murrayc.com>2004-03-13 15:20:19 +0000
committerMurray Cumming <murrayc@src.gnome.org>2004-03-13 15:20:19 +0000
commitff0ee882c28a0be099f66443e4126d898a4c9ce0 (patch)
tree4401400ee506833bc0c107edcf16d8470fde365b
parente7e645e82073587e87d2d5b0ed22ea508ae403d5 (diff)
downloadglibmm-ff0ee882c28a0be099f66443e4126d898a4c9ce0.tar.gz
Remove the parent get_type() call from the Class::init() function, because
2004-03-13 Murray Cumming <murrayc@murrayc.com> * tools/m4/class_shared.m4: Remove the parent get_type() call from the Class::init() function, because it is optimised away, and g++ 3.4 actually complains that it does nothing. * glib/glibmm/object.[h|cc]: Add a public ConstructParams copy constructor, needed by g++ 3.4. See comments in the code. * tests/glibmm_value/glibmm_value.cc: Instantiate instances of value types, to fix the g++ 3.4 build. I don't know what the code was meant to do before anyway.
-rw-r--r--ChangeLog11
-rw-r--r--glib/glibmm/object.cc10
-rw-r--r--glib/glibmm/object.h11
-rw-r--r--tests/glibmm_value/glibmm_value.cc28
-rw-r--r--tools/m4/class_shared.m45
5 files changed, 48 insertions, 17 deletions
diff --git a/ChangeLog b/ChangeLog
index df248882..d7dc2418 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2004-03-13 Murray Cumming <murrayc@murrayc.com>
+
+ * tools/m4/class_shared.m4: Remove the parent get_type() call from
+ the Class::init() function, because it is optimised away, and g++ 3.4
+ actually complains that it does nothing.
+ * glib/glibmm/object.[h|cc]: Add a public ConstructParams copy
+ constructor, needed by g++ 3.4. See comments in the code.
+ * tests/glibmm_value/glibmm_value.cc: Instantiate instances of
+ value types, to fix the g++ 3.4 build. I don't know what the code
+ was meant to do before anyway.
+
2004-03-11 Murray Cumming <murrayc@murrayc.com>
* scripts/: Added sun.m4, copied from libsigc++-1.2/scripts and
diff --git a/glib/glibmm/object.cc b/glib/glibmm/object.cc
index 7155942d..bc008362 100644
--- a/glib/glibmm/object.cc
+++ b/glib/glibmm/object.cc
@@ -129,6 +129,16 @@ ConstructParams::ConstructParams(const Glib::Class& glibmm_class_,
va_end(var_args);
}
+ConstructParams::ConstructParams(const ConstructParams& src)
+: glibmm_class(src.glibmm_class),
+ n_parameters(src.n_parameters),
+ parameters(src.parameters)
+{
+ //This is only used by the C++ compiler (since g++ 3.4) to create temporary instances.
+ //Apparently the compiler will actually optimize away the use of this.
+ //See bug #132300.
+}
+
ConstructParams::~ConstructParams()
{
while(n_parameters > 0)
diff --git a/glib/glibmm/object.h b/glib/glibmm/object.h
index a67b387e..d5027732 100644
--- a/glib/glibmm/object.h
+++ b/glib/glibmm/object.h
@@ -59,8 +59,9 @@ class GSigConnectionNode;
* The comments in object.cc and objectbase.cc should explain in detail
* how this works.
*/
-struct ConstructParams
+class ConstructParams
{
+public:
const Glib::Class& glibmm_class;
unsigned int n_parameters;
GParameter* parameters;
@@ -69,9 +70,13 @@ struct ConstructParams
ConstructParams(const Glib::Class& glibmm_class_, const char* first_property_name, ...);
~ConstructParams();
+ //This is only used by the C++ compiler (since g++ 3.4) to create temporary instances.
+ //Apparently the compiler will actually optimize away the use of this.
+ //See bug #132300.
+ ConstructParams(const ConstructParams& src);
+
private:
- // noncopyable
- ConstructParams(const ConstructParams&);
+ // noncopyable
ConstructParams& operator=(const ConstructParams&);
};
diff --git a/tests/glibmm_value/glibmm_value.cc b/tests/glibmm_value/glibmm_value.cc
index 3bdf58c0..b8f4e781 100644
--- a/tests/glibmm_value/glibmm_value.cc
+++ b/tests/glibmm_value/glibmm_value.cc
@@ -3,23 +3,29 @@
//#include <gdkmm.h>
//#include <gtkmm.h>
-struct Foo { int bar; };
-
-// custom copyable
-template Glib::Value<Foo>;
-
-// custom pointer
-template Glib::Value<Foo*>;
-template Glib::Value<const Foo*>;
+struct Foo
+{
+ int bar;
+};
-// Glib::Object pointer
namespace Gtk
{
class Widget;
}
-template Glib::Value<Gtk::Widget*>;
-template Glib::Value<const Gtk::Widget*>;
+void some_method()
+{
+// custom copyable
+ Glib::Value<Foo> value_foo;
+
+ // custom pointer
+ Glib::Value<Foo*> value_foo_pointer;
+ Glib::Value<const Foo*> value_foo_const_pointer;
+
+// Glib::Object pointer
+ Glib::Value<Gtk::Widget*> value_widget_pointer;
+ Glib::Value<const Gtk::Widget*> value_widget_const_pointer;
+}
// Glib::Object RefPtr<>
diff --git a/tools/m4/class_shared.m4 b/tools/m4/class_shared.m4
index 5707e718..1cb066a3 100644
--- a/tools/m4/class_shared.m4
+++ b/tools/m4/class_shared.m4
@@ -86,10 +86,9 @@ const Glib::Class& __CPPNAME__`'_Class::init()
// Glib::Class has to know the class init function to clone custom types.
class_init_func_ = &__CPPNAME__`'_Class::class_init_function;
- // TODO: This is currently just optimized away, apparently with no harm.
- // Is it actually necessary?
+ // This is actually just optimized away, apparently with no harm.
// Make sure that the parent type has been created.
- CppClassParent::CppObjectType::get_type();
+ //CppClassParent::CppObjectType::get_type();
// Create the wrapper type, with the same class/instance size as the base type.
register_derived_type(_LOWER(__CCAST__)_get_type());