[cairo] __visibility__ bug fix

Kristian Høgsberg krh at bitplanet.net
Mon Dec 20 20:02:43 PST 2004


Kristian Høgsberg wrote:
> Carl Worth wrote:
> 
>> On Mon, 20 Dec 2004 18:03:25 +0100, David Reveman wrote:
>>
>>> If you place the '*' after the __internal_linkage macro, like this:
>>>
>>> extern cairo_surface_t __internal_linkage *
>>> cairo_function ();
>>>
>>> I think gcc 3.4 should be happy.
>>
>>
>>
>> Thanks. That did the trick, so these macros are all back again.
>>
>> Of course, splitting up the return type with this macro does make the
>> declaration look nasty. It was much easier to ignore the macro when it
>> was off to the right.
>>
>> I don't hiding the return type inside a macro argument would look good
>> either, (extra parentheses in a function declaration are particularly
>> confusing).
>>
>> Am I doomed to have to learn to deal with inscrutable header files?
>>
>> Any other suggestions?
> 
> 
> What about putting it before the type?
> 
>   extern __internal_linkage cairo_gstate_t *
>   _cairo_gstate_create (void);
> 
> This works for me with gcc 3.4 and 2.96, and it has the storage 
> specifiers grouped together at the beginning of the line.

Another thing; I was just reviewing the exported ABI and found a couple 
of missing __internal_linkage or static speficiers.  Patch attached.

cheers,
Kristian


-------------- next part --------------
? make-patch.sh
? src/cairo_array.c
? src/cairo_pdf_surface.c
Index: src/cairo_font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_font.c,v
retrieving revision 1.28
diff -u -p -r1.28 cairo_font.c
--- src/cairo_font.c	12 Nov 2004 14:12:20 -0000	1.28
+++ src/cairo_font.c	21 Dec 2004 03:56:37 -0000
@@ -144,7 +144,7 @@ _font_cache_destroy_cache (void *cache)
     free (cache);
 }
 
