Make PLT-reduction work with gcc4, and don't include everything in

2005-03-14  Matthias Clasen  <mclasen@redhat.com>

	Make PLT-reduction work with gcc4, and don't include
	everything in gdk-pixbuf-alias.h:

	* gdk-pixbuf.symbols: Group symbols by header and source file.
	* /makegdkpixbufalias.pl: Protect definitions by the same
	preprocessor symbols used to guard the headers. Move
	the alias declarations to a separate file which is
	produced when calling makegdkpixbufalias.pl -def
	* Makefile.am (gdk-pixbuf-aliasdef.c): Add a rule to generate
	this file.
	* *.c: Include gdk-pixbuf-alias.h after the other headers,
	include gdk-pixbuf-aliasdef.c at the bottom.
This commit is contained in:
Matthias Clasen 2005-03-14 19:37:00 +00:00 committed by Matthias Clasen
parent 706ff83a7d
commit eef20f2c83
13 changed files with 236 additions and 100 deletions

View File

@ -1,3 +1,18 @@
2005-03-14 Matthias Clasen <mclasen@redhat.com>
Make PLT-reduction work with gcc4, and don't include
everything in gdk-pixbuf-alias.h:
* gdk-pixbuf.symbols: Group symbols by header and source file.
* /makegdkpixbufalias.pl: Protect definitions by the same
preprocessor symbols used to guard the headers. Move
the alias declarations to a separate file which is
produced when calling makegdkpixbufalias.pl -def
* Makefile.am (gdk-pixbuf-aliasdef.c): Add a rule to generate
this file.
* *.c: Include gdk-pixbuf-alias.h after the other headers,
include gdk-pixbuf-aliasdef.c at the bottom.
2005-03-10 Tor Lillqvist <tml@novell.com>
* gdk-pixbuf-core.h

View File

