summaryrefslogtreecommitdiff
path: root/pkg/util-linux/patch/0002-Avoid-a-few-unnecessary-statement-expressions.patch
blob: e9999a1e52a5e6ab72bc76fd822b0c62e6bef39a (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
From edb05302e2c747253afd4698bc445e36c8726306 Mon Sep 17 00:00:00 2001
From: Michael Forney <mforney@mforney.org>
Date: Tue, 18 Jun 2019 02:29:07 -0700
Subject: [PATCH] Avoid a few unnecessary statement expressions

---
 include/c.h | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/include/c.h b/include/c.h
index b891ad480..b420b5187 100644
--- a/include/c.h
+++ b/include/c.h
@@ -176,9 +176,8 @@
  * @member:	the name of the member within the struct.
  */
 #ifndef container_of
-#define container_of(ptr, type, member) __extension__ ({	\
-	const __typeof__( ((type *)0)->member ) *__mptr = (ptr); \
-	(type *)( (char *)__mptr - offsetof(type,member) );})
+#define container_of(ptr, type, member)		\
+	((type *)( (char *)ptr - offsetof(type,member) ))
 #endif
 
 #ifndef HAVE_PROGRAM_INVOCATION_SHORT_NAME
@@ -256,11 +255,11 @@ errmsg(char doexit, int excode, char adderr, const char *fmt, ...)
 
 /* Don't use inline function to avoid '#include "nls.h"' in c.h
  */
-#define errtryhelp(eval) __extension__ ({ \
+#define errtryhelp(eval) do { \
 	fprintf(stderr, _("Try '%s --help' for more information.\n"), \
 			program_invocation_short_name); \
 	exit(eval); \
-})
+} while (0)
 
 /* After failed execvp() */
 #define EX_EXEC_FAILED		126	/* Program located, but not usable. */
@@ -387,10 +386,10 @@ static inline int xusleep(useconds_t usec)
 
 #define UTIL_LINUX_VERSION _("%s from %s\n"), program_invocation_short_name, PACKAGE_STRING
 
-#define print_version(eval) __extension__ ({ \
+#define print_version(eval) do { \
 		printf(UTIL_LINUX_VERSION); \
 		exit(eval); \
-})
+} while (0)
 
 /*
  * seek stuff
-- 
2.31.1