summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorKjell Ahlstedt <kjellahlstedt@gmail.com>2020-11-18 14:43:11 +0100
committerKjell Ahlstedt <kjellahlstedt@gmail.com>2020-11-18 14:44:33 +0100
commitbd0dc47262262901d131f78570f8f5fc47c6859c (patch)
treeaf24e02bc97edea51bf8e87a422eae52f09f6ed7 /tools
parent3f9bbd905d10dec534023bb398a0c8bb103672de (diff)
downloadglibmm-bd0dc47262262901d131f78570f8f5fc47c6859c.tar.gz
generate_wrap_init.pl.in: Use g_type_ensure()
Call g_type_ensure(SomeClass::get_type()). Redefining the G_GNUC_CONST preprocessor macro does not have the intended effect (SomeClass::get_type() actually being called) if the package is compiled and linked with the -flto option. LTO = link time optimization https://mail.gnome.org/archives/gtkmm-list/2020-November/msg00009.html
Diffstat (limited to 'tools')
-rw-r--r--tools/generate_wrap_init.pl.in8
1 files changed, 1 insertions, 7 deletions
diff --git a/tools/generate_wrap_init.pl.in b/tools/generate_wrap_init.pl.in
index 6e4dcf3c..50e08275 100644
--- a/tools/generate_wrap_init.pl.in
+++ b/tools/generate_wrap_init.pl.in
@@ -207,12 +207,6 @@ print << "EOF";
#define GLIBMM_INCLUDED_FROM_WRAP_INIT_CC
#include <glibmm.h>
-
-// Disable the 'const' function attribute of the get_type() functions.
-// GCC would optimize them out because we don't use the return value.
-#undef G_GNUC_CONST
-#define G_GNUC_CONST /* empty */
-
#include <${parent_dir}/wrap_init.h>
#include <glibmm/error.h>
#include <glibmm/object.h>
@@ -437,7 +431,7 @@ foreach my $filename_header (sort keys %objects)
{
my ($cppname, $basename, @extra_namespace) = @{$i};
my $qualified_cppname = join("::", (@extra_namespace, $cppname));
- $message .= " ${qualified_cppname}::get_type();\n"
+ $message .= " g_type_ensure(${qualified_cppname}::get_type());\n"
}
print_with_guards($filename_header, $message);
}