@ -47,11 +47,14 @@ uninstall-ms-lib:
endif
gdk_pixbuf.def: gdk-pixbuf.symbols
(echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DG_OS_WIN32 - <$(srcdir)/gdk-pixbuf.symbols | sed -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > gdk_pixbuf.def
(echo -e EXPORTS; $(CPP) -P -DINCLUDE_VARIABLES -DG_OS_WIN32 -DALL_FILES - <$(srcdir)/gdk-pixbuf.symbols | sed -e '/^$$/d' -e 's/^/ /' -e 's/G_GNUC_[^ ]*//g') > gdk_pixbuf.def
gdk-pixbuf-alias.h: gdk-pixbuf.symbols
$(PERL) $(srcdir)/makegdkpixbufalias.pl < $(srcdir)/gdk-pixbuf.symbols > gdk-pixbuf-alias.h
gdk-pixbuf-aliasdef.c: gdk-pixbuf.symbols
$(PERL) $(srcdir)/makegdkpixbufalias.pl -def < $(srcdir)/gdk-pixbuf.symbols > gdk-pixbuf-aliasdef.c
if OS_LINUX
TESTS = abicheck.sh
endif
@ -347,6 +350,7 @@ noinst_HEADERS = \
BUILT_SOURCES = \
gdk-pixbuf-alias.h \
gdk-pixbuf-aliasdef.c \
gdk-pixbuf-enum-types.h \
gdk-pixbuf-enum-types.c \
gdk-pixbuf-marshal.h \
@ -385,8 +389,9 @@ MAINTAINERCLEANFILES += s-enum-types-h
#
gdk-pixbuf-enum-types.c: @REBUILD@ $(gdk_pixbuf_headers) Makefile
(cd $(srcdir) && glib-mkenums \
--fhead "#include \"gdk-pixbuf-alias.h\"\n#include <gdk-pixbuf/gdk-pixbuf.h>" \
--fhead "#include <gdk-pixbuf/gdk-pixbuf.h>\n#include \"gdk-pixbuf-alias.h\"\n" \
--fprod "\n/* enumerations from \"@filename@\" */" \
--ftail "\n#define __GDK_PIXBUF_ENUM_TYPES_C__\n#include \"gdk-pixbuf-aliasdef.c\"" \
--vhead "GType\n@enum_name@_get_type (void)\n{\n static GType etype = 0;\n if (etype == 0) {\n static const G@Type@Value values[] = {" \
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
--vtail " { 0, NULL, NULL }\n };\n etype = g_@type@_register_static (\"@EnumName@\", values);\n }\n return etype;\n}\n" \
@ -411,7 +416,7 @@ MAINTAINERCLEANFILES += stamp-gdk-pixbuf-marshal.h
# gdk-pixbuf-marshal.c
#
$(srcdir)/gdk-pixbuf-marshal.c: @REBUILD@ $(srcdir)/gdk-pixbuf-marshal.list
(echo -e "#include \"gdk-pixbuf-alias.h\"" | $(GLIB_GENMARSHAL) --prefix=_gdk_pixbuf_marshal $(srcdir)/gdk-pixbuf-marshal.list --body ) >> xgen-gmc \
(echo -e "#include <gdk-pixbuf/gdk-pixbuf.h>\n#include \"gdk-pixbuf-alias.h\"" | $(GLIB_GENMARSHAL) --prefix=_gdk_pixbuf_marshal $(srcdir)/gdk-pixbuf-marshal.list --body ) >> xgen-gmc \
&& cp xgen-gmc gdk-pixbuf-marshal.c \
&& rm -f xgen-gmc xgen-gmc~

View File

@ -1,5 +1,5 @@
#! /bin/sh
cpp -P ${srcdir:-.}/gdk-pixbuf.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' -e 's/ PRIVATE$//' | sort > expected-abi
cpp -P -DALL_FILES ${srcdir:-.}/gdk-pixbuf.symbols | sed -e '/^$/d' -e 's/ G_GNUC.*$//' -e 's/ PRIVATE$//' | sort > expected-abi
nm -D .libs/libgdk_pixbuf-2.0.so | grep " T " | cut -d ' ' -f 3 | sort > actual-abi
diff -u expected-abi actual-abi && rm expected-abi actual-abi

View File

@ -24,11 +24,11 @@
#include <config.h>
#include <errno.h>
#include "gdk-pixbuf-alias.h"
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
#include "gdk-pixbuf-i18n.h"
#include "gdk-pixbuf-animation.h"
#include "gdk-pixbuf-alias.h"
#include <glib/gstdio.h>
@ -822,3 +822,5 @@ gdk_pixbuf_non_anim_iter_advance (GdkPixbufAnimationIter *iter,
return FALSE;
}
#define __GDK_PIXBUF_ANIMATION_C__
#include "gdk-pixbuf-aliasdef.c"

View File

@ -21,9 +21,9 @@
*/
#include <config.h>
#include "gdk-pixbuf-alias.h"
#include "gdk-pixbuf.h"
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-alias.h"
#include <stdlib.h>
#include <string.h>
@ -78,3 +78,6 @@ gdk_pixbuf_new_from_data (const guchar *data, GdkColorspace colorspace, gboolean
return pixbuf;
}
#define __GDK_PIXBUF_DATA_C__
#include "gdk-pixbuf-aliasdef.c"

View File

@ -33,9 +33,9 @@
#include <unistd.h>
#endif
#include "gdk-pixbuf-alias.h"
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-io.h"
#include "gdk-pixbuf-alias.h"
#include <glib/gstdio.h>
@ -906,7 +906,6 @@ gdk_pixbuf_new_from_file (const char *filename,
#ifdef G_OS_WIN32
#undef gdk_pixbuf_new_from_file
GdkPixbuf *
gdk_pixbuf_new_from_file (const char *filename,
GError **error)
@ -2212,6 +2211,9 @@ gdk_pixbuf_get_formats (void)
}
#define __GDK_PIXBUF_IO_C__
#include "gdk-pixbuf-aliasdef.c"

View File

@ -27,12 +27,12 @@
#include <config.h>
#include <string.h>
#include "gdk-pixbuf-alias.h"
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-animation.h"
#include "gdk-pixbuf-io.h"
#include "gdk-pixbuf-loader.h"
#include "gdk-pixbuf-marshal.h"
#include "gdk-pixbuf-alias.h"
enum {
SIZE_PREPARED,
@ -807,5 +807,6 @@ gdk_pixbuf_loader_get_format (GdkPixbufLoader *loader)
}
#define __GDK_PIXBUF_LOADER_C__
#include "gdk-pixbuf-aliasdef.c"

View File

@ -23,9 +23,9 @@
#include <config.h>
#include <math.h>
#include <string.h>
#include "gdk-pixbuf-alias.h"
#include "gdk-pixbuf-private.h"
#include "pixops/pixops.h"
#include "gdk-pixbuf-alias.h"
@ -455,3 +455,5 @@ gdk_pixbuf_flip (const GdkPixbuf *src,
return dest;
}
#define __GDK_PIXBUF_SCALE_C__
#include "gdk-pixbuf-aliasdef.c"

View File

@ -22,8 +22,8 @@
*/
#include <config.h>
#include "gdk-pixbuf-alias.h"
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-alias.h"
#include <string.h>
@ -244,3 +244,7 @@ gdk_pixbuf_saturate_and_pixelate(const GdkPixbuf *src,
}
}
}
#define __GDK_PIXBUF_UTIL_C__
#include "gdk-pixbuf-aliasdef.c"

