This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH 6/6] Provide assert_perror when it's not defined


assert_perror is a GNU extension and is not provided by uClibc. Provide
definition when that macro is not available.

Signed-off-by: Max Filippov <jcmvbkbc@gmail.com>
---
 tests/ChangeLog         |  7 +++++++
 tests/backtrace-child.c | 13 +++++++++++++
 tests/backtrace-data.c  | 12 ++++++++++++
 tests/backtrace-dwarf.c | 12 ++++++++++++
 tests/backtrace.c       | 12 ++++++++++++
 5 files changed, 56 insertions(+)

diff --git a/tests/ChangeLog b/tests/ChangeLog
index f5d9a1b..9b1b18f 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,3 +1,10 @@
+2015-05-04  Max Filippov  <jcmvbkbc@gmail.com>
+
+	* backtrace-child.c (assert_perror): Provide conditional definition.
+	* backtrace-data.c: Likewise.
+	* backtrace-dwarf.c: Likewise.
+	* backtrace.c: Likewise.
+
 2015-05-04  Daniel Guzman  <daniel@guzman.io>
 
 	* Makefile.am (line2addr_LDADD, addrscopes_LDADD, funcscopes_LDADD)
diff --git a/tests/backtrace-child.c b/tests/backtrace-child.c
index 788801c..2f955e0 100644
--- a/tests/backtrace-child.c
+++ b/tests/backtrace-child.c
@@ -79,6 +79,19 @@
 #include <stdio.h>
 #include <unistd.h>
 
+#ifndef assert_perror
+#define assert_perror(err) \
+  do \
+    { \
+      if (err) \
+	{ \
+	  fprintf (stderr, "%s:%d %s\n", __FILE__, __LINE__, strerror (err)); \
+	  abort (); \
+	} \
+    } \
+  while (0)
+#endif
+
 #ifndef __linux__
 
 int
diff --git a/tests/backtrace-data.c b/tests/backtrace-data.c
index 01c1c00..f2ef44c 100644
--- a/tests/backtrace-data.c
+++ b/tests/backtrace-data.c
@@ -40,6 +40,18 @@
 #include <string.h>
 #include ELFUTILS_HEADER(dwfl)
 
+#ifndef assert_perror
+#define assert_perror(err) \
+  do \
+    { \
+      if (err) \
+	{ \
+	  fprintf (stderr, "%s:%d %s\n", __FILE__, __LINE__, strerror (err)); \
+	  abort (); \
+	} \
+    } \
+  while (0)
+#endif
 #if !defined(__x86_64__) || !defined(__linux__)
 
 int
diff --git a/tests/backtrace-dwarf.c b/tests/backtrace-dwarf.c
index fbcb22e..27aa4a9 100644
--- a/tests/backtrace-dwarf.c
+++ b/tests/backtrace-dwarf.c
@@ -29,6 +29,18 @@
 #include <sys/wait.h>
 #include ELFUTILS_HEADER(dwfl)
 
+#ifndef assert_perror
+#define assert_perror(err) \
+  do \
+    { \
+      if (err) \
+	{ \
+	  fprintf (stderr, "%s:%d %s\n", __FILE__, __LINE__, strerror (err)); \
+	  abort (); \
+	} \
+    } \
+  while (0)
+#endif
 #ifndef __linux__
 
 int
diff --git a/tests/backtrace.c b/tests/backtrace.c
index 8b19b94..9660560 100644
--- a/tests/backtrace.c
+++ b/tests/backtrace.c
@@ -38,6 +38,18 @@
 #include <argp.h>
 #include ELFUTILS_HEADER(dwfl)
 
+#ifndef assert_perror
+#define assert_perror(err) \
+  do \
+    { \
+      if (err) \
+	{ \
+	  fprintf (stderr, "%s:%d %s\n", __FILE__, __LINE__, strerror (err)); \
+	  abort (); \
+	} \
+    } \
+  while (0)
+#endif
 #ifndef __linux__
 
 int
-- 
1.8.1.4


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]