Skip to content

Commit

Permalink
Fix XFailed test x86stdcall
Browse files Browse the repository at this point in the history
There was a syntax error because the `extern "stdcall"` was outside the module instead of inside it.

* moved `extern` inside module
* change `extern "stdcall"` to `extern "system"`
* change `cfg(target_os="win32")` to `cfg(windows)`
* updated copyright dates
* changed log(error, ...) => info!(....)
* added `pub` keyword to kernel32 functions
  • Loading branch information
astrieanna committed Nov 18, 2013
1 parent 3851f90 commit 69768f7
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/test/run-pass/x86stdcall.rs
@@ -1,4 +1,4 @@
// Copyright 2012 The Rust Project Developers. See the COPYRIGHT
// Copyright 2012-2013 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
Expand All @@ -9,22 +9,23 @@
// except according to those terms.

// GetLastError doesn't seem to work with stack switching
// xfail-test

#[cfg(target_os = "win32")]
extern "stdcall" mod kernel32 {
fn SetLastError(err: uint);
fn GetLastError() -> uint;
#[cfg(windows)]
mod kernel32 {
extern "system" {
pub fn SetLastError(err: uint);
pub fn GetLastError() -> uint;
}
}


#[cfg(target_os = "win32")]
#[cfg(windows)]
pub fn main() {
unsafe {
let expected = 1234u;
kernel32::SetLastError(expected);
let actual = kernel32::GetLastError();
log(error, actual);
info!("actual = {}", actual);
assert_eq!(expected, actual);
}
}
Expand Down

5 comments on commit 69768f7

@bors
Copy link
Contributor

@bors bors commented on 69768f7 Nov 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from huonw
at astrieanna@69768f7

@bors
Copy link
Contributor

@bors bors commented on 69768f7 Nov 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging astrieanna/rust/fix-x86stdcall = 69768f7 into auto

@bors
Copy link
Contributor

@bors bors commented on 69768f7 Nov 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

astrieanna/rust/fix-x86stdcall = 69768f7 merged ok, testing candidate = 15a8e62

@bors
Copy link
Contributor

@bors bors commented on 69768f7 Nov 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on 69768f7 Nov 18, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 15a8e62

Please sign in to comment.