You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1.1 KiB

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