libunwind-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Libunwind-devel] [PATCH] Add check before include execinfo.h


From: Kito Cheng
Subject: [Libunwind-devel] [PATCH] Add check before include execinfo.h
Date: Wed, 5 Oct 2011 01:47:16 +0800

---
 tests/Gperf-trace.c    |    6 +++++-
 tests/Gtest-nocalloc.c |    6 +++++-
 tests/rs-race.c        |    6 +++++-
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/tests/Gperf-trace.c b/tests/Gperf-trace.c
index 87dd5b2..2719015 100644
--- a/tests/Gperf-trace.c
+++ b/tests/Gperf-trace.c
@@ -21,7 +21,11 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 
AN ACTION
 OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.  */
 
-#include <execinfo.h>
+#if HAVE_EXECINFO_H
+# include <execinfo.h>
+#else
+  extern int backtrace (void **, int);
+#endif
 #include <memory.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tests/Gtest-nocalloc.c b/tests/Gtest-nocalloc.c
index 6f61b96..ab205b9 100644
--- a/tests/Gtest-nocalloc.c
+++ b/tests/Gtest-nocalloc.c
@@ -25,7 +25,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 # include "config.h"
 #endif
 
-#include <execinfo.h>  /* for backtrace  */
+#if HAVE_EXECINFO_H
+# include <execinfo.h>
+#else
+  extern int backtrace (void **, int);
+#endif
 #include <unistd.h>
 #include <stdio.h>
 #include <stdlib.h>
diff --git a/tests/rs-race.c b/tests/rs-race.c
index c67584c..53e3204 100644
--- a/tests/rs-race.c
+++ b/tests/rs-race.c
@@ -27,7 +27,11 @@ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 
SOFTWARE.  */
 #include <pthread.h>
 #include <stdlib.h>
 #include <libunwind.h>
-#include <execinfo.h>
+#if HAVE_EXECINFO_H
+# include <execinfo.h>
+#else
+  extern int backtrace (void **, int);
+#endif
 
 /* ITERS=1000, NTHREAD=10 caught some bugs in the past */
 #ifndef ITERS 
-- 
1.7.4.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]