Fix XFailed test x86stdcall

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
This commit is contained in:
Leah Hanson 2013-11-08 10:59:37 -06:00 committed by Leah Hanson
parent 3851f908d1
commit 69768f7c94

View file

@ -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.
//
@ -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);
}
}