From 06701e9532a4ed3c879644ddced6e3d6876663ad Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 5 Feb 2019 17:31:41 +0100 Subject: [PATCH] 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 \ ^ --- shared/nm-utils/nm-macros-internal.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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; \ } \