summaryrefslogtreecommitdiff
path: root/src/cairo-compiler-private.h
diff options
context:
space:
mode:
authorM Joonas Pihlaja <jpihlaja@cc.helsinki.fi>2010-02-25 13:58:53 +0200
committerM Joonas Pihlaja <jpihlaja@cc.helsinki.fi>2010-02-25 14:33:58 +0200
commitef807119ff8ee23c0444f1197f92b06a5caf6024 (patch)
tree7bd301cde9b73b5da098e4294898427db15ececb /src/cairo-compiler-private.h
parentdcf897967d54f579c737bbcc10af7fa295b586e5 (diff)
downloadcairo-ef807119ff8ee23c0444f1197f92b06a5caf6024.tar.gz
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.
Diffstat (limited to 'src/cairo-compiler-private.h')
-rw-r--r--src/cairo-compiler-private.h30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h
index c3814d2be..0d9229ee2 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