[cairo-commit] 2 commits - src/cairo-compiler-private.h test/scaled-font-zero-matrix.c

M. Joonas Pihlaja joonas at kemper.freedesktop.org
Thu Feb 25 04:35:16 PST 2010


 src/cairo-compiler-private.h   |   30 ++++++++++++++++++++++++++++++
 test/scaled-font-zero-matrix.c |    4 +++-
 2 files changed, 33 insertions(+), 1 deletion(-)

New commits:
commit ef807119ff8ee23c0444f1197f92b06a5caf6024
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Thu Feb 25 13:58:53 2010 +0200

    compiler: Explain the slim hidden macros.
    
    The slim_hidden_* macro definitions are rather cryptic at first
    sight and I keep needing to rederive how they work just find out
    what they're supposed to do.  This patch adds a comment explaining
    how they're used and work.

diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h
index c3814d2..0d9229e 100644
--- a/src/cairo-compiler-private.h
+++ b/src/cairo-compiler-private.h
@@ -53,6 +53,36 @@
 
 #define CAIRO_STACK_ARRAY_LENGTH(T) (CAIRO_STACK_BUFFER_SIZE / sizeof(T))
 
+/*
+ * The goal of this block is to define the following macros for
+ * providing faster linkage to functions in the public API for calls
+ * from within cairo.
+ *
+ * slim_hidden_proto(f)
+ * slim_hidden_proto_no_warn(f)
+ *
+ *   Declares `f' as a library internal function and hides the
+ *   function from the global symbol table.  This macro must be
+ *   expanded after `f' has been declared with a prototype but before
+ *   any calls to the function are seen by the compiler.  The no_warn
+ *   variant inhibits warnings about the return value being unused at
+ *   call sites.  The macro works by renaming `f' to an internal name
+ *   in the symbol table and hiding that.  As far as cairo internal
+ *   calls are concerned they're calling a library internal function
+ *   and thus don't need to bounce via the PLT.
+ *
+ * slim_hidden_def(f)
+ *
+ *   Exports `f' back to the global symbol table.  This macro must be
+ *   expanded right after the function definition and only for symbols
+ *   hidden previously with slim_hidden_proto().  The macro works by
+ *   adding a global entry to the symbol table which points at the
+ *   internal name of `f' created by slim_hidden_proto().
+ *
+ * Functions in the public API which aren't called by the library
+ * don't need to be hidden and re-exported using the slim hidden
+ * macros.
+ */
 #if __GNUC__ >= 3 && defined(__ELF__) && !defined(__sun)
 # define slim_hidden_proto(name)		slim_hidden_proto1(name, slim_hidden_int_name(name)) cairo_private
 # define slim_hidden_proto_no_warn(name)	slim_hidden_proto1(name, slim_hidden_int_name(name)) cairo_private_no_warn
commit dcf897967d54f579c737bbcc10af7fa295b586e5
Author: M Joonas Pihlaja <jpihlaja at cc.helsinki.fi>
Date:   Sun Feb 21 01:45:30 2010 +0200

    test: Fix a wrongly typed return value in scaled-font-zero-matrix.
    
    The test was returning a cairo_status_t, but should be returning
    a cairo_test_status_t instead.  When the test failed it was
    being reported as having crashed, rather than merely failed,
    because the enum value of CAIRO_TEST_CRASHED happened to be
    same as the cairo_status_t value of the cairo context at
    the end of the failing test.

diff --git a/test/scaled-font-zero-matrix.c b/test/scaled-font-zero-matrix.c
index bd5c377..d4f79a6 100644
--- a/test/scaled-font-zero-matrix.c
+++ b/test/scaled-font-zero-matrix.c
@@ -50,7 +50,9 @@ draw (cairo_t *cr, int width, int height)
     cairo_show_text (cr, "Hello");
     cairo_scaled_font_destroy (scaled_font);
     cairo_font_options_destroy (font_options);
-    return cairo_status (cr);
+
+    return cairo_test_status_from_status (cairo_test_get_context (cr),
+                                          cairo_status(cr));
 }
 
 CAIRO_TEST (scaled_font_zero_matrix,


More information about the cairo-commit mailing list