diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs index a8e12ed4b1928..859a2bce9728e 100644 --- a/src/liblibc/lib.rs +++ b/src/liblibc/lib.rs @@ -507,8 +507,8 @@ pub mod types { pub mod c99 { pub type c_longlong = i64; pub type c_ulonglong = u64; - pub type intptr_t = int; - pub type uintptr_t = uint; + pub type intptr_t = i32; + pub type uintptr_t = u32; } #[cfg(target_arch = "x86")] #[cfg(target_arch = "mips")] @@ -702,8 +702,8 @@ pub mod types { pub mod c99 { pub type c_longlong = i64; pub type c_ulonglong = u64; - pub type intptr_t = int; - pub type uintptr_t = uint; + pub type intptr_t = i64; + pub type uintptr_t = u64; } pub mod posix88 { pub type off_t = i64; @@ -911,8 +911,8 @@ pub mod types { pub mod c99 { pub type c_longlong = i64; pub type c_ulonglong = u64; - pub type intptr_t = int; - pub type uintptr_t = uint; + pub type intptr_t = i64; + pub type uintptr_t = u64; } pub mod posix88 { pub type off_t = i64; @@ -1124,8 +1124,8 @@ pub mod types { pub mod c99 { pub type c_longlong = i64; pub type c_ulonglong = u64; - pub type intptr_t = int; - pub type uintptr_t = uint; + pub type intptr_t = i64; + pub type uintptr_t = u64; } pub mod posix88 { pub type off_t = i64; @@ -1243,9 +1243,10 @@ pub mod types { } pub mod bsd44 { - use types::os::arch::c95::{c_char, c_int, c_uint, size_t, uintptr_t}; + use types::os::arch::c95::{c_char, c_int, c_uint, size_t}; + use types::os::arch::c99::uintptr_t; - pub type SOCKET = uint; + pub type SOCKET = uintptr_t; pub type socklen_t = c_int; pub type sa_family_t = u16; pub type in_port_t = u16; @@ -1356,8 +1357,8 @@ pub mod types { pub mod c99 { pub type c_longlong = i64; pub type c_ulonglong = u64; - pub type intptr_t = int; - pub type uintptr_t = uint; + pub type intptr_t = i32; + pub type uintptr_t = u32; } pub mod posix88 { @@ -1486,7 +1487,7 @@ pub mod types { pub dwPageSize: DWORD, pub lpMinimumApplicationAddress: LPVOID, pub lpMaximumApplicationAddress: LPVOID, - pub dwActiveProcessorMask: uint, + pub dwActiveProcessorMask: uintptr_t, pub dwNumberOfProcessors: DWORD, pub dwProcessorType: DWORD, pub dwAllocationGranularity: DWORD, @@ -1720,8 +1721,8 @@ pub mod types { pub mod c99 { pub type c_longlong = i64; pub type c_ulonglong = u64; - pub type intptr_t = int; - pub type uintptr_t = uint; + pub type intptr_t = i32; + pub type uintptr_t = u32; } pub mod posix88 { pub type off_t = i64; @@ -1821,8 +1822,8 @@ pub mod types { pub mod c99 { pub type c_longlong = i64; pub type c_ulonglong = u64; - pub type intptr_t = int; - pub type uintptr_t = uint; + pub type intptr_t = i64; + pub type uintptr_t = u64; } pub mod posix88 { pub type off_t = i64; @@ -4401,7 +4402,7 @@ pub mod funcs { pub fn glob(pattern: *const c_char, flags: c_int, errfunc: ::Nullable int>, + errno: c_int) -> int>, pglob: *mut glob_t); pub fn globfree(pglob: *mut glob_t); } diff --git a/src/libnative/io/c_unix.rs b/src/libnative/io/c_unix.rs index 1f8584cbd0960..d22ce25c778d7 100644 --- a/src/libnative/io/c_unix.rs +++ b/src/libnative/io/c_unix.rs @@ -235,6 +235,7 @@ mod signal { pub type sigset_t = u32; #[cfg(target_os = "freebsd")] #[cfg(target_os = "dragonfly")] + #[repr(C)] pub struct sigset_t { bits: [u32, ..4], } diff --git a/src/librustc/lint/builtin.rs b/src/librustc/lint/builtin.rs index ec25c27539bfd..80b4764014673 100644 --- a/src/librustc/lint/builtin.rs +++ b/src/librustc/lint/builtin.rs @@ -369,9 +369,9 @@ impl LintPass for CTypes { if !ty::is_ffi_safe(cx.tcx, tty) { cx.span_lint(CTYPES, ty.span, - "found enum type without foreign-function-safe + "found type without foreign-function-safe representation annotation in foreign module, consider \ - adding a #[repr(...)] attribute to the enumeration"); + adding a #[repr(...)] attribute to the type"); } } _ => () diff --git a/src/librustuv/uvll.rs b/src/librustuv/uvll.rs index c0f674d1eece8..e7b031c6b5180 100644 --- a/src/librustuv/uvll.rs +++ b/src/librustuv/uvll.rs @@ -378,14 +378,14 @@ pub unsafe fn free_req(v: *mut c_void) { #[test] fn handle_sanity_check() { unsafe { - assert_eq!(UV_HANDLE_TYPE_MAX as uint, rust_uv_handle_type_max()); + assert_eq!(UV_HANDLE_TYPE_MAX as libc::uintptr_t, rust_uv_handle_type_max()); } } #[test] fn request_sanity_check() { unsafe { - assert_eq!(UV_REQ_TYPE_MAX as uint, rust_uv_req_type_max()); + assert_eq!(UV_REQ_TYPE_MAX as libc::uintptr_t, rust_uv_req_type_max()); } } diff --git a/src/libstd/os.rs b/src/libstd/os.rs index d8eb0979190d4..7780c61e86671 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -59,7 +59,7 @@ use libc::c_char; /// Get the number of cores available pub fn num_cpus() -> uint { unsafe { - return rust_get_num_cpus(); + return rust_get_num_cpus() as uint; } extern { diff --git a/src/test/auxiliary/extern-crosscrate-source.rs b/src/test/auxiliary/extern-crosscrate-source.rs index 5c83b32791227..0e3b531e4581c 100644 --- a/src/test/auxiliary/extern-crosscrate-source.rs +++ b/src/test/auxiliary/extern-crosscrate-source.rs @@ -24,7 +24,7 @@ pub mod rustrt { } } -pub fn fact(n: uint) -> uint { +pub fn fact(n: libc::uintptr_t) -> libc::uintptr_t { unsafe { println!("n = {}", n); rustrt::rust_dbg_call(cb, n) @@ -32,9 +32,9 @@ pub fn fact(n: uint) -> uint { } pub extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1u { + if data == 1 { data } else { - fact(data - 1u) * data + fact(data - 1) * data } } diff --git a/src/test/compile-fail/issue-14309.rs b/src/test/compile-fail/issue-14309.rs index eb8e75eae785d..d4a40ade72c32 100644 --- a/src/test/compile-fail/issue-14309.rs +++ b/src/test/compile-fail/issue-14309.rs @@ -11,19 +11,19 @@ #![deny(ctypes)] #![allow(dead_code)] -struct A { //~ NOTE consider adding `#[repr(C)]` to this type - x: int +struct A { + x: i32 } #[repr(C, packed)] struct B { - x: int, + x: i32, y: A } #[repr(C)] struct C { - x: int + x: i32 } type A2 = A; @@ -37,13 +37,13 @@ struct D { } extern "C" { - fn foo(x: A); //~ ERROR found struct without FFI-safe representation used in FFI - fn bar(x: B); //~ ERROR FFI-safe + fn foo(x: A); //~ ERROR found type without foreign-function-safe + fn bar(x: B); //~ ERROR foreign-function-safe fn baz(x: C); - fn qux(x: A2); //~ ERROR FFI-safe - fn quux(x: B2); //~ ERROR FFI-safe + fn qux(x: A2); //~ ERROR foreign-function-safe + fn quux(x: B2); //~ ERROR foreign-function-safe fn corge(x: C2); - fn fred(x: D); //~ ERROR FFI-safe + fn fred(x: D); //~ ERROR foreign-function-safe } fn main() { } diff --git a/src/test/compile-fail/lint-ctypes-enum.rs b/src/test/compile-fail/lint-ctypes-enum.rs index d597006e29dd5..d45a3b027a794 100644 --- a/src/test/compile-fail/lint-ctypes-enum.rs +++ b/src/test/compile-fail/lint-ctypes-enum.rs @@ -18,9 +18,9 @@ enum T { E, F, G } extern { fn zf(x: Z); - fn uf(x: U); - fn bf(x: B); //~ ERROR found enum without FFI-safe - fn tf(x: T); //~ ERROR found enum without FFI-safe + fn uf(x: U); //~ ERROR found type without foreign-function-safe + fn bf(x: B); //~ ERROR found type without foreign-function-safe + fn tf(x: T); //~ ERROR found type without foreign-function-safe } pub fn main() { } diff --git a/src/test/run-pass/extern-call-deep.rs b/src/test/run-pass/extern-call-deep.rs index d05057ea2519b..93a5752d004aa 100644 --- a/src/test/run-pass/extern-call-deep.rs +++ b/src/test/run-pass/extern-call-deep.rs @@ -22,14 +22,14 @@ mod rustrt { } extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1u { + if data == 1 { data } else { - count(data - 1u) + 1u + count(data - 1) + 1 } } -fn count(n: uint) -> uint { +fn count(n: libc::uintptr_t) -> libc::uintptr_t { unsafe { println!("n = {}", n); rustrt::rust_dbg_call(cb, n) @@ -37,7 +37,7 @@ fn count(n: uint) -> uint { } pub fn main() { - let result = count(1000u); + let result = count(1000); println!("result = {}", result); - assert_eq!(result, 1000u); + assert_eq!(result, 1000); } diff --git a/src/test/run-pass/extern-call-deep2.rs b/src/test/run-pass/extern-call-deep2.rs index 654541dcde0be..bc5ccc30c527c 100644 --- a/src/test/run-pass/extern-call-deep2.rs +++ b/src/test/run-pass/extern-call-deep2.rs @@ -23,14 +23,14 @@ mod rustrt { } extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1u { + if data == 1 { data } else { - count(data - 1u) + 1u + count(data - 1) + 1 } } -fn count(n: uint) -> uint { +fn count(n: libc::uintptr_t) -> libc::uintptr_t { unsafe { println!("n = {}", n); rustrt::rust_dbg_call(cb, n) @@ -41,8 +41,8 @@ pub fn main() { // Make sure we're on a task with small Rust stacks (main currently // has a large stack) task::spawn(proc() { - let result = count(1000u); + let result = count(1000); println!("result = {}", result); - assert_eq!(result, 1000u); + assert_eq!(result, 1000); }); } diff --git a/src/test/run-pass/extern-call-indirect.rs b/src/test/run-pass/extern-call-indirect.rs index 8db745424b21e..52697d96b32d9 100644 --- a/src/test/run-pass/extern-call-indirect.rs +++ b/src/test/run-pass/extern-call-indirect.rs @@ -22,14 +22,14 @@ mod rustrt { } extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1u { + if data == 1 { data } else { - fact(data - 1u) * data + fact(data - 1) * data } } -fn fact(n: uint) -> uint { +fn fact(n: libc::uintptr_t) -> libc::uintptr_t { unsafe { println!("n = {}", n); rustrt::rust_dbg_call(cb, n) @@ -37,7 +37,7 @@ fn fact(n: uint) -> uint { } pub fn main() { - let result = fact(10u); + let result = fact(10); println!("result = {}", result); - assert_eq!(result, 3628800u); + assert_eq!(result, 3628800); } diff --git a/src/test/run-pass/extern-call-scrub.rs b/src/test/run-pass/extern-call-scrub.rs index 07d425dcdadbd..ae9430370d520 100644 --- a/src/test/run-pass/extern-call-scrub.rs +++ b/src/test/run-pass/extern-call-scrub.rs @@ -27,14 +27,14 @@ mod rustrt { } extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1u { + if data == 1 { data } else { - count(data - 1u) + count(data - 1u) + count(data - 1) + count(data - 1) } } -fn count(n: uint) -> uint { +fn count(n: libc::uintptr_t) -> libc::uintptr_t { unsafe { println!("n = {}", n); rustrt::rust_dbg_call(cb, n) @@ -45,8 +45,8 @@ pub fn main() { // Make sure we're on a task with small Rust stacks (main currently // has a large stack) task::spawn(proc() { - let result = count(12u); + let result = count(12); println!("result = {}", result); - assert_eq!(result, 2048u); + assert_eq!(result, 2048); }); } diff --git a/src/test/run-pass/extern-crosscrate.rs b/src/test/run-pass/extern-crosscrate.rs index 5dc25c85325c0..18e20332adc91 100644 --- a/src/test/run-pass/extern-crosscrate.rs +++ b/src/test/run-pass/extern-crosscrate.rs @@ -11,8 +11,9 @@ //aux-build:extern-crosscrate-source.rs extern crate externcallback; +extern crate libc; -fn fact(n: uint) -> uint { +fn fact(n: libc::uintptr_t) -> libc::uintptr_t { unsafe { println!("n = {}", n); externcallback::rustrt::rust_dbg_call(externcallback::cb, n) @@ -20,7 +21,7 @@ fn fact(n: uint) -> uint { } pub fn main() { - let result = fact(10u); + let result = fact(10); println!("result = {}", result); - assert_eq!(result, 3628800u); + assert_eq!(result, 3628800); } diff --git a/src/test/run-pass/extern-stress.rs b/src/test/run-pass/extern-stress.rs index 18e771b9b1ef0..87d96880e4bd3 100644 --- a/src/test/run-pass/extern-stress.rs +++ b/src/test/run-pass/extern-stress.rs @@ -26,24 +26,24 @@ mod rustrt { } extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1u { + if data == 1 { data } else { task::deschedule(); - count(data - 1u) + count(data - 1u) + count(data - 1) + count(data - 1) } } -fn count(n: uint) -> uint { +fn count(n: libc::uintptr_t) -> libc::uintptr_t { unsafe { rustrt::rust_dbg_call(cb, n) } } pub fn main() { - for _ in range(0, 100u) { + for _ in range(0u, 100) { task::spawn(proc() { - assert_eq!(count(5u), 16u); + assert_eq!(count(5), 16); }); } } diff --git a/src/test/run-pass/extern-yield.rs b/src/test/run-pass/extern-yield.rs index 0735cca1864cf..7fb68e9f8a038 100644 --- a/src/test/run-pass/extern-yield.rs +++ b/src/test/run-pass/extern-yield.rs @@ -23,14 +23,14 @@ mod rustrt { } extern fn cb(data: libc::uintptr_t) -> libc::uintptr_t { - if data == 1u { + if data == 1 { data } else { - count(data - 1u) + count(data - 1u) + count(data - 1) + count(data - 1) } } -fn count(n: uint) -> uint { +fn count(n: libc::uintptr_t) -> libc::uintptr_t { unsafe { task::deschedule(); rustrt::rust_dbg_call(cb, n) @@ -40,9 +40,9 @@ fn count(n: uint) -> uint { pub fn main() { for _ in range(0, 10u) { task::spawn(proc() { - let result = count(5u); + let result = count(5); println!("result = {}", result); - assert_eq!(result, 16u); + assert_eq!(result, 16); }); } }