[glib: 1/7] Simplify G_HAVE_GNUC_VISIBILITY definition
- From: Xavier Claessens <xclaesse src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib: 1/7] Simplify G_HAVE_GNUC_VISIBILITY definition
- Date: Fri, 14 Oct 2022 11:47:46 +0000 (UTC)
commit d40459c280b28cfe84f7e590b7d10d344661df2d
Author: Xavier Claessens <xavier claessens collabora com>
Date: Thu Oct 13 20:49:11 2022 -0400
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.
glib/glibconfig.h.in | 1 -
glib/gmacros.h | 4 ++++
meson.build | 35 -----------------------------------
3 files changed, 4 insertions(+), 36 deletions(-)
---
diff --git a/glib/glibconfig.h.in b/glib/glibconfig.h.in
index ffedee1d2a..0632e0b2f4 100644
--- a/glib/glibconfig.h.in
+++ b/glib/glibconfig.h.in
@@ -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
diff --git a/glib/gmacros.h b/glib/gmacros.h
index d4e5124cf1..2ef7587ce4 100644
--- a/glib/gmacros.h
+++ b/glib/gmacros.h
@@ -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
diff --git a/meson.build b/meson.build
index 43bb468322..4307c20dce 100644
--- a/meson.build
+++ b/meson.build
@@ -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'
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]