device: fix _Generic() types for _NM_DEVICE_CAST() macro
clang (x86_64, 3.4.2-9.el7) fails:
../src/devices/nm-device-6lowpan.c:161:9: error: controlling expression type 'typeof (*self) *const' (aka 'struct _NMDevice6Lowpan *const') not compatible with any generic association type
_LOGW(LOGD_DEVICE, "could not get 6lowpan properties");
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../shared/nm-glib-aux/nm-logging-fwd.h:165:20: note: expanded from macro '_LOGW'
#define _LOGW(...) _NMLOG(_LOGL_WARN, __VA_ARGS__)
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/devices/nm-device-logging.h:32:81: note: expanded from macro '_NMLOG'
const char *const _ifname = _nm_device_get_iface(_NM_DEVICE_CAST(_self)); \
^~~~~
../src/devices/nm-device-logging.h:17:19: note: expanded from macro '_NM_DEVICE_CAST'
_Generic((self), _NMLOG_DEVICE_TYPE * \
^
Fixes: cc35dc3bdf
('device: improve "nm-device-logging.h" to support a self pointer of NMDevice type')
This commit is contained in:
@@ -13,10 +13,12 @@
|
||||
#elif !defined(_NMLOG_DEVICE_TYPE)
|
||||
#define _NM_DEVICE_CAST(self) _NM_ENSURE_TYPE(NMDevice *, self)
|
||||
#else
|
||||
#define _NM_DEVICE_CAST(self) \
|
||||
_Generic((self), _NMLOG_DEVICE_TYPE * \
|
||||
: ((NMDevice *) (self)), NMDevice * \
|
||||
: ((NMDevice *) (self)))
|
||||
#define _NM_DEVICE_CAST(self) \
|
||||
_Generic((self), \
|
||||
_NMLOG_DEVICE_TYPE * : ((NMDevice *) (self)), \
|
||||
_NMLOG_DEVICE_TYPE * const: ((NMDevice *) (self)), \
|
||||
NMDevice * : ((NMDevice *) (self)), \
|
||||
NMDevice * const: ((NMDevice *) (self)))
|
||||
#endif
|
||||
|
||||
#undef _NMLOG_ENABLED
|
||||
|
Reference in New Issue
Block a user