about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-08-21 17:30:57 +0000
committerbors <bors@rust-lang.org>2014-08-21 17:30:57 +0000
commitf92015f71b3a49abd490e704a011d14786f6bf87 (patch)
tree11b1e392547013ab52c249d511d3c0a3ae8180e0 /src/libstd
parent4444aec1423b2f9431f30e1dc121d239c16ed71c (diff)
parent01d2efaffe421b21f17dc7bd736d249fa1abbb0e (diff)
downloadrust-f92015f71b3a49abd490e704a011d14786f6bf87.tar.gz
rust-f92015f71b3a49abd490e704a011d14786f6bf87.zip
auto merge of #16499 : cmr/rust/struct-undef-repr, r=pcwalton
r? @pcwalton
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io/test.rs1
-rw-r--r--src/libstd/os.rs2
-rw-r--r--src/libstd/rt/backtrace.rs31
3 files changed, 33 insertions, 1 deletions
diff --git a/src/libstd/io/test.rs b/src/libstd/io/test.rs
index 079a9aef648..769ad2a8468 100644
--- a/src/libstd/io/test.rs
+++ b/src/libstd/io/test.rs
@@ -146,6 +146,7 @@ mod darwin_fd_limit {
 
     use libc;
     type rlim_t = libc::uint64_t;
+    #[repr(C)]
     struct rlimit {
         rlim_cur: rlim_t,
         rlim_max: rlim_t
diff --git a/src/libstd/os.rs b/src/libstd/os.rs
index d8eb0979190..7780c61e866 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/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs
index a4491b2ab1d..1b005f49b88 100644
--- a/src/libstd/rt/backtrace.rs
+++ b/src/libstd/rt/backtrace.rs
@@ -701,6 +701,7 @@ mod imp {
     static IMAGE_FILE_MACHINE_IA64: libc::DWORD = 0x0200;
     static IMAGE_FILE_MACHINE_AMD64: libc::DWORD = 0x8664;
 
+    #[cfg(stage0)]
     #[packed]
     struct SYMBOL_INFO {
         SizeOfStruct: libc::c_ulong,
@@ -723,6 +724,30 @@ mod imp {
         Name: [libc::c_char, ..MAX_SYM_NAME],
     }
 
+    #[cfg(not(stage0))]
+    #[repr(C, packed)]
+    struct SYMBOL_INFO {
+        SizeOfStruct: libc::c_ulong,
+        TypeIndex: libc::c_ulong,
+        Reserved: [u64, ..2],
+        Index: libc::c_ulong,
+        Size: libc::c_ulong,
+        ModBase: u64,
+        Flags: libc::c_ulong,
+        Value: u64,
+        Address: u64,
+        Register: libc::c_ulong,
+        Scope: libc::c_ulong,
+        Tag: libc::c_ulong,
+        NameLen: libc::c_ulong,
+        MaxNameLen: libc::c_ulong,
+        // note that windows has this as 1, but it basically just means that
+        // the name is inline at the end of the struct. For us, we just bump
+        // the struct size up to MAX_SYM_NAME.
+        Name: [libc::c_char, ..MAX_SYM_NAME],
+    }
+
+
     #[repr(C)]
     enum ADDRESS_MODE {
         AddrMode1616,
@@ -772,6 +797,7 @@ mod imp {
 
         static MAXIMUM_SUPPORTED_EXTENSION: uint = 512;
 
+        #[repr(C)]
         pub struct CONTEXT {
             ContextFlags: libc::DWORD,
             Dr0: libc::DWORD,
@@ -800,6 +826,7 @@ mod imp {
             ExtendedRegisters: [u8, ..MAXIMUM_SUPPORTED_EXTENSION],
         }
 
+        #[repr(C)]
         pub struct FLOATING_SAVE_AREA {
             ControlWord: libc::DWORD,
             StatusWord: libc::DWORD,
@@ -829,6 +856,7 @@ mod imp {
         use libc::{c_longlong, c_ulonglong};
         use libc::types::os::arch::extra::{WORD, DWORD, DWORDLONG};
 
+        #[repr(C)]
         pub struct CONTEXT {
             P1Home: DWORDLONG,
             P2Home: DWORDLONG,
@@ -886,11 +914,13 @@ mod imp {
             LastExceptionFromRip: DWORDLONG,
         }
 
+        #[repr(C)]
         pub struct M128A {
             Low:  c_ulonglong,
             High: c_longlong
         }
 
+        #[repr(C)]
         pub struct FLOATING_SAVE_AREA {
             _Dummy: [u8, ..512] // FIXME: Fill this out
         }
@@ -907,6 +937,7 @@ mod imp {
         }
     }
 
+    #[repr(C)]
     struct Cleanup {
         handle: libc::HANDLE,
         SymCleanup: SymCleanupFn,