From 0cbf2c8c2ae3311bae688449dea4cfa21f4293e6 Mon Sep 17 00:00:00 2001 From: Thomas Haller Date: Tue, 10 Jul 2018 08:29:21 +0200 Subject: [PATCH] device: wrap NM_DEVICE_CLASS_DECLARE_TYPES() macro with do-while block --- src/devices/nm-device-6lowpan.c | 2 +- src/devices/nm-device-bond.c | 2 +- src/devices/nm-device-bridge.c | 2 +- src/devices/nm-device-dummy.c | 2 +- src/devices/nm-device-ethernet.c | 2 +- src/devices/nm-device-generic.c | 2 +- src/devices/nm-device-infiniband.c | 2 +- src/devices/nm-device-macsec.c | 2 +- src/devices/nm-device-macvlan.c | 2 +- src/devices/nm-device-ppp.c | 2 +- src/devices/nm-device-private.h | 13 ++++++++----- src/devices/nm-device-tun.c | 2 +- src/devices/nm-device-veth.c | 2 +- src/devices/nm-device-vlan.c | 2 +- src/devices/nm-device-vxlan.c | 2 +- src/devices/nm-device-wpan.c | 2 +- src/devices/team/nm-device-team.c | 2 +- src/devices/wifi/nm-device-iwd.c | 2 +- src/devices/wifi/nm-device-olpc-mesh.c | 2 +- src/devices/wifi/nm-device-wifi.c | 2 +- 20 files changed, 27 insertions(+), 24 deletions(-) diff --git a/src/devices/nm-device-6lowpan.c b/src/devices/nm-device-6lowpan.c index 36a9eb6f4f..63622b49e9 100644 --- a/src/devices/nm-device-6lowpan.c +++ b/src/devices/nm-device-6lowpan.c @@ -296,7 +296,7 @@ nm_device_6lowpan_class_init (NMDevice6LowpanClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_6LOWPAN) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_6LOWPAN); dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_6lowpan); diff --git a/src/devices/nm-device-bond.c b/src/devices/nm-device-bond.c index 8d24a732cc..529144239b 100644 --- a/src/devices/nm-device-bond.c +++ b/src/devices/nm-device-bond.c @@ -633,7 +633,7 @@ nm_device_bond_class_init (NMDeviceBondClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_BOND_SETTING_NAME, NM_LINK_TYPE_BOND) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_BOND_SETTING_NAME, NM_LINK_TYPE_BOND); dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_bond); diff --git a/src/devices/nm-device-bridge.c b/src/devices/nm-device-bridge.c index a785fd2d11..52d807d770 100644 --- a/src/devices/nm-device-bridge.c +++ b/src/devices/nm-device-bridge.c @@ -507,7 +507,7 @@ nm_device_bridge_class_init (NMDeviceBridgeClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_BRIDGE_SETTING_NAME, NM_LINK_TYPE_BRIDGE) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_BRIDGE_SETTING_NAME, NM_LINK_TYPE_BRIDGE); dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_bridge); diff --git a/src/devices/nm-device-dummy.c b/src/devices/nm-device-dummy.c index 4b19b80c1d..fe805cf9c5 100644 --- a/src/devices/nm-device-dummy.c +++ b/src/devices/nm-device-dummy.c @@ -173,7 +173,7 @@ nm_device_dummy_class_init (NMDeviceDummyClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_DUMMY) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_DUMMY); dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_dummy); diff --git a/src/devices/nm-device-ethernet.c b/src/devices/nm-device-ethernet.c index 54d3dec3af..d6b3d4e20d 100644 --- a/src/devices/nm-device-ethernet.c +++ b/src/devices/nm-device-ethernet.c @@ -1754,7 +1754,7 @@ nm_device_ethernet_class_init (NMDeviceEthernetClass *klass) g_type_class_add_private (object_class, sizeof (NMDeviceEthernetPrivate)); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_WIRED_SETTING_NAME, NM_LINK_TYPE_ETHERNET) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_WIRED_SETTING_NAME, NM_LINK_TYPE_ETHERNET); object_class->dispose = dispose; object_class->finalize = finalize; diff --git a/src/devices/nm-device-generic.c b/src/devices/nm-device-generic.c index 6c59eed8cd..7d32589c6f 100644 --- a/src/devices/nm-device-generic.c +++ b/src/devices/nm-device-generic.c @@ -222,7 +222,7 @@ nm_device_generic_class_init (NMDeviceGenericClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_GENERIC_SETTING_NAME, NM_LINK_TYPE_ANY) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_GENERIC_SETTING_NAME, NM_LINK_TYPE_ANY); object_class->constructor = constructor; object_class->dispose = dispose; diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c index 39de0c868e..eeb33b231e 100644 --- a/src/devices/nm-device-infiniband.c +++ b/src/devices/nm-device-infiniband.c @@ -369,7 +369,7 @@ nm_device_infiniband_class_init (NMDeviceInfinibandClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_INFINIBAND_SETTING_NAME, NM_LINK_TYPE_INFINIBAND) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_INFINIBAND_SETTING_NAME, NM_LINK_TYPE_INFINIBAND); object_class->get_property = get_property; object_class->set_property = set_property; diff --git a/src/devices/nm-device-macsec.c b/src/devices/nm-device-macsec.c index c03436072a..9b691b8dc1 100644 --- a/src/devices/nm-device-macsec.c +++ b/src/devices/nm-device-macsec.c @@ -843,7 +843,7 @@ nm_device_macsec_class_init (NMDeviceMacsecClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_MACSEC) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_MACSEC); object_class->get_property = get_property; object_class->dispose = dispose; diff --git a/src/devices/nm-device-macvlan.c b/src/devices/nm-device-macvlan.c index 49c1f6eb88..f1f185c8a7 100644 --- a/src/devices/nm-device-macvlan.c +++ b/src/devices/nm-device-macvlan.c @@ -495,7 +495,7 @@ nm_device_macvlan_class_init (NMDeviceMacvlanClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_MACVLAN, NM_LINK_TYPE_MACVTAP) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_MACVLAN, NM_LINK_TYPE_MACVTAP); object_class->get_property = get_property; object_class->set_property = set_property; diff --git a/src/devices/nm-device-ppp.c b/src/devices/nm-device-ppp.c index e639f23fbe..f1c5a64007 100644 --- a/src/devices/nm-device-ppp.c +++ b/src/devices/nm-device-ppp.c @@ -277,7 +277,7 @@ nm_device_ppp_class_init (NMDevicePppClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_PPPOE_SETTING_NAME, NM_LINK_TYPE_PPP) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_PPPOE_SETTING_NAME, NM_LINK_TYPE_PPP); object_class->dispose = dispose; diff --git a/src/devices/nm-device-private.h b/src/devices/nm-device-private.h index edfb91ecf6..d6a19f0dc2 100644 --- a/src/devices/nm-device-private.h +++ b/src/devices/nm-device-private.h @@ -131,11 +131,14 @@ void nm_device_commit_mtu (NMDevice *self); /*****************************************************************************/ #define NM_DEVICE_CLASS_DECLARE_TYPES(klass, conn_type, ...) \ - NM_DEVICE_CLASS (klass)->connection_type_supported = conn_type; \ - { \ - static const NMLinkType link_types[] = { __VA_ARGS__, NM_LINK_TYPE_NONE }; \ - NM_DEVICE_CLASS (klass)->link_types = link_types; \ - } + G_STMT_START { \ + NM_DEVICE_CLASS (klass)->connection_type_supported = conn_type; \ + { \ + static const NMLinkType link_types[] = { __VA_ARGS__, NM_LINK_TYPE_NONE }; \ + \ + NM_DEVICE_CLASS (klass)->link_types = link_types; \ + } \ + } G_STMT_END gboolean _nm_device_hash_check_invalid_keys (GHashTable *hash, const char *setting_name, GError **error, const char **whitelist); diff --git a/src/devices/nm-device-tun.c b/src/devices/nm-device-tun.c index d8930e0fdb..1c95b84518 100644 --- a/src/devices/nm-device-tun.c +++ b/src/devices/nm-device-tun.c @@ -430,7 +430,7 @@ nm_device_tun_class_init (NMDeviceTunClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_TUN) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_TUN); object_class->get_property = get_property; diff --git a/src/devices/nm-device-veth.c b/src/devices/nm-device-veth.c index 186173eb88..885eef59bd 100644 --- a/src/devices/nm-device-veth.c +++ b/src/devices/nm-device-veth.c @@ -153,7 +153,7 @@ nm_device_veth_class_init (NMDeviceVethClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_VETH) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_VETH); object_class->get_property = get_property; diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c index 4cd7f768d8..ddd95592a0 100644 --- a/src/devices/nm-device-vlan.c +++ b/src/devices/nm-device-vlan.c @@ -601,7 +601,7 @@ nm_device_vlan_class_init (NMDeviceVlanClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_VLAN_SETTING_NAME, NM_LINK_TYPE_VLAN) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_VLAN_SETTING_NAME, NM_LINK_TYPE_VLAN); object_class->get_property = get_property; diff --git a/src/devices/nm-device-vxlan.c b/src/devices/nm-device-vxlan.c index 3b29110adc..30436ed2bc 100644 --- a/src/devices/nm-device-vxlan.c +++ b/src/devices/nm-device-vxlan.c @@ -577,7 +577,7 @@ nm_device_vxlan_class_init (NMDeviceVxlanClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_VXLAN) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_VXLAN); object_class->get_property = get_property; diff --git a/src/devices/nm-device-wpan.c b/src/devices/nm-device-wpan.c index c91f87db7f..59e9efbfc4 100644 --- a/src/devices/nm-device-wpan.c +++ b/src/devices/nm-device-wpan.c @@ -213,7 +213,7 @@ nm_device_wpan_class_init (NMDeviceWpanClass *klass) NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_WPAN) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NULL, NM_LINK_TYPE_WPAN); dbus_object_class->interface_infos = NM_DBUS_INTERFACE_INFOS (&interface_info_device_wpan); diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c index 37233a7521..ee4f6aecd1 100644 --- a/src/devices/team/nm-device-team.c +++ b/src/devices/team/nm-device-team.c @@ -913,7 +913,7 @@ nm_device_team_class_init (NMDeviceTeamClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_TEAM_SETTING_NAME, NM_LINK_TYPE_TEAM) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_TEAM_SETTING_NAME, NM_LINK_TYPE_TEAM); object_class->constructed = constructed; object_class->dispose = dispose; diff --git a/src/devices/wifi/nm-device-iwd.c b/src/devices/wifi/nm-device-iwd.c index ed8458c353..9c11cbafd3 100644 --- a/src/devices/wifi/nm-device-iwd.c +++ b/src/devices/wifi/nm-device-iwd.c @@ -1954,7 +1954,7 @@ nm_device_iwd_class_init (NMDeviceIwdClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_WIRELESS_SETTING_NAME, NM_LINK_TYPE_WIFI) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_WIRELESS_SETTING_NAME, NM_LINK_TYPE_WIFI); object_class->get_property = get_property; object_class->set_property = set_property; diff --git a/src/devices/wifi/nm-device-olpc-mesh.c b/src/devices/wifi/nm-device-olpc-mesh.c index 2a11b0cbc8..8cc056e903 100644 --- a/src/devices/wifi/nm-device-olpc-mesh.c +++ b/src/devices/wifi/nm-device-olpc-mesh.c @@ -517,7 +517,7 @@ nm_device_olpc_mesh_class_init (NMDeviceOlpcMeshClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_OLPC_MESH_SETTING_NAME, NM_LINK_TYPE_OLPC_MESH) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_OLPC_MESH_SETTING_NAME, NM_LINK_TYPE_OLPC_MESH); object_class->constructed = constructed; object_class->get_property = get_property; diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c index 8a0218fea0..e8d63c37e1 100644 --- a/src/devices/wifi/nm-device-wifi.c +++ b/src/devices/wifi/nm-device-wifi.c @@ -3313,7 +3313,7 @@ nm_device_wifi_class_init (NMDeviceWifiClass *klass) NMDBusObjectClass *dbus_object_class = NM_DBUS_OBJECT_CLASS (klass); NMDeviceClass *device_class = NM_DEVICE_CLASS (klass); - NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_WIRELESS_SETTING_NAME, NM_LINK_TYPE_WIFI) + NM_DEVICE_CLASS_DECLARE_TYPES (klass, NM_SETTING_WIRELESS_SETTING_NAME, NM_LINK_TYPE_WIFI); object_class->constructed = constructed; object_class->get_property = get_property;