summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2020-11-10 19:39:50 +0100
committerThomas Haller <thaller@redhat.com>2020-11-10 19:44:10 +0100
commit71eeec8c78b176b890d99f7e6c4d95f9ac65e8ab (patch)
treede5537d18f9aa7952f45a71e5e93ea8180d6b4f1
parentb96d48efca870e15efda49bf935a7542b4b8037e (diff)
downloadNetworkManager-71eeec8c78b176b890d99f7e6c4d95f9ac65e8ab.tar.gz
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: cc35dc3bdf5f ('device: improve "nm-device-logging.h" to support a self pointer of NMDevice type')
-rw-r--r--src/devices/nm-device-logging.h10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/devices/nm-device-logging.h b/src/devices/nm-device-logging.h
index ff3d4180dc..34ba4172f7 100644
--- a/src/devices/nm-device-logging.h
+++ b/src/devices/nm-device-logging.h
@@ -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