2004-09-16 Matthias Clasen <mclasen@redhat.com>
+ Implement the same PLT reduction technique used in GTK+:
+
+ * Makefile.am: Generate gobjectalias.h from gobject.symbols.
+ (BUILT_SOURCES): Add gobjectalias.h.
+
+ * makegobjectalias.pl: Script to generate gobjectalias.h.
+
+ * *.c: Include gobjectalias.h
+
+2004-09-16 Matthias Clasen <mclasen@redhat.com>
+
Add ABI control using the same technique that is used in GTK+.
* gobject.symbols: Master list of symbols.
* gobject.def: Removed. It is now generated from gobject.symbols.
- * Makefile.am (gobject.def): Generate from gobject.symbols.
+ * Makefile.am: Generate gobject.def from gobject.symbols.
(TESTS): Add abicheck.sh
(EXTRA_DIST): Add abicheck.sh
(export_symbols): Don't export _-prefixed symbols.
gobject.def: gobject.symbols
(echo -e EXPORTS; cpp -P -DINCLUDE_VARIABLES -DINCLUDE_INTERNAL_SYMBOLS -DG_OS_WIN32 $(srcdir)/gobject.symbols | sed -e '/^$$/d' -e 's/^/\t/' | sort) > gobject.def
+gobjectalias.h: gobject.symbols
+ ./makegobjectalias.pl < $(srcdir)/gobject.symbols > gobjectalias.h
+
if OS_UNIX
TESTS = abicheck.sh
endif
gvaluetypes.c
# these sources (also mentioned above) are generated.
-BUILT_SOURCES = gmarshal.h gmarshal.c
+BUILT_SOURCES = gmarshal.h gmarshal.c gobjectalias.h
# non-header sources (headers should be specified in the above variables)
# that don't serve as direct make target sources, i.e. they don't have
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
+#include "gobjectalias.h"
#include "gboxed.h"
#include "gbsearcharray.h"
}
void
-g_boxed_type_init (void) /* sync with gtype.c */
+g_boxed_type_init (void)
{
static const GTypeInfo info = {
0, /* class_size */
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
-
+#include "gobjectalias.h"
#include "gclosure.h"
#include "gvalue.h"
#include <string.h>
+#include "gobjectalias.h"
#include "genums.h"
#include "gvalue.h"
GTypeCValue *collect_values,
guint collect_flags);
-
/* --- functions --- */
void
-g_enum_types_init (void) /* sync with gtype.c */
+g_enum_types_init (void)
{
static gboolean initialized = FALSE;
static const GTypeValueTable flags_enum_value_table = {
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
+#include "gobjectalias.h"
#include "gobject.h"
/*
#endif /* G_ENABLE_DEBUG */
void
-g_object_type_init (void) /* sync with gtype.c */
+g_object_type_init (void)
{
static gboolean initialized = FALSE;
static const GTypeFundamentalInfo finfo = {
* MT safe
*/
+#include "gobjectalias.h"
#include "gparam.h"
#include "gparamspecs.h"
/* --- functions --- */
void
-g_param_type_init (void) /* sync with gtype.c */
+g_param_type_init (void)
{
static const GTypeFundamentalInfo finfo = {
(G_TYPE_FLAG_CLASSED |
#include "../config.h"
+#include "gobjectalias.h"
#include "gparamspecs.h"
#include "gvaluecollector.h"
GType *g_param_spec_types = NULL;
void
-g_param_spec_types_init (void) /* sync with gtype.c */
+g_param_spec_types_init (void)
{
const guint n_types = 21;
GType type, *spec_types, *spec_types_bound;
#include <config.h>
+#include "gobjectalias.h"
#include "gsignal.h"
#include "gbsearcharray.h"
#include "gvaluecollector.h"
}
void
-g_signal_init (void) /* sync with gtype.c */
+g_signal_init (void)
{
SIGNAL_LOCK ();
if (!g_n_signal_nodes)
* Boston, MA 02111-1307, USA.
*/
+#include "gobjectalias.h"
#include "gsourceclosure.h"
#include "gboxed.h"
#include "genums.h"
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
+#include "gobjectalias.h"
#include "gtype.h"
/*
#include <stdlib.h>
+#include "gobjectalias.h"
#include "gtypeplugin.h"
#include "gtypemodule.h"
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
+#include "gobjectalias.h"
#include "gtypeplugin.h"
#include <string.h>
+#include "gobjectalias.h"
#include "gvalue.h"
#include "gvaluecollector.h"
#include "gbsearcharray.h"
/* --- functions --- */
void
-g_value_c_init (void) /* sync with gtype.c */
+g_value_c_init (void)
{
transform_array = g_bsearch_array_create (&transform_bconfig);
}
#include <config.h>
+#include "gobjectalias.h"
#include "gvaluearray.h"
#include <string.h>
#include <stdlib.h> /* qsort() */
*/
#include <string.h>
+#include "gobjectalias.h"
#include "gvalue.h"
#include "genums.h"
/* registration
*/
void
-g_value_transforms_init (void) /* sync with gtype.c */
+g_value_transforms_init (void)
{
/* some transformations are a bit questionable,
* we currently skip those
* MT safe
*/
+#include "gobjectalias.h"
#include "gvaluetypes.h"
#include "gvaluecollector.h"
/* --- type initialization --- */
void
-g_value_types_init (void) /* sync with gtype.c */
+g_value_types_init (void)
{
GTypeInfo info = {
0, /* class_size */
--- /dev/null
+#!/usr/bin/perl -w
+
+print <<EOF;
+/* Generated by makegobjectalias.pl */
+
+#ifndef DISABLE_VISIBILITY
+
+#include "glibconfig.h"
+
+#ifdef G_HAVE_GNUC_VISIBILITY
+
+#ifdef G_DISABLE_DEPRECATED
+#define WAS_NO_G_DEPR
+#endif
+#undef G_DISABLE_DEPRECATED
+
+#include "glib-object.h"
+
+EOF
+
+my $in_comment = 0;
+my $in_skipped_section = 0;
+
+while (<>) {
+
+ # ignore empty lines
+ next if /^\s*$/;
+
+ # skip comments
+ if ($_ =~ /^\s*\/\*/)
+ {
+ $in_comment = 1;
+ }
+
+ if ($in_comment)
+ {
+ if ($_ =~ /\*\/\s$/)
+ {
+ $in_comment = 0;
+ }
+
+ next;
+ }
+
+ # handle ifdefs
+ if ($_ =~ /^\#endif/)
+ {
+ if (!$in_skipped_section)
+ {
+ print $_;
+ }
+
+ $in_skipped_section = 0;
+
+ next;
+ }
+
+ if ($_ =~ /^\#ifdef\s+(INCLUDE_VARIABLES|INCLUDE_INTERNAL_SYMBOLS)/)
+ {
+ $in_skipped_section = 1;
+ }
+
+ if ($in_skipped_section)
+ {
+ next;
+ }
+
+ if ($_ =~ /^\#ifdef\s+G/)
+ {
+ print $_;
+
+ next;
+ }
+
+
+ my $str = $_;
+ chomp($str);
+ my $alias = "IA__".$str;
+
+ print <<EOF
+extern __typeof ($str) $alias __attribute((visibility("hidden")));
+extern __typeof ($str) $str __attribute((alias("$alias"), visibility("default")));
+\#define $str $alias
+
+EOF
+}
+
+print <<EOF;
+
+#ifdef WAS_NO_G_DEPR
+#define G_DISABLE_DEPRECATED
+#undef WAS_NO_G_DEPR
+#endif
+
+#endif /* G_HAVE_GNUC_VISIBILITY */
+
+#endif /* DISABLE_VISIBILITY */
+EOF
+
+