Simplify G_HAVE_GNUC_VISIBILITY definition

There is no need of compiler checks, GNUC visibility should be used when
__GNUC__ >= 4 but not on Windows.
This commit is contained in:
Xavier Claessens 2022-10-13 20:49:11 -04:00
parent c16f524034
commit d40459c280
3 changed files with 4 additions and 36 deletions

View File

@ -129,7 +129,6 @@ typedef unsigned @glib_intptr_type_define@ guintptr;
#endif
#mesondefine G_HAVE_GROWING_STACK
#mesondefine G_HAVE_GNUC_VISIBILITY
#ifndef _MSC_VER
# define G_HAVE_GNUC_VARARGS 1

View File

@ -1190,6 +1190,10 @@
#define G_UNLIKELY(expr) (expr)
#endif
#if __GNUC__ >= 4 && !defined(_WIN32) && !defined(__CYGWIN__)
#define G_HAVE_GNUC_VISIBILITY 1
#endif
/* GLIB_CANNOT_IGNORE_DEPRECATIONS is defined above for compilers that do not
* have a way to temporarily suppress deprecation warnings. In these cases,
* suppress the deprecated attribute altogether (otherwise a simple #include

View File

@ -210,41 +210,6 @@ if host_system == 'windows' and cc.get_id() != 'msvc' and cc.get_id() != 'clang-
glib_conf.set('_FILE_OFFSET_BITS', 64)
endif
# Check for GNU visibility attributes
g_have_gnuc_visibility = cc.compiles('''
void
__attribute__ ((visibility ("hidden")))
f_hidden (void)
{
}
void
__attribute__ ((visibility ("internal")))
f_internal (void)
{
}
void
__attribute__ ((visibility ("default")))
f_default (void)
{
}
int main (void)
{
f_hidden();
f_internal();
f_default();
return 0;
}
''',
# Not supported by MSVC, but MSVC also won't support visibility,
# so it's OK to pass -Werror explicitly. Replace with
# override_options : 'werror=true' once that is supported
args: ['-Werror'],
name : 'GNU C visibility attributes test')
if g_have_gnuc_visibility
glibconfig_conf.set('G_HAVE_GNUC_VISIBILITY', '1')
endif
# Detect and set symbol visibility
glib_hidden_visibility_args = []
if get_option('default_library') != 'static'