|
|
ac385c |
From 1b74597f9327ae2d763ae8863ac784a5a0d6bb93 Mon Sep 17 00:00:00 2001
|
|
|
ac385c |
From: Peter Jones <pjones@redhat.com>
|
|
|
ac385c |
Date: Mon, 13 Mar 2017 13:36:55 -0400
|
|
|
ac385c |
Subject: [PATCH 2/3] Don't use _Generic because gcc 4.x doesn't have it...
|
|
|
ac385c |
|
|
|
ac385c |
Signed-off-by: Peter Jones <pjones@redhat.com>
|
|
|
ac385c |
---
|
|
|
ac385c |
src/util.h | 17 ++++++++++++++++-
|
|
|
ac385c |
1 file changed, 16 insertions(+), 1 deletion(-)
|
|
|
ac385c |
|
|
|
ac385c |
diff --git a/src/util.h b/src/util.h
|
|
|
ac385c |
index 0af7dbe..7ad6ce4 100644
|
|
|
ac385c |
--- a/src/util.h
|
|
|
ac385c |
+++ b/src/util.h
|
|
|
ac385c |
@@ -105,14 +105,29 @@
|
|
|
ac385c |
})
|
|
|
ac385c |
#endif
|
|
|
ac385c |
|
|
|
ac385c |
+#if defined(__GNUC__) && defined(__GNUC_MINOR__)
|
|
|
ac385c |
+#if __GNUC__ >= 5 && __GNUC_MINOR__ >= 1
|
|
|
ac385c |
#define add(a, b, c) _Generic((c), \
|
|
|
ac385c |
int *: int_add(a,b,c), \
|
|
|
ac385c |
long *: long_add(a,b,c), \
|
|
|
ac385c |
unsigned long *: ulong_add(a,b,c))
|
|
|
ac385c |
-
|
|
|
ac385c |
#define mult(a, b, c) _Generic((c), \
|
|
|
ac385c |
long *: long_mult(a,b,c), \
|
|
|
ac385c |
unsigned long *: ulong_mult(a,b,c))
|
|
|
ac385c |
+#endif
|
|
|
ac385c |
+#endif
|
|
|
ac385c |
+
|
|
|
ac385c |
+#ifndef add
|
|
|
ac385c |
+#define add(a, b, c) ({ \
|
|
|
ac385c |
+ (*(c)) = ((a) + (b)); \
|
|
|
ac385c |
+ })
|
|
|
ac385c |
+#endif
|
|
|
ac385c |
+#ifndef mult
|
|
|
ac385c |
+#define mult(a, b, c) ({ \
|
|
|
ac385c |
+ (*(c)) = ((a) * (b)); \
|
|
|
ac385c |
+ })
|
|
|
ac385c |
+#endif
|
|
|
ac385c |
+
|
|
|
ac385c |
|
|
|
ac385c |
static inline int
|
|
|
ac385c |
__attribute__((unused))
|
|
|
ac385c |
--
|
|
|
ac385c |
2.9.3
|
|
|
ac385c |
|