]> Pileus Git - ~andy/gtk/blob - gdk-pixbuf/makegdkpixbufalias.pl
New option --disable-visibility to disable the use of ELF visibility
[~andy/gtk] / gdk-pixbuf / makegdkpixbufalias.pl
1 #!/usr/bin/perl -w
2
3 print <<EOF;
4 /* Generated by makegdkpixbufalias.pl */
5
6 #ifndef DISABLE_VISIBILITY
7
8 #include <glib.h>
9
10 #ifdef G_HAVE_GNUC_VISIBILITY
11
12 #ifdef  GDK_PIXBUF_DISABLE_DEPRECATED
13 #define WAS_NO_DEPR
14 #endif
15 #undef  GDK_PIXBUF_DISABLE_DEPRECATED
16
17 #ifdef  G_DISABLE_DEPRECATED
18 #define WAS_NO_G_DEPR
19 #endif
20 #undef  G_DISABLE_DEPRECATED
21
22 #include "gdk-pixbuf.h"
23 #include "gdk-pixdata.h"
24
25 EOF
26
27 while (<>) {
28
29   # ignore empty lines
30   next if /^\s*$/;
31
32   # skip comments
33   if ($_ =~ /^\s*\/\*/)
34   {
35       $in_comment = 1;
36   }
37   
38   if ($in_comment)
39   {
40       if ($_ =~  /\*\/\s$/)
41       {
42           $in_comment = 0;
43       }
44       
45       next;
46   }
47
48   # handle ifdefs
49   if ($_ =~ /^\#endif/)
50   {
51       if (!$in_skipped_section)
52       {
53           print $_;
54       }
55
56       $in_skipped_section = 0;
57
58       next;
59   }
60
61   if ($_ =~ /^\#ifdef\s+INCLUDE_VARIABLES/)
62   {
63       $in_skipped_section = 1;
64   }
65
66   if ($in_skipped_section)
67   {
68       next;
69   }
70
71   if ($_ =~ /^\#ifdef\s+G/)
72   {
73       print $_;
74       
75       next;
76   }
77
78
79   my $str = $_;
80   chomp($str);
81   my $alias = "IA__".$str;
82   
83   print <<EOF
84 extern __typeof ($str) $alias __attribute((visibility("hidden")));
85 extern __typeof ($str) $str __attribute((alias("$alias"), visibility("default")));
86 \#define $str $alias
87
88 EOF
89 }
90
91 print <<EOF;
92
93 #ifdef  WAS_NO_DEPR
94 #define GDK_PIXBUF_DISABLE_DEPRECATED
95 #undef  WAS_NO_DEPR
96 #endif
97
98 #ifdef  WAS_NO_G_DEPR
99 #define G_DISABLE_DEPRECATED
100 #undef  WAS_NO_G_DEPR
101 #endif
102
103 #endif /* G_HAVE_GNUC_VISIBILITY */
104
105 #endif /* DISABLE_VISIBILITY */
106 EOF
107
108