Commit df3dd538 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen

Define G_GNUC_INTERNAL for Sun Studio as __hidden. (#342981, Brian

2007-01-26  Matthias Clasen <mclasen@redhat.com>

        * configure.in: Define G_GNUC_INTERNAL for Sun Studio
        as __hidden.  (#342981, Brian Cameron)

        * glib/gconvert.c:
        * glib/gutf8.c: Move G_GNUC_INTERNAL uses to the right
        spot.

2

svn path=/trunk/; revision=5317
parent f90d6d82
2007-01-26 Matthias Clasen <mclasen@redhat.com>
* configure.in: Define G_GNUC_INTERNAL for Sun Studio
as __hidden. (#342981, Brian Cameron)
* glib/gconvert.c:
* glib/gutf8.c: Move G_GNUC_INTERNAL uses to the right
spot.
2007-01-26 Matthias Clasen <mclasen@redhat.com>
* gmem.c:
......
......@@ -786,6 +786,15 @@ int main (int argc, char **argv)
AC_MSG_RESULT($g_have_gnuc_visibility)
AM_CONDITIONAL(HAVE_GNUC_VISIBILITY, [test x$g_have_gnuc_visibility = xyes])
AC_MSG_CHECKING([whether using Sun Studio C compiler])
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#if defined(__SUNPRO_C) || (__SUNPRO_C >= 0x550)
#else
# include "error: this is not Sun Studio."
#endif
]], [[]])], [ g_have_sunstudio_visibility=yes ], [ g_have_sunstudio_visibility=no ])
AC_MSG_RESULT($g_have_sunstudio_visibility)
AM_CONDITIONAL(HAVE_SUNSTUDIO_VISIBILITY, [test x$g_have_sunstudio_visibility = xyes])
# check for bytesex stuff
AC_C_BIGENDIAN
......@@ -2440,10 +2449,16 @@ _______EOF
#define G_GNUC_INTERNAL __attribute__((visibility("hidden")))
#endif
_______EOF
else
else
if test x$g_have_sunstudio_visibility = xyes ; then
cat >>$outfile <<_______EOF
#define G_GNUC_INTERNAL __hidden
_______EOF
else
cat >>$outfile <<_______EOF
#define G_GNUC_INTERNAL
_______EOF
fi
fi
......@@ -2769,6 +2784,7 @@ g_have_iso_cxx_varargs=$g_have_iso_cxx_varargs
g_can_inline=$g_can_inline
g_have_gnuc_visibility=$g_have_gnuc_visibility
g_have_sunstudio_visibility=$g_have_sunstudio_visibility
case xyes in
x$ac_cv_c_bigendian)
......
2007-01-26 Matthias Clasen <mclasen@redhat.com>
* glib/tmpl/macros_misc.sgml: Document G_GNUC_INTERNAL
support for Sun Studio.
2007-01-23 Matthias Clasen <mclasen@redhat.com>
* gobject/tmpl/objects.sgml: Document
......
......@@ -309,12 +309,29 @@ Since: 2.6
<!-- ##### MACRO G_GNUC_INTERNAL ##### -->
<para>
Expands to the GNU C <literal>visibility(hidden)</literal> attribute if the
compiler supports it (currently only <command>gcc</command>). 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.
This attribute can be used for marking library functions as being used
internally to the library only, which may allow the compiler to handle
function calls more efficiently.
Note that static functions do not need to be marked as internal in this way.
See the GNU C documentation for details.
</para>
<para>
When using a compiler that supports the GNU C hidden visibility attribute,
this macro expands to <literal>__attribute__((visibility("hidden")))</literal>.
When using the Sun Studio compiler, it expands to <literal>__hidden</literal>.
</para>
<para>
Note that for portability, the attribute should be placed before the
function declaration. While GCC allows the macro after the declaration,
Sun Studio does not.
</para>
<informalexample><programlisting>
G_GNUC_INTERNAL
void _g_log_fallback_handler (const gchar *log_domain,
GLogLevelFlags log_level,
const gchar *message,
gpointer unused_data);
</programlisting></informalexample>
Since: 2.6
......
......@@ -89,7 +89,8 @@ try_to_aliases (const char **to_aliases,
return FALSE;
}
extern const char ** G_GNUC_INTERNAL _g_charset_get_aliases (const char *canonical_name);
G_GNUC_INTERNAL extern const char **
_g_charset_get_aliases (const char *canonical_name);
/**
* g_iconv_open:
......
......@@ -435,7 +435,7 @@ get_alias_hash (void)
/* As an abuse of the alias table, the following routines gets
* the charsets that are aliases for the canonical name.
*/
const char ** G_GNUC_INTERNAL
G_GNUC_INTERNAL const char **
_g_charset_get_aliases (const char *canonical_name)
{
GHashTable *alias_hash = get_alias_hash ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment