]> git.pld-linux.org Git - packages/NetworkManager.git/blame - NetworkManager-ovs_fix.patch
up to 1.10.4
[packages/NetworkManager.git] / NetworkManager-ovs_fix.patch
CommitLineData
4a6708fd
JP
1From 5159c34ea8923bf0c17fd31e183c5803b72b97f3 Mon Sep 17 00:00:00 2001
2From: Thomas Haller <thaller@redhat.com>
3Date: Mon, 5 Feb 2018 13:10:24 +0100
4Subject: ovs: fix compiler error for passing NMDevice pointer to
5 NM_DEVICE_OVS_INTERFACE_GET_PRIVATE()
6MIME-Version: 1.0
7Content-Type: text/plain; charset=UTF-8
8Content-Transfer-Encoding: 8bit
9
10NM_DEVICE_OVS_INTERFACE_GET_PRIVATE() is implemented via the _NM_GET_PRIVATE()
11macro. This macro uses C11's _Generic() to provide additional compiler checks
12when casting from an incompatible pointer type.
13
14As such,
15
16 NMDevice *device = ...;
17 NMDeviceOvsInterfacePrivate *priv;
18
19 priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE (device);
20
21causes a compilation error:
22
23 error: ‘_Generic’ selector of type ‘NMDevice * {aka struct _NMDevice *}’ is not compatible with any association
24
25One workaround would be to cast the pointer first:
26
27 priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE ((NMDeviceOvsInterface *) device);
28
29A better fix is to mark NMDevice as a compatible pointer in _NM_GET_PRIVATE(),
30which this patch does.
31
32Previously, this went unnoticed, because due to bug "a43bf3388 build: fix configure
33check for CC support of _Generic() and __auto_type", we failed to detect support
34for _Generic() when compiling with -Werror. That essentially disables this check,
35and NM_DEVICE_OVS_INTERFACE_GET_PRIVATE() would do a direct cast.
36
37A workaround for this build failure might be to build with -Werror, which accidentally
38results in not using _Generic().
39
40https://bugzilla.gnome.org/show_bug.cgi?id=793183
41
42Fixes: 8ad310f8e3cb0157cfa5fa8ff10f313555cf8e3c
43(cherry picked from commit 782578122c6cb23bdbee0b01eddceee1b967a673)
44---
45 src/devices/ovs/nm-device-ovs-interface.c | 2 +-
46 1 file changed, 1 insertion(+), 1 deletion(-)
47
48diff --git a/src/devices/ovs/nm-device-ovs-interface.c b/src/devices/ovs/nm-device-ovs-interface.c
49index e746a3f..ce32c2d 100644
50--- a/src/devices/ovs/nm-device-ovs-interface.c
51+++ b/src/devices/ovs/nm-device-ovs-interface.c
52@@ -50,7 +50,7 @@ struct _NMDeviceOvsInterfaceClass {
53
54 G_DEFINE_TYPE (NMDeviceOvsInterface, nm_device_ovs_interface, NM_TYPE_DEVICE)
55
56-#define NM_DEVICE_OVS_INTERFACE_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDeviceOvsInterface, NM_IS_DEVICE_OVS_INTERFACE)
57+#define NM_DEVICE_OVS_INTERFACE_GET_PRIVATE(self) _NM_GET_PRIVATE (self, NMDeviceOvsInterface, NM_IS_DEVICE_OVS_INTERFACE, NMDevice)
58
59 /*****************************************************************************/
60
61--
62cgit v1.1
63
This page took 0.067584 seconds and 4 git commands to generate.