-const struct cairo_cache_backend cairo_font_cache_backend = {
+static const struct cairo_cache_backend cairo_font_cache_backend = {
     _font_cache_hash,
     _font_cache_keys_equal,
     _font_cache_create_entry,
@@ -475,7 +475,7 @@ _image_glyph_cache_destroy_cache (void *
     free (cache);
 }
 
-const cairo_cache_backend_t cairo_image_cache_backend = {
+static const cairo_cache_backend_t cairo_image_cache_backend = {
     _cairo_glyph_cache_hash,
     _cairo_glyph_cache_keys_equal,
     _image_glyph_cache_create_entry,
Index: src/cairo_ft_font.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_ft_font.c,v
retrieving revision 1.27
diff -u -p -r1.27 cairo_ft_font.c
--- src/cairo_ft_font.c	12 Nov 2004 14:12:20 -0000	1.27
+++ src/cairo_ft_font.c	21 Dec 2004 03:56:38 -0000
@@ -246,7 +246,7 @@ _ft_font_cache_destroy_cache (void *cach
     free (fc);
 }
 
-const struct cairo_cache_backend _ft_font_cache_backend = {
+static const struct cairo_cache_backend _ft_font_cache_backend = {
     _ft_font_cache_hash,
     _ft_font_cache_keys_equal,
     _ft_font_cache_create_entry,
Index: src/cairo_wideint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_wideint.h,v
retrieving revision 1.1
diff -u -p -r1.1 cairo_wideint.h
--- src/cairo_wideint.h	28 May 2004 19:37:15 -0000	1.1
+++ src/cairo_wideint.h	21 Dec 2004 03:56:40 -0000
@@ -171,8 +171,8 @@ const cairo_uint128_t I	_cairo_uint64x64
 const cairo_uint128_t I	_cairo_uint128_lsl (cairo_uint128_t a, int shift);
 const cairo_uint128_t I	_cairo_uint128_rsl (cairo_uint128_t a, int shift);
 const cairo_uint128_t I	_cairo_uint128_rsa (cairo_uint128_t a, int shift);
-const int		_cairo_uint128_lt (cairo_uint128_t a, cairo_uint128_t b);
-const int		_cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b);
+const int I		_cairo_uint128_lt (cairo_uint128_t a, cairo_uint128_t b);
+const int I		_cairo_uint128_eq (cairo_uint128_t a, cairo_uint128_t b);
 const cairo_uint128_t I	_cairo_uint128_negate (cairo_uint128_t a);
 #define			_cairo_uint128_negative(a)  (_cairo_uint64_negative(a.hi))
 const cairo_uint128_t I	_cairo_uint128_not (cairo_uint128_t a);
@@ -191,7 +191,7 @@ const cairo_int128_t I	_cairo_int64_to_i
 #define			_cairo_int128_lsl(a,b)	    _cairo_uint128_lsl(a,b)
 #define			_cairo_int128_rsl(a,b)	    _cairo_uint128_rsl(a,b)
 #define			_cairo_int128_rsa(a,b)	    _cairo_uint128_rsa(a,b)
-const int		_cairo_int128_lt (cairo_int128_t a, cairo_int128_t b);
+const int I		_cairo_int128_lt (cairo_int128_t a, cairo_int128_t b);
 #define			_cairo_int128_eq(a,b)	    _cairo_uint128_eq (a,b)
 #define			_cairo_int128_negate(a)	    _cairo_uint128_negate(a)
 #define			_cairo_int128_negative(a)   (_cairo_uint128_negative(a))
Index: src/cairo_xlib_surface.c
===================================================================
RCS file: /cvs/cairo/cairo/src/cairo_xlib_surface.c,v
retrieving revision 1.30
diff -u -p -r1.30 cairo_xlib_surface.c
--- src/cairo_xlib_surface.c	20 Dec 2004 20:22:51 -0000	1.30
+++ src/cairo_xlib_surface.c	21 Dec 2004 03:56:41 -0000
@@ -944,7 +944,7 @@ _xlib_glyphset_cache_destroy_entry (void
     free (v);	
 }
 
-const cairo_cache_backend_t _xlib_glyphset_cache_backend = {
+static const cairo_cache_backend_t _xlib_glyphset_cache_backend = {
     _cairo_glyph_cache_hash,
     _cairo_glyph_cache_keys_equal,
     _xlib_glyphset_cache_create_entry,
Index: src/cairoint.h
===================================================================
RCS file: /cvs/cairo/cairo/src/cairoint.h,v
retrieving revision 1.76
diff -u -p -r1.76 cairoint.h
--- src/cairoint.h	20 Dec 2004 17:53:06 -0000	1.76
+++ src/cairoint.h	21 Dec 2004 03:56:43 -0000
@@ -467,7 +501,7 @@ typedef struct cairo_font_backend {
 } cairo_font_backend_t;
 
 /* concrete font backends */
-extern const struct cairo_font_backend cairo_ft_font_backend;
+extern const __internal_linkage struct cairo_font_backend cairo_ft_font_backend;
 
 
 typedef struct cairo_surface_backend {
@@ -790,13 +823,13 @@ _cairo_restrict_value (double *value, do
 extern cairo_fixed_t __internal_linkage
 _cairo_fixed_from_int (int i);
 
-extern cairo_fixed_t
+extern cairo_fixed_t __internal_linkage
 _cairo_fixed_from_double (double d);
 
-cairo_fixed_t
+cairo_fixed_t __internal_linkage
 _cairo_fixed_from_26_6 (uint32_t i);
 
-extern double
+extern double __internal_linkage
 _cairo_fixed_to_double (cairo_fixed_t f);
 
 extern int __internal_linkage
@@ -1197,7 +1230,7 @@ _cairo_unscaled_font_glyph_path (cairo_u
 				 cairo_path_t            	*path);
 
 /* cairo_hull.c */
-extern cairo_status_t
+extern cairo_status_t __internal_linkage
 _cairo_hull_compute (cairo_pen_vertex_t *vertices, int *num_vertices);
 
 /* cairo_path.c */


More information about the cairo mailing list