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 \
                    ^
This commit is contained in:
Thomas Haller 2019-02-05 17:31:41 +01:00
parent 68d7e63886
commit 06701e9532

View file

@ -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; \
} \