Implement the same PLT reduction technique used in GTK+:

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
This commit is contained in:
Matthias Clasen 2004-09-16 18:52:40 +00:00 committed by Matthias Clasen
parent 88e7569e65
commit 465c7d1ead
18 changed files with 140 additions and 13 deletions

View File

@ -1,3 +1,14 @@
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+.
@ -6,7 +17,7 @@
* 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.

View File

@ -16,6 +16,9 @@ INCLUDES = \
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
@ -112,7 +115,7 @@ gobject_c_sources = \
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

View File

@ -16,6 +16,7 @@
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gobjectalias.h"
#include "gboxed.h"
#include "gbsearcharray.h"
@ -108,7 +109,7 @@ gstring_free (gpointer boxed)
}
void
g_boxed_type_init (void) /* sync with gtype.c */
g_boxed_type_init (void)
{
static const GTypeInfo info = {
0, /* class_size */

View File

@ -16,7 +16,7 @@
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gobjectalias.h"
#include "gclosure.h"
#include "gvalue.h"

View File

@ -23,6 +23,7 @@
#include <string.h>
#include "gobjectalias.h"
#include "genums.h"
#include "gvalue.h"
@ -46,10 +47,9 @@ static gchar* value_flags_enum_lcopy_value (const GValue *value,
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 = {

View File

@ -16,6 +16,7 @@
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gobjectalias.h"
#include "gobject.h"
/*
@ -144,7 +145,7 @@ debug_objects_atexit (void)
#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 = {

View File

@ -21,6 +21,7 @@
* MT safe
*/
#include "gobjectalias.h"
#include "gparam.h"
#include "gparamspecs.h"
@ -68,7 +69,7 @@ G_LOCK_DEFINE_STATIC (pspec_ref_count);
/* --- functions --- */
void
g_param_type_init (void) /* sync with gtype.c */
g_param_type_init (void)
{
static const GTypeFundamentalInfo finfo = {
(G_TYPE_FLAG_CLASSED |

View File

@ -23,6 +23,7 @@
#include "../config.h"
#include "gobjectalias.h"
#include "gparamspecs.h"
#include "gvaluecollector.h"
@ -1019,7 +1020,7 @@ param_override_values_cmp (GParamSpec *pspec,
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;

View File

@ -26,6 +26,7 @@
#include <config.h>
#include "gobjectalias.h"
#include "gsignal.h"
#include "gbsearcharray.h"
#include "gvaluecollector.h"
@ -709,7 +710,7 @@ signal_key_cmp (gconstpointer node1,
}
void
g_signal_init (void) /* sync with gtype.c */
g_signal_init (void)
{
SIGNAL_LOCK ();
if (!g_n_signal_nodes)

View File

@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
#include "gobjectalias.h"
#include "gsourceclosure.h"
#include "gboxed.h"
#include "genums.h"

View File

@ -17,6 +17,7 @@
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include "gobjectalias.h"
#include "gtype.h"
/*

View File

@ -19,6 +19,7 @@
#include <stdlib.h>
#include "gobjectalias.h"
#include "gtypeplugin.h"
#include "gtypemodule.h"

View File

@ -16,6 +16,7 @@
* Free Software Foundation, Inc., 59 Temple Place, Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "gobjectalias.h"
#include "gtypeplugin.h"

View File

@ -23,6 +23,7 @@
#include <string.h>
#include "gobjectalias.h"
#include "gvalue.h"
#include "gvaluecollector.h"
#include "gbsearcharray.h"
@ -52,7 +53,7 @@ static GBSearchConfig transform_bconfig = {
/* --- functions --- */
void
g_value_c_init (void) /* sync with gtype.c */
g_value_c_init (void)
{
transform_array = g_bsearch_array_create (&transform_bconfig);
}

View File

@ -23,6 +23,7 @@
#include <config.h>
#include "gobjectalias.h"
#include "gvaluearray.h"
#include <string.h>
#include <stdlib.h> /* qsort() */

View File

@ -18,6 +18,7 @@
*/
#include <string.h>
#include "gobjectalias.h"
#include "gvalue.h"
#include "genums.h"
@ -242,7 +243,7 @@ value_transform_flags_string (const GValue *src_value,
/* 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

View File

@ -21,6 +21,7 @@
* MT safe
*/
#include "gobjectalias.h"
#include "gvaluetypes.h"
#include "gvaluecollector.h"
@ -357,7 +358,7 @@ value_lcopy_pointer (const GValue *value,
/* --- type initialization --- */
void
g_value_types_init (void) /* sync with gtype.c */
g_value_types_init (void)
{
GTypeInfo info = {
0, /* class_size */

100
gobject/makegobjectalias.pl Executable file
View File

@ -0,0 +1,100 @@
#!/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