View File

@ -28,9 +28,9 @@
#include <stdlib.h>
#include <string.h>
#define GDK_PIXBUF_COMPILATION
#include "gdk-pixbuf-alias.h"
#include "gdk-pixbuf.h"
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-alias.h"
static void gdk_pixbuf_class_init (GdkPixbufClass *klass);
static void gdk_pixbuf_finalize (GObject *object);
@ -793,3 +793,6 @@ gdk_pixbuf_get_property (GObject *object,
/* Include the marshallers */
#include <glib-object.h>
#include "gdk-pixbuf-marshal.c"
#define __GDK_PIXBUF_C__
#include "gdk-pixbuf-aliasdef.c"

View File

@ -1,7 +1,104 @@
gdk_colorspace_get_type G_GNUC_CONST
gdk_interp_type_get_type G_GNUC_CONST
/* This file lists all exported symbols. It is used to generate
* the gdk_pixbuf.def file used to control exports on Windows and the
* gdk-pixbuf-alias.h/gdk-pixbuf-aliasdef.c files used to avoid PLT
* entries for internal uses of exported functions (see makegdkpixbufalias.pl).
*
* Every symbol must be included in the right
* #ifdef IN_HEADER(sym) #endif and
* #ifdef IN_FILE(sym) #endif sections.
*/
#ifdef ALL_FILES
#define IN_FILE(x) 1
#define IN_HEADER(x) 1
#endif
#if IN_HEADER(GDK_PIXBUF_CORE_H)
#if IN_FILE(__GDK_PIXBUF_C__)
gdk_pixbuf_error_quark
gdk_pixbuf_get_type G_GNUC_CONST
#ifndef GDK_PIXBUF_DISABLE_DEPRECATED
gdk_pixbuf_ref
gdk_pixbuf_unref
#endif
gdk_pixbuf_new
gdk_pixbuf_get_bits_per_sample
gdk_pixbuf_get_colorspace
gdk_pixbuf_get_has_alpha
gdk_pixbuf_get_height
gdk_pixbuf_get_n_channels
gdk_pixbuf_get_pixels
gdk_pixbuf_get_rowstride
gdk_pixbuf_get_width
gdk_pixbuf_get_option
gdk_pixbuf_copy
gdk_pixbuf_new_subpixbuf
gdk_pixbuf_fill
#endif
#endif
#if IN_HEADER(GDK_PIXBUF_CORE_H)
#if IN_FILE(__GDK_PIXBUF_DATA_C__)
gdk_pixbuf_new_from_data
#endif
#endif
#if IN_HEADER(GDK_PIXBUF_CORE_H)
#if IN_FILE(__GDK_PIXBUF_IO_C__)
gdk_pixbuf_new_from_file PRIVATE
#ifdef G_OS_WIN32
gdk_pixbuf_new_from_file_utf8
#endif
gdk_pixbuf_new_from_file_at_size PRIVATE
#ifdef G_OS_WIN32
gdk_pixbuf_new_from_file_at_size_utf8
#endif
gdk_pixbuf_new_from_file_at_scale PRIVATE
#ifdef G_OS_WIN32
gdk_pixbuf_new_from_file_at_scale_utf8
#endif
gdk_pixbuf_new_from_xpm_data
gdk_pixbuf_save PRIVATE G_GNUC_NULL_TERMINATED
#ifdef G_OS_WIN32
gdk_pixbuf_save_utf8
#endif
gdk_pixbuf_save_to_buffer G_GNUC_NULL_TERMINATED
gdk_pixbuf_save_to_bufferv
gdk_pixbuf_save_to_callback G_GNUC_NULL_TERMINATED
gdk_pixbuf_save_to_callbackv
gdk_pixbuf_savev PRIVATE
#ifdef G_OS_WIN32
gdk_pixbuf_savev_utf8
#endif
#endif
#endif
#if IN_HEADER(GDK_PIXBUF_CORE_H)
#if IN_FILE(__GDK_PIXDATA_C__)
gdk_pixbuf_new_from_inline
#endif
#endif
#if IN_HEADER(GDK_PIXBUF_CORE_H)
#if IN_FILE(__GDK_PIXBUF_UTIL_C__)
gdk_pixbuf_add_alpha
gdk_pixbuf_alpha_mode_get_type G_GNUC_CONST
gdk_pixbuf_copy_area
gdk_pixbuf_saturate_and_pixelate
#endif
#endif
#if IN_HEADER(GDK_PIXBUF_TRANSFORM_H)
#if IN_FILE(__GDK_PIXBUF_SCALE_C__)
gdk_pixbuf_rotate_simple
gdk_pixbuf_scale
gdk_pixbuf_scale_simple
gdk_pixbuf_flip
gdk_pixbuf_composite
gdk_pixbuf_composite_color
gdk_pixbuf_composite_color_simple
#endif
#endif
#if IN_HEADER(GDK_PIXBUF_ANIMATION_H)
#if IN_FILE(__GDK_PIXBUF_ANIMATION_C__)
gdk_pixbuf_animation_get_height
gdk_pixbuf_animation_get_iter
gdk_pixbuf_animation_get_static_image
@ -17,17 +114,17 @@ gdk_pixbuf_animation_new_from_file PRIVATE
#ifdef G_OS_WIN32
gdk_pixbuf_animation_new_from_file_utf8
#endif
#ifndef GDK_PIXBUF_DISABLE_DEPRECATED
gdk_pixbuf_animation_ref
gdk_pixbuf_animation_unref
gdk_pixbuf_composite
gdk_pixbuf_composite_color
gdk_pixbuf_composite_color_simple
gdk_pixbuf_copy
gdk_pixbuf_copy_area
gdk_pixbuf_error_get_type
gdk_pixbuf_error_quark
gdk_pixbuf_fill
gdk_pixbuf_flip
#endif
gdk_pixbuf_non_anim_new
#endif
#endif
#if IN_HEADER(GDK_PIXBUF_IO_H)
#if IN_FILE(__GDK_PIXBUF_IO_C__)
gdk_pixbuf_get_formats
gdk_pixbuf_format_get_description
gdk_pixbuf_format_get_extensions
gdk_pixbuf_format_get_license
@ -37,19 +134,18 @@ gdk_pixbuf_format_is_disabled
gdk_pixbuf_format_is_scalable
gdk_pixbuf_format_is_writable
gdk_pixbuf_format_set_disabled
gdk_pixbuf_from_pixdata
gdk_pixbuf_get_bits_per_sample
gdk_pixbuf_get_colorspace
gdk_pixbuf_get_file_info
gdk_pixbuf_get_formats
gdk_pixbuf_get_has_alpha
gdk_pixbuf_get_height
gdk_pixbuf_get_n_channels
gdk_pixbuf_get_option
gdk_pixbuf_get_pixels
gdk_pixbuf_get_rowstride
gdk_pixbuf_get_type G_GNUC_CONST
gdk_pixbuf_get_width
#endif
#endif
#if IN_HEADER(GDK_PIXBUF_IO_H)
#if IN_FILE(__GDK_PIXBUF_C__)
gdk_pixbuf_set_option
#endif
#endif
#if IN_HEADER(GDK_PIXBUF_LOADER_H)
#if IN_FILE(__GDK_PIXBUF_LOADER_C__)
gdk_pixbuf_loader_close
gdk_pixbuf_loader_get_animation
gdk_pixbuf_loader_get_format
@ -60,51 +156,32 @@ gdk_pixbuf_loader_new_with_mime_type
gdk_pixbuf_loader_new_with_type
gdk_pixbuf_loader_set_size
gdk_pixbuf_loader_write
gdk_pixbuf_new
gdk_pixbuf_new_from_data
gdk_pixbuf_new_from_file PRIVATE
#ifdef G_OS_WIN32
gdk_pixbuf_new_from_file_utf8
#endif
gdk_pixbuf_new_from_file_at_size PRIVATE
#ifdef G_OS_WIN32
gdk_pixbuf_new_from_file_at_size_utf8
#endif
gdk_pixbuf_new_from_file_at_scale PRIVATE
#ifdef G_OS_WIN32
gdk_pixbuf_new_from_file_at_scale_utf8
#endif
gdk_pixbuf_new_from_inline
gdk_pixbuf_new_from_xpm_data
gdk_pixbuf_new_subpixbuf
gdk_pixbuf_non_anim_new
gdk_pixbuf_ref
gdk_pixbuf_rotate_simple
#if IN_HEADER(__GDK_PIXBUF_ENUM_TYPES_H__)
#if IN_FILE(__GDK_PIXBUF_ENUM_TYPES_C__)
gdk_colorspace_get_type G_GNUC_CONST
gdk_interp_type_get_type G_GNUC_CONST
gdk_pixbuf_alpha_mode_get_type G_GNUC_CONST
gdk_pixbuf_rotation_get_type G_GNUC_CONST
gdk_pixbuf_saturate_and_pixelate
gdk_pixbuf_save PRIVATE G_GNUC_NULL_TERMINATED
#ifdef G_OS_WIN32
gdk_pixbuf_save_utf8
gdk_pixbuf_error_get_type
#endif
gdk_pixbuf_save_to_buffer G_GNUC_NULL_TERMINATED
gdk_pixbuf_save_to_bufferv
gdk_pixbuf_save_to_callback G_GNUC_NULL_TERMINATED
gdk_pixbuf_save_to_callbackv
gdk_pixbuf_savev PRIVATE
#ifdef G_OS_WIN32
gdk_pixbuf_savev_utf8
#endif
gdk_pixbuf_scale
gdk_pixbuf_scale_simple
gdk_pixbuf_set_option
gdk_pixbuf_unref
#if IN_HEADER(__GDK_PIXDATA_H__)
#if IN_FILE(__GDK_PIXDATA_C__)
gdk_pixbuf_from_pixdata
gdk_pixdata_deserialize
gdk_pixdata_from_pixbuf
gdk_pixdata_serialize
gdk_pixdata_to_csource
#endif
#endif
#ifdef INCLUDE_VARIABLES
gdk_pixbuf_major_version
gdk_pixbuf_micro_version
gdk_pixbuf_minor_version
gdk_pixbuf_version
#endif
gdk_pixdata_deserialize
gdk_pixdata_from_pixbuf
gdk_pixdata_serialize
gdk_pixdata_to_csource

View File

@ -17,10 +17,10 @@
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include "gdk-pixbuf-alias.h"
#include "gdk-pixdata.h"
#include "gdk-pixbuf-private.h"
#include "gdk-pixbuf-alias.h"
#include <string.h>
#define APPEND g_string_append_printf
@ -921,3 +921,6 @@ gdk_pixbuf_new_from_inline (gint data_length,
return gdk_pixbuf_from_pixdata (&pixdata, copy_pixels, error);
}
#define __GDK_PIXDATA_C__
#include "gdk-pixbuf-aliasdef.c"

View File

@ -1,5 +1,12 @@
#!/usr/bin/perl -w
my $do_def = 0;
if (($#ARGV >= 0) && ($ARGV[0] eq "-def")) {
shift;
$do_def = 1;
}
print <<EOF;
/* Generated by makegdkpixbufalias.pl */
@ -9,20 +16,28 @@ print <<EOF;
#ifdef G_HAVE_GNUC_VISIBILITY
#ifdef GDK_PIXBUF_DISABLE_DEPRECATED
#define WAS_NO_DEPR
#endif
#undef GDK_PIXBUF_DISABLE_DEPRECATED
EOF
#ifdef G_DISABLE_DEPRECATED
#define WAS_NO_G_DEPR
#endif
#undef G_DISABLE_DEPRECATED
if ($do_def) {
print <<EOF
#undef IN_FILE
#define IN_FILE defined
#include "gdk-pixbuf.h"
#include "gdk-pixdata.h"
#undef IN_HEADER
#define IN_HEADER(x) 1
EOF
}
else {
print <<EOF
#define IN_FILE(x) 1
#define IN_HEADER defined
EOF
}
my $in_comment = 0;
my $in_skipped_section = 0;
while (<>) {
@ -58,7 +73,7 @@ while (<>) {
next;
}
if ($_ =~ /^\#ifdef\s+INCLUDE_VARIABLES/)
if ($_ =~ /^\#ifdef\s+INCLUDE_VARIABLES|INCLUDE_INTERNAL_SYMBOLS|ALL_FILES/)
{
$in_skipped_section = 1;
}
@ -68,7 +83,14 @@ while (<>) {
next;
}
if ($_ =~ /^\#ifdef\s+G/)
if ($_ =~ /^\#ifn?def\s+G/)
{
print $_;
next;
}
if ($_ =~ /^\#if.*(IN_FILE|IN_HEADER|IN_FILE)/)
{
print $_;
@ -90,28 +112,25 @@ while (<>) {
$attributes = "$attributes $word" unless $word eq "PRIVATE";
}
print <<EOF
if (!$do_def) {
print <<EOF
extern __typeof ($str) $alias __attribute((visibility("hidden")))$attributes;
extern __typeof ($str) $str __attribute((alias("$alias"), visibility("default")));
\#define $str $alias
EOF
}
else {
print <<EOF
\#undef $str
extern __typeof ($str) $str __attribute((alias("$alias"), visibility("default")));
EOF
}
}
print <<EOF;
#ifdef WAS_NO_DEPR
#define GDK_PIXBUF_DISABLE_DEPRECATED
#undef WAS_NO_DEPR
#endif
#ifdef WAS_NO_G_DEPR
#define G_DISABLE_DEPRECATED
#undef WAS_NO_G_DEPR
#endif
#endif /* G_HAVE_GNUC_VISIBILITY */
#endif /* DISABLE_VISIBILITY */
EOF