summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-11-10 22:53:02 +0100
committerThomas Haller <thaller@redhat.com>2020-11-10 22:54:32 +0100
commit31940037faa9a9245645fe9209dc1c1c12a01c2d (patch)
tree6b26b03d277836bb1cd1329059173001e49a3217
parentebbc2c9c0d9536db6397c9fb1933b011df71bc14 (diff)
downloadNetworkManager-31940037faa9a9245645fe9209dc1c1c12a01c2d.tar.gz
device: fix _Generic() types for _NM_DEVICE_CAST() macro (2)
clang (x86_64, 3.4.2-9.el7) fails: ../src/devices/nm-device.c:957:9: error: controlling expression type 'typeof (*self) *const' (aka 'struct _NMDevice *const') not compatible with any generic association type _LOGT(LOGD_DEVICE, ^~~~~~~~~~~~~~~~~~ ../shared/nm-glib-aux/nm-logging-fwd.h:162:20: note: expanded from macro '_LOGT' #define _LOGT(...) _NMLOG(_LOGL_TRACE, __VA_ARGS__) ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../src/devices/nm-device-logging.h:34:81: note: expanded from macro '_NMLOG' const char *const _ifname = _nm_device_get_iface(_NM_DEVICE_CAST(_self)); \ ^~~~~ ../src/devices/nm-device-logging.h:14:63: note: expanded from macro '_NM_DEVICE_CAST' #define _NM_DEVICE_CAST(self) _NM_ENSURE_TYPE(NMDevice *, self) ^ ../shared/nm-glib-aux/nm-macros-internal.h:664:53: note: expanded from macro '_NM_ENSURE_TYPE' #define _NM_ENSURE_TYPE(type, value) (_Generic((value), type : (value))) ^ Fixes: cc35dc3bdf5f ('device: improve "nm-device-logging.h" to support a self pointer of NMDevice type')
-rw-r--r--src/devices/nm-device-logging.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/devices/nm-device-logging.h b/src/devices/nm-device-logging.h
index 34ba4172f7..76d758e0f1 100644
--- a/src/devices/nm-device-logging.h
+++ b/src/devices/nm-device-logging.h
@@ -11,7 +11,10 @@
#if !_NM_CC_SUPPORT_GENERIC
#define _NM_DEVICE_CAST(self) ((NMDevice *) (self))
#elif !defined(_NMLOG_DEVICE_TYPE)
- #define _NM_DEVICE_CAST(self) _NM_ENSURE_TYPE(NMDevice *, self)
+ #define _NM_DEVICE_CAST(self) \
+ _Generic((self), NMDevice * \
+ : ((NMDevice *) (self)), NMDevice *const \
+ : ((NMDevice *) (self)))
#else
#define _NM_DEVICE_CAST(self) \
_Generic((self), \