about summary refs log tree commit diff
diff options
context:
space:
mode:
authorKang Seonghoon <public+git@mearie.org>2015-02-28 01:42:51 +0900
committerKang Seonghoon <public+git@mearie.org>2015-02-28 01:42:51 +0900
commitff678ea3f4f0e0ec2fd552db57d57889470ee7f5 (patch)
tree8c493eeafc097184b2ca965878ba30817fa02a5c
parent587f10aa36a1fcab73c6012125f6a3a9a8104412 (diff)
downloadrust-ff678ea3f4f0e0ec2fd552db57d57889470ee7f5.tar.gz
rust-ff678ea3f4f0e0ec2fd552db57d57889470ee7f5.zip
std: Fixed backtrace warnings and tests for non-Linux platforms.
- Fixed a couple of dead code warnings in std::sys::backtrace.
- Made `backtrace-debuginfo` test a no-op on non-Linux platforms.
- `backtrace-debuginfo` is no longer tested on pretty-rpass.
-rw-r--r--src/libstd/sys/unix/backtrace.rs3
-rw-r--r--src/test/run-pass/backtrace-debuginfo.rs30
2 files changed, 28 insertions, 5 deletions
diff --git a/src/libstd/sys/unix/backtrace.rs b/src/libstd/sys/unix/backtrace.rs
index 8bc3ffd6ed1..09630f8f584 100644
--- a/src/libstd/sys/unix/backtrace.rs
+++ b/src/libstd/sys/unix/backtrace.rs
@@ -224,7 +224,7 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
 
 #[cfg(any(target_os = "macos", target_os = "ios"))]
 fn print(w: &mut Writer, idx: int, addr: *mut libc::c_void,
-         symaddr: *mut libc::c_void) -> IoResult<()> {
+         _symaddr: *mut libc::c_void) -> IoResult<()> {
     use intrinsics;
     #[repr(C)]
     struct Dl_info {
@@ -450,6 +450,7 @@ fn output(w: &mut Writer, idx: int, addr: *mut libc::c_void,
     w.write_all(&['\n' as u8])
 }
 
+#[allow(dead_code)]
 fn output_fileline(w: &mut Writer, file: &[u8], line: libc::c_int,
                    more: bool) -> IoResult<()> {
     let file = str::from_utf8(file).ok().unwrap_or("<unknown>");
diff --git a/src/test/run-pass/backtrace-debuginfo.rs b/src/test/run-pass/backtrace-debuginfo.rs
index a6be6f985fc..a2a63d44a78 100644
--- a/src/test/run-pass/backtrace-debuginfo.rs
+++ b/src/test/run-pass/backtrace-debuginfo.rs
@@ -9,6 +9,7 @@
 // except according to those terms.
 
 // compile-flags:-g
+// ignore-pretty as this critically relies on line numbers
 
 use std::old_io::stderr;
 use std::env;
@@ -19,14 +20,35 @@ macro_rules! pos {
     () => ((file!(), line!()))
 }
 
+#[cfg(all(unix,
+          not(target_os = "macos"),
+          not(target_os = "ios"),
+          not(target_os = "android"),
+          not(all(target_os = "linux", target_arch = "arm"))))]
+macro_rules! dump_and_die {
+    ($($pos:expr),*) => ({
+        // FIXME(#18285): we cannot include the current position because
+        // the macro span takes over the last frame's file/line.
+        dump_filelines(&[$($pos),*]);
+        panic!();
+    })
+}
+
+// this does not work on Windows, Android, OSX or iOS
+#[cfg(any(not(unix),
+          target_os = "macos",
+          target_os = "ios",
+          target_os = "android",
+          all(target_os = "linux", target_arch = "arm")))]
+macro_rules! dump_and_die {
+    ($($pos:expr),*) => ({ let _ = [$($pos),*]; })
+}
+
 // we can't use a function as it will alter the backtrace
 macro_rules! check {
     ($counter:expr; $($pos:expr),*) => ({
         if *$counter == 0 {
-            // FIXME(#18285): we cannot include the current position because
-            // the macro span takes over the last frame's file/line.
-            dump_filelines(&[$($pos),*]);
-            panic!();
+            dump_and_die!($($pos),*)
         } else {
             *$counter -= 1;
         }