summaryrefslogtreecommitdiff
path: root/pkg/iproute2/patch/0004-Don-t-use-statement-expressions-on-non-GNU-compilers.patch
blob: 218d98aaacb02508abfbe190453fa32f7d3930d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
From d1f061dee88d2ea01601d6d2742635c66985ca61 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Sun, 16 Jun 2019 12:16:18 -0700
Subject: [PATCH] Don't use statement expressions on non-GNU compilers

---
 include/list.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/list.h b/include/list.h
index 5d86b131..7108cea7 100644
--- a/include/list.h
+++ b/include/list.h
@@ -5,9 +5,14 @@
 
 #include <stddef.h>
 
+#ifdef __GNUC__
 #define container_of(ptr, type, member) ({			\
 	const typeof( ((type *)0)->member ) *__mptr = (ptr);	\
 	(type *)( (char *)__mptr - offsetof(type,member) );})
+#else
+#define container_of(ptr, type, member) (			\
+	(type *)( (char *)(ptr) - offsetof(type,member) ))
+#endif
 
 struct list_head {
 	struct list_head *next, *prev;
-- 
2.20.1