Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/libstd/rt/libunwind.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,26 @@ extern "C" {
pub fn _Unwind_Backtrace(trace: _Unwind_Trace_Fn,
trace_argument: *libc::c_void)
-> _Unwind_Reason_Code;
#[cfg(not(target_os = "android"))]
#[cfg(stage0, not(target_os = "android"))]
pub fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t;
#[cfg(not(target_os = "android"))]
#[cfg(stage0, not(target_os = "android"))]
pub fn _Unwind_FindEnclosingFunction(pc: *libc::c_void) -> *libc::c_void;

#[cfg(not(stage0),
not(target_os = "android"),
not(target_os = "linux", target_arch = "arm"))]
pub fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t;
#[cfg(not(stage0),
not(target_os = "android"),
not(target_os = "linux", target_arch = "arm"))]
pub fn _Unwind_FindEnclosingFunction(pc: *libc::c_void) -> *libc::c_void;
}

// On android, the function _Unwind_GetIP is a macro, and this is the expansion
// of the macro. This is all copy/pasted directly from the header file with the
// definition of _Unwind_GetIP.
#[cfg(target_os = "android")]
#[cfg(target_os = "linux", target_os = "arm")]
pub unsafe fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t {
#[repr(C)]
enum _Unwind_VRS_Result {
Expand Down Expand Up @@ -151,6 +161,7 @@ pub unsafe fn _Unwind_GetIP(ctx: *_Unwind_Context) -> libc::uintptr_t {

// This function also doesn't exist on android, so make it a no-op
#[cfg(target_os = "android")]
#[cfg(target_os = "linux", target_os = "arm")]
pub unsafe fn _Unwind_FindEnclosingFunction(pc: *libc::c_void) -> *libc::c_void{
pc
}
4 changes: 2 additions & 2 deletions src/libsyntax/attr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,9 +317,9 @@ pub fn test_cfg<AM: AttrMetaMethods, It: Iterator<AM>>
debug!("not!");
// inside #[cfg(not(...))], so these need to all
// not match.
not_cfgs.iter().all(|mi| {
!not_cfgs.iter().all(|mi| {
debug!("cfg(not({}[...]))", mi.name());
!contains(cfg, *mi)
contains(cfg, *mi)
})
}
_ => contains(cfg, *cfg_mi)
Expand Down
10 changes: 9 additions & 1 deletion src/test/run-pass/cfgs-on-items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,24 @@
fn foo1() -> int { 1 }

// !fooA AND !bar
#[cfg(not(fooA, bar))]
#[cfg(not(fooA), not(bar))]
fn foo2() -> int { 2 }

// fooC OR (fooB AND !bar)
#[cfg(fooC)]
#[cfg(fooB, not(bar))]
fn foo2() -> int { 3 }

// fooA AND bar
#[cfg(fooA, bar)]
fn foo3() -> int { 2 }

// !(fooA AND bar)
#[cfg(not(fooA, bar))]
fn foo3() -> int { 3 }

pub fn main() {
assert_eq!(1, foo1());
assert_eq!(3, foo2());
assert_eq!(3, foo3());
}