summaryrefslogtreecommitdiff
path: root/shared
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2019-02-05 17:31:41 +0100
committerThomas Haller <thaller@redhat.com>2019-02-07 17:31:05 +0100
commit06701e9532a4ed3c879644ddced6e3d6876663ad (patch)
tree24dee7cdc9bb9814c29586fe3c8cd536ccb0475e /shared
parent68d7e6388603ac6976bc0a2b719ee2956ff47f25 (diff)
downloadNetworkManager-06701e9532a4ed3c879644ddced6e3d6876663ad.tar.gz
macros: don't use __externally_visible__ attribute for clang
clang does not support externally_visible: ../libnm/nm-access-point.c:243:1: error: unknown attribute externally_visible ignored [-Werror,-Wunknown-attributes] NM_BACKPORT_SYMBOL (libnm_1_0_6, int, nm_access_point_get_last_seen, (NMAccessPoint *ap), (ap)); ^ ../shared/nm-utils/nm-macros-internal.h:1299:74: note: expanded from macro NM_BACKPORT_SYMBOL #define NM_BACKPORT_SYMBOL(version, return_type, func, args_typed, args) \ ^ ../shared/nm-utils/nm-macros-internal.h:1292:17: note: expanded from macro _NM_BACKPORT_SYMBOL_IMPL __attribute__ ((externally_visible)) return_type versioned_func args_typed \ ^
Diffstat (limited to 'shared')
-rw-r--r--shared/nm-utils/nm-macros-internal.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/shared/nm-utils/nm-macros-internal.h b/shared/nm-utils/nm-macros-internal.h
index 3537b37d50..55cdd374da 100644
--- a/shared/nm-utils/nm-macros-internal.h
+++ b/shared/nm-utils/nm-macros-internal.h
@@ -45,6 +45,18 @@
#define nm_auto(fcn) __attribute__ ((__cleanup__(fcn)))
+/* This is required to make LTO working.
+ *
+ * See https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/76#note_112694
+ * https://gcc.gnu.org/bugzilla/show_bug.cgi?id=48200#c28
+ */
+#ifndef __clang__
+#define _nm_externally_visible __attribute__ ((__externally_visible__))
+#else
+#define _nm_externally_visible
+#endif
+
+
#if __GNUC__ >= 7
#define _nm_fallthrough __attribute__ ((__fallthrough__))
#else
@@ -1289,7 +1301,7 @@ fcn_name (lookup_type val) \
#define _NM_BACKPORT_SYMBOL_IMPL(version, return_type, orig_func, versioned_func, args_typed, args) \
return_type versioned_func args_typed; \
-__attribute__ ((externally_visible)) return_type versioned_func args_typed \
+_nm_externally_visible return_type versioned_func args_typed \
{ \
return orig_func args; \
} \