From: Matthias Clasen Date: Mon, 2 Aug 2004 15:34:30 +0000 (+0000) Subject: Add a G_GNUC_INTERNAL macro to mark function declarations as internal and X-Git-Url: http://git.openbox.org/?a=commitdiff_plain;h=f1024215a4c13971a1778334b5093273f22e53b4;p=dana%2Fcg-glib.git Add a G_GNUC_INTERNAL macro to mark function declarations as internal and 2004-08-02 Matthias Clasen * glib/gmacros.h: Add a G_GNUC_INTERNAL macro to mark function declarations as internal and avoid PLT indirections for them. (#145465, Arjan van de Ven) * glib/gunicodeprivate.h: * glib/gthreadinit.h: * glib/gmessages.h: * glib/gdebug.h: * glib/gconvert.c: Use G_GNUC_INTERNAL for _g_charset_get_aliases(), _g_debug_init(), _g_log_fallback_handler(), _g_mem_thread_init(), _g_messages_thread_init(), _g_convert_thread_init(), _g_rand_thread_init(), _g_main_thread_init(), _g_atomic_thread_init(), _g_mem_thread_private_init(), _g_messages_thread_private_init(), _g_utf8_normalize_wc() and _g_unichar_combining_class(). * glib/gatomic.c: Include gthreadinit.h here to see the declaration for _g_atomic_thread_init(). --- diff --git a/ChangeLog b/ChangeLog index afad3958..c3d7d2a7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,20 @@ 2004-08-02 Matthias Clasen + * glib/gmacros.h: Add a G_GNUC_INTERNAL macro to mark function + declarations as internal and avoid PLT indirections for + them. (#145465, Arjan van de Ven) + + * glib/gunicodeprivate.h: + * glib/gthreadinit.h: + * glib/gmessages.h: + * glib/gdebug.h: + * glib/gconvert.c: Use G_GNUC_INTERNAL for _g_charset_get_aliases(), + _g_debug_init(), _g_log_fallback_handler(), _g_mem_thread_init(), + _g_messages_thread_init(), _g_convert_thread_init(), + _g_rand_thread_init(), _g_main_thread_init(), _g_atomic_thread_init(), + _g_mem_thread_private_init(), _g_messages_thread_private_init(), + _g_utf8_normalize_wc() and _g_unichar_combining_class(). + * glib/gatomic.c: Include gthreadinit.h here to see the declaration for _g_atomic_thread_init(). diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index afad3958..c3d7d2a7 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,5 +1,20 @@ 2004-08-02 Matthias Clasen + * glib/gmacros.h: Add a G_GNUC_INTERNAL macro to mark function + declarations as internal and avoid PLT indirections for + them. (#145465, Arjan van de Ven) + + * glib/gunicodeprivate.h: + * glib/gthreadinit.h: + * glib/gmessages.h: + * glib/gdebug.h: + * glib/gconvert.c: Use G_GNUC_INTERNAL for _g_charset_get_aliases(), + _g_debug_init(), _g_log_fallback_handler(), _g_mem_thread_init(), + _g_messages_thread_init(), _g_convert_thread_init(), + _g_rand_thread_init(), _g_main_thread_init(), _g_atomic_thread_init(), + _g_mem_thread_private_init(), _g_messages_thread_private_init(), + _g_utf8_normalize_wc() and _g_unichar_combining_class(). + * glib/gatomic.c: Include gthreadinit.h here to see the declaration for _g_atomic_thread_init(). diff --git a/ChangeLog.pre-2-12 b/ChangeLog.pre-2-12 index afad3958..c3d7d2a7 100644 --- a/ChangeLog.pre-2-12 +++ b/ChangeLog.pre-2-12 @@ -1,5 +1,20 @@ 2004-08-02 Matthias Clasen + * glib/gmacros.h: Add a G_GNUC_INTERNAL macro to mark function + declarations as internal and avoid PLT indirections for + them. (#145465, Arjan van de Ven) + + * glib/gunicodeprivate.h: + * glib/gthreadinit.h: + * glib/gmessages.h: + * glib/gdebug.h: + * glib/gconvert.c: Use G_GNUC_INTERNAL for _g_charset_get_aliases(), + _g_debug_init(), _g_log_fallback_handler(), _g_mem_thread_init(), + _g_messages_thread_init(), _g_convert_thread_init(), + _g_rand_thread_init(), _g_main_thread_init(), _g_atomic_thread_init(), + _g_mem_thread_private_init(), _g_messages_thread_private_init(), + _g_utf8_normalize_wc() and _g_unichar_combining_class(). + * glib/gatomic.c: Include gthreadinit.h here to see the declaration for _g_atomic_thread_init(). diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index afad3958..c3d7d2a7 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,5 +1,20 @@ 2004-08-02 Matthias Clasen + * glib/gmacros.h: Add a G_GNUC_INTERNAL macro to mark function + declarations as internal and avoid PLT indirections for + them. (#145465, Arjan van de Ven) + + * glib/gunicodeprivate.h: + * glib/gthreadinit.h: + * glib/gmessages.h: + * glib/gdebug.h: + * glib/gconvert.c: Use G_GNUC_INTERNAL for _g_charset_get_aliases(), + _g_debug_init(), _g_log_fallback_handler(), _g_mem_thread_init(), + _g_messages_thread_init(), _g_convert_thread_init(), + _g_rand_thread_init(), _g_main_thread_init(), _g_atomic_thread_init(), + _g_mem_thread_private_init(), _g_messages_thread_private_init(), + _g_utf8_normalize_wc() and _g_unichar_combining_class(). + * glib/gatomic.c: Include gthreadinit.h here to see the declaration for _g_atomic_thread_init(). diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index afad3958..c3d7d2a7 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,5 +1,20 @@ 2004-08-02 Matthias Clasen + * glib/gmacros.h: Add a G_GNUC_INTERNAL macro to mark function + declarations as internal and avoid PLT indirections for + them. (#145465, Arjan van de Ven) + + * glib/gunicodeprivate.h: + * glib/gthreadinit.h: + * glib/gmessages.h: + * glib/gdebug.h: + * glib/gconvert.c: Use G_GNUC_INTERNAL for _g_charset_get_aliases(), + _g_debug_init(), _g_log_fallback_handler(), _g_mem_thread_init(), + _g_messages_thread_init(), _g_convert_thread_init(), + _g_rand_thread_init(), _g_main_thread_init(), _g_atomic_thread_init(), + _g_mem_thread_private_init(), _g_messages_thread_private_init(), + _g_utf8_normalize_wc() and _g_unichar_combining_class(). + * glib/gatomic.c: Include gthreadinit.h here to see the declaration for _g_atomic_thread_init(). diff --git a/docs/reference/ChangeLog b/docs/reference/ChangeLog index 24bfccdf..a6bf71f1 100644 --- a/docs/reference/ChangeLog +++ b/docs/reference/ChangeLog @@ -1,7 +1,12 @@ +2004-08-02 Matthias Clasen + + * glib/glib-sections.txt: + * glib/tmpl/macros_misc.sgml: Document G_GNUC_INTERNAL. + 2004-08-01 Matthias Clasen - + * === Released 2.5.1 === - + 2004-07-28 Matthias Clasen * glib/tmpl/misc_utils.sgml: Clarify docs for diff --git a/docs/reference/glib/glib-sections.txt b/docs/reference/glib/glib-sections.txt index 30046a98..371f6eed 100644 --- a/docs/reference/glib/glib-sections.txt +++ b/docs/reference/glib/glib-sections.txt @@ -319,6 +319,7 @@ G_GNUC_FORMAT G_GNUC_FUNCTION G_GNUC_PRETTY_FUNCTION G_GNUC_NO_INSTRUMENT +G_GNUC_INTERNAL G_LIKELY diff --git a/docs/reference/glib/tmpl/macros_misc.sgml b/docs/reference/glib/tmpl/macros_misc.sgml index 16f1a945..cde36bca 100644 --- a/docs/reference/glib/tmpl/macros_misc.sgml +++ b/docs/reference/glib/tmpl/macros_misc.sgml @@ -250,6 +250,16 @@ See the GNU C documentation for details. + + +Expands to the GNU C visibility(hidden) attribute if the +compiler is gcc. This attribute can be used for marking +library functions as being used internally to the lib only, to not create +inefficient PLT entries. Note that static functions do not need to be marked +as internal in this way. See the GNU C documentation for details. + + +Since: 2.6 diff --git a/glib/gconvert.c b/glib/gconvert.c index 4dc14830..dd811e56 100644 --- a/glib/gconvert.c +++ b/glib/gconvert.c @@ -90,7 +90,7 @@ try_to_aliases (const char **to_aliases, return FALSE; } -extern const char **_g_charset_get_aliases (const char *canonical_name); +extern const char **_g_charset_get_aliases (const char *canonical_name) G_GNUC_INTERNAL; /** * g_iconv_open: diff --git a/glib/gdebug.h b/glib/gdebug.h index d06b8b1a..dda02132 100644 --- a/glib/gdebug.h +++ b/glib/gdebug.h @@ -53,7 +53,7 @@ typedef enum { GLIB_VAR gboolean _g_debug_initialized; GLIB_VAR guint _g_debug_flags; -void _g_debug_init (); +void _g_debug_init () G_GNUC_INTERNAL; #ifdef __cplusplus } diff --git a/glib/gmacros.h b/glib/gmacros.h index d205053f..788b3076 100644 --- a/glib/gmacros.h +++ b/glib/gmacros.h @@ -54,6 +54,17 @@ #define G_GNUC_PURE #endif +/* + * Provide G_GNUC_INTERNAL that is used for marking library + * functions as being used internally to the lib only, to not + * create inefficient PLT entries. + */ +#if defined (__GNUC__) +#define G_GNUC_INTERNAL __attribute__((visibility("hidden"))) +#else +#define G_GNUC_INTERNAL +#endif + #if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ > 4) #define G_GNUC_PRINTF( format_idx, arg_idx ) \ __attribute__((__format__ (__printf__, format_idx, arg_idx))) diff --git a/glib/gmessages.h b/glib/gmessages.h index d47fdcfe..c3606291 100644 --- a/glib/gmessages.h +++ b/glib/gmessages.h @@ -104,7 +104,7 @@ GLogLevelFlags g_log_set_always_fatal (GLogLevelFlags fatal_mask); void _g_log_fallback_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, - gpointer unused_data); + gpointer unused_data) G_GNUC_INTERNAL; #ifndef G_LOG_DOMAIN diff --git a/glib/gthreadinit.h b/glib/gthreadinit.h index 663c422e..a7242d27 100644 --- a/glib/gthreadinit.h +++ b/glib/gthreadinit.h @@ -27,16 +27,16 @@ G_BEGIN_DECLS void g_thread_init_glib (void); /* Are called from glib/gthread.c. May not contain g_private_new calls */ -void _g_mem_thread_init (void); -void _g_messages_thread_init (void); -void _g_convert_thread_init (void); -void _g_rand_thread_init (void); -void _g_main_thread_init (void); -void _g_atomic_thread_init (void); +void _g_mem_thread_init (void) G_GNUC_INTERNAL; +void _g_messages_thread_init (void) G_GNUC_INTERNAL; +void _g_convert_thread_init (void) G_GNUC_INTERNAL; +void _g_rand_thread_init (void) G_GNUC_INTERNAL; +void _g_main_thread_init (void) G_GNUC_INTERNAL; +void _g_atomic_thread_init (void) G_GNUC_INTERNAL; /* Are called from glib/gthread.c. Must only contain g_private_new calls */ -void _g_mem_thread_private_init (void); -void _g_messages_thread_private_init (void); +void _g_mem_thread_private_init (void) G_GNUC_INTERNAL; +void _g_messages_thread_private_init (void) G_GNUC_INTERNAL; G_END_DECLS diff --git a/glib/gunicodeprivate.h b/glib/gunicodeprivate.h index 84ebad30..3cf2bb6b 100644 --- a/glib/gunicodeprivate.h +++ b/glib/gunicodeprivate.h @@ -27,8 +27,8 @@ G_BEGIN_DECLS gunichar *_g_utf8_normalize_wc (const gchar *str, gssize max_len, - GNormalizeMode mode); -gint _g_unichar_combining_class (gunichar uc); + GNormalizeMode mode) G_GNUC_INTERNAL; +gint _g_unichar_combining_class (gunichar uc) G_GNUC_INTERNAL; G_END_DECLS