about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCorey Richardson <corey@octayn.net>2014-05-27 18:37:49 -0700
committerCorey Richardson <corey@octayn.net>2014-08-20 21:02:23 -0400
commitbc19a776312eda23e8add1d9f6db4d9d7401d9cb (patch)
tree0c0b48ee6caf520010b9a81ae1cbe8ccb579301d
parent6e8ff999589a7b4c7f62f7128f3e028a7b3ea64f (diff)
downloadrust-bc19a776312eda23e8add1d9f6db4d9d7401d9cb.tar.gz
rust-bc19a776312eda23e8add1d9f6db4d9d7401d9cb.zip
Add #[repr(C)] to all the things!
-rw-r--r--src/liblibc/lib.rs104
-rw-r--r--src/libnative/io/c_unix.rs13
-rw-r--r--src/librustdoc/html/markdown.rs4
-rw-r--r--src/librustuv/uvll.rs5
-rw-r--r--src/libstd/io/test.rs1
5 files changed, 125 insertions, 2 deletions
diff --git a/src/liblibc/lib.rs b/src/liblibc/lib.rs
index 874c7c2409c..a8e12ed4b19 100644
--- a/src/liblibc/lib.rs
+++ b/src/liblibc/lib.rs
@@ -370,6 +370,7 @@ pub mod types {
 
                 pub type pthread_t = c_ulong;
 
+                #[repr(C)]
                 pub struct glob_t {
                     pub gl_pathc: size_t,
                     pub gl_pathv: *mut *mut c_char,
@@ -382,11 +383,13 @@ pub mod types {
                     pub __unused5: *mut c_void,
                 }
 
+                #[repr(C)]
                 pub struct timeval {
                     pub tv_sec: time_t,
                     pub tv_usec: suseconds_t,
                 }
 
+                #[repr(C)]
                 pub struct timespec {
                     pub tv_sec: time_t,
                     pub tv_nsec: c_long,
@@ -403,24 +406,29 @@ pub mod types {
                 pub type sa_family_t = u16;
                 pub type in_port_t = u16;
                 pub type in_addr_t = u32;
+                #[repr(C)]
                 pub struct sockaddr {
                     pub sa_family: sa_family_t,
                     pub sa_data: [u8, ..14],
                 }
+                #[repr(C)]
                 pub struct sockaddr_storage {
                     pub ss_family: sa_family_t,
                     pub __ss_align: i64,
                     pub __ss_pad2: [u8, ..112],
                 }
+                #[repr(C)]
                 pub struct sockaddr_in {
                     pub sin_family: sa_family_t,
                     pub sin_port: in_port_t,
                     pub sin_addr: in_addr,
                     pub sin_zero: [u8, ..8],
                 }
+                #[repr(C)]
                 pub struct in_addr {
                     pub s_addr: in_addr_t,
                 }
+                #[repr(C)]
                 pub struct sockaddr_in6 {
                     pub sin6_family: sa_family_t,
                     pub sin6_port: in_port_t,
@@ -428,17 +436,21 @@ pub mod types {
                     pub sin6_addr: in6_addr,
                     pub sin6_scope_id: u32,
                 }
+                #[repr(C)]
                 pub struct in6_addr {
                     pub s6_addr: [u16, ..8]
                 }
+                #[repr(C)]
                 pub struct ip_mreq {
                     pub imr_multiaddr: in_addr,
                     pub imr_interface: in_addr,
                 }
+                #[repr(C)]
                 pub struct ip6_mreq {
                     pub ipv6mr_multiaddr: in6_addr,
                     pub ipv6mr_interface: c_uint,
                 }
+                #[repr(C)]
                 pub struct addrinfo {
                     pub ai_flags: c_int,
                     pub ai_family: c_int,
@@ -460,6 +472,7 @@ pub mod types {
 
                     pub ai_next: *mut addrinfo,
                 }
+                #[repr(C)]
                 pub struct sockaddr_un {
                     pub sun_family: sa_family_t,
                     pub sun_path: [c_char, ..108]
@@ -534,6 +547,7 @@ pub mod types {
                 pub type blksize_t = i32;
                 pub type blkcnt_t = i32;
 
+                #[repr(C)]
                 pub struct stat {
                     pub st_dev: dev_t,
                     pub __pad1: c_short,
@@ -557,11 +571,13 @@ pub mod types {
                     pub __unused5: c_long,
                 }
 
+                #[repr(C)]
                 pub struct utimbuf {
                     pub actime: time_t,
                     pub modtime: time_t,
                 }
 
+                #[repr(C)]
                 pub struct pthread_attr_t {
                     pub __size: [u32, ..9]
                 }
@@ -576,6 +592,7 @@ pub mod types {
                 pub type blksize_t = u32;
                 pub type blkcnt_t = u32;
 
+                #[repr(C)]
                 pub struct stat {
                     pub st_dev: c_ulonglong,
                     pub __pad0: [c_uchar, ..4],
@@ -598,11 +615,13 @@ pub mod types {
                     pub st_ino: c_ulonglong,
                 }
 
+                #[repr(C)]
                 pub struct utimbuf {
                     pub actime: time_t,
                     pub modtime: time_t,
                 }
 
+                #[repr(C)]
                 pub struct pthread_attr_t {
                     pub __size: [u32, ..9]
                 }
@@ -619,6 +638,7 @@ pub mod types {
                 pub type blksize_t = i32;
                 pub type blkcnt_t = i32;
 
+                #[repr(C)]
                 pub struct stat {
                     pub st_dev: c_ulong,
                     pub st_pad1: [c_long, ..3],
@@ -642,11 +662,13 @@ pub mod types {
                     pub st_pad5: [c_long, ..14],
                 }
 
+                #[repr(C)]
                 pub struct utimbuf {
                     pub actime: time_t,
                     pub modtime: time_t,
                 }
 
+                #[repr(C)]
                 pub struct pthread_attr_t {
                     pub __size: [u32, ..9]
                 }
@@ -703,6 +725,7 @@ pub mod types {
                 pub type nlink_t = u64;
                 pub type blksize_t = i64;
                 pub type blkcnt_t = i64;
+                #[repr(C)]
                 pub struct stat {
                     pub st_dev: dev_t,
                     pub st_ino: ino_t,
@@ -724,11 +747,13 @@ pub mod types {
                     pub __unused: [c_long, ..3],
                 }
 
+                #[repr(C)]
                 pub struct utimbuf {
                     pub actime: time_t,
                     pub modtime: time_t,
                 }
 
+                #[repr(C)]
                 pub struct pthread_attr_t {
                     pub __size: [u64, ..7]
                 }
@@ -753,6 +778,7 @@ pub mod types {
 
                 pub type pthread_t = uintptr_t;
 
+                #[repr(C)]
                 pub struct glob_t {
                     pub gl_pathc:  size_t,
                     pub __unused1: size_t,
@@ -769,11 +795,13 @@ pub mod types {
                     pub __unused8: *mut c_void,
                 }
 
+                #[repr(C)]
                 pub struct timeval {
                     pub tv_sec: time_t,
                     pub tv_usec: suseconds_t,
                 }
 
+                #[repr(C)]
                 pub struct timespec {
                     pub tv_sec: time_t,
                     pub tv_nsec: c_long,
@@ -790,11 +818,13 @@ pub mod types {
                 pub type sa_family_t = u8;
                 pub type in_port_t = u16;
                 pub type in_addr_t = u32;
+                #[repr(C)]
                 pub struct sockaddr {
                     pub sa_len: u8,
                     pub sa_family: sa_family_t,
                     pub sa_data: [u8, ..14],
                 }
+                #[repr(C)]
                 pub struct sockaddr_storage {
                     pub ss_len: u8,
                     pub ss_family: sa_family_t,
@@ -802,6 +832,7 @@ pub mod types {
                     pub __ss_align: i64,
                     pub __ss_pad2: [u8, ..112],
                 }
+                #[repr(C)]
                 pub struct sockaddr_in {
                     pub sin_len: u8,
                     pub sin_family: sa_family_t,
@@ -809,9 +840,11 @@ pub mod types {
                     pub sin_addr: in_addr,
                     pub sin_zero: [u8, ..8],
                 }
+                #[repr(C)]
                 pub struct in_addr {
                     pub s_addr: in_addr_t,
                 }
+                #[repr(C)]
                 pub struct sockaddr_in6 {
                     pub sin6_len: u8,
                     pub sin6_family: sa_family_t,
@@ -820,17 +853,21 @@ pub mod types {
                     pub sin6_addr: in6_addr,
                     pub sin6_scope_id: u32,
                 }
+                #[repr(C)]
                 pub struct in6_addr {
                     pub s6_addr: [u16, ..8]
                 }
+                #[repr(C)]
                 pub struct ip_mreq {
                     pub imr_multiaddr: in_addr,
                     pub imr_interface: in_addr,
                 }
+                #[repr(C)]
                 pub struct ip6_mreq {
                     pub ipv6mr_multiaddr: in6_addr,
                     pub ipv6mr_interface: c_uint,
                 }
+                #[repr(C)]
                 pub struct addrinfo {
                     pub ai_flags: c_int,
                     pub ai_family: c_int,
@@ -841,6 +878,7 @@ pub mod types {
                     pub ai_addr: *mut sockaddr,
                     pub ai_next: *mut addrinfo,
                 }
+                #[repr(C)]
                 pub struct sockaddr_un {
                     pub sun_len: u8,
                     pub sun_family: sa_family_t,
@@ -899,6 +937,7 @@ pub mod types {
                 pub type blksize_t = i64;
                 pub type blkcnt_t = i64;
                 pub type fflags_t = u32;
+                #[repr(C)]
                 pub struct stat {
                     pub st_dev: dev_t,
                     pub st_ino: ino_t,
@@ -924,6 +963,7 @@ pub mod types {
                     pub __unused: [uint8_t, ..2],
                 }
 
+                #[repr(C)]
                 pub struct utimbuf {
                     pub actime: time_t,
                     pub modtime: time_t,
@@ -951,6 +991,7 @@ pub mod types {
 
                 pub type pthread_t = uintptr_t;
 
+                #[repr(C)]
                 pub struct glob_t {
                     pub gl_pathc:  size_t,
                     pub __unused1: size_t,
@@ -967,11 +1008,13 @@ pub mod types {
                     pub __unused8: *mut c_void,
                 }
 
+                #[repr(C)]
                 pub struct timeval {
                     pub tv_sec: time_t,
                     pub tv_usec: suseconds_t,
                 }
 
+                #[repr(C)]
                 pub struct timespec {
                     pub tv_sec: time_t,
                     pub tv_nsec: c_long,
@@ -988,11 +1031,13 @@ pub mod types {
                 pub type sa_family_t = u8;
                 pub type in_port_t = u16;
                 pub type in_addr_t = u32;
+                #[repr(C)]
                 pub struct sockaddr {
                     pub sa_len: u8,
                     pub sa_family: sa_family_t,
                     pub sa_data: [u8, ..14],
                 }
+                #[repr(C)]
                 pub struct sockaddr_storage {
                     pub ss_len: u8,
                     pub ss_family: sa_family_t,
@@ -1000,6 +1045,7 @@ pub mod types {
                     pub __ss_align: i64,
                     pub __ss_pad2: [u8, ..112],
                 }
+                #[repr(C)]
                 pub struct sockaddr_in {
                     pub sin_len: u8,
                     pub sin_family: sa_family_t,
@@ -1007,9 +1053,11 @@ pub mod types {
                     pub sin_addr: in_addr,
                     pub sin_zero: [u8, ..8],
                 }
+                #[repr(C)]
                 pub struct in_addr {
                     pub s_addr: in_addr_t,
                 }
+                #[repr(C)]
                 pub struct sockaddr_in6 {
                     pub sin6_len: u8,
                     pub sin6_family: sa_family_t,
@@ -1018,17 +1066,21 @@ pub mod types {
                     pub sin6_addr: in6_addr,
                     pub sin6_scope_id: u32,
                 }
+                #[repr(C)]
                 pub struct in6_addr {
                     pub s6_addr: [u16, ..8]
                 }
+                #[repr(C)]
                 pub struct ip_mreq {
                     pub imr_multiaddr: in_addr,
                     pub imr_interface: in_addr,
                 }
+                #[repr(C)]
                 pub struct ip6_mreq {
                     pub ipv6mr_multiaddr: in6_addr,
                     pub ipv6mr_interface: c_uint,
                 }
+                #[repr(C)]
                 pub struct addrinfo {
                     pub ai_flags: c_int,
                     pub ai_family: c_int,
@@ -1039,6 +1091,7 @@ pub mod types {
                     pub ai_addr: *mut sockaddr,
                     pub ai_next: *mut addrinfo,
                 }
+                #[repr(C)]
                 pub struct sockaddr_un {
                     pub sun_len: u8,
                     pub sun_family: sa_family_t,
@@ -1099,6 +1152,7 @@ pub mod types {
                 pub type blkcnt_t = i64;
                 pub type fflags_t = u32;
 
+                #[repr(C)]
                 pub struct stat {
                     pub st_ino: ino_t,
                     pub st_nlink: nlink_t,
@@ -1123,6 +1177,7 @@ pub mod types {
                     pub st_qspare1: int64_t,
                     pub st_qspare2: int64_t,
                 }
+                #[repr(C)]
                 pub struct utimbuf {
                     pub actime: time_t,
                     pub modtime: time_t,
@@ -1150,6 +1205,7 @@ pub mod types {
 
                 // pub Note: this is the struct called stat64 in win32. Not stat,
                 // nor stati64.
+                #[repr(C)]
                 pub struct stat {
                     pub st_dev: dev_t,
                     pub st_ino: ino_t,
@@ -1165,16 +1221,19 @@ pub mod types {
                 }
 
                 // note that this is called utimbuf64 in win32
+                #[repr(C)]
                 pub struct utimbuf {
                     pub actime: time64_t,
                     pub modtime: time64_t,
                 }
 
+                #[repr(C)]
                 pub struct timeval {
                     pub tv_sec: c_long,
                     pub tv_usec: c_long,
                 }
 
+                #[repr(C)]
                 pub struct timespec {
                     pub tv_sec: time_t,
                     pub tv_nsec: c_long,
@@ -1184,32 +1243,37 @@ pub mod types {
             }
 
             pub mod bsd44 {
-                use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
+                use types::os::arch::c95::{c_char, c_int, c_uint, size_t, uintptr_t};
 
                 pub type SOCKET = uint;
                 pub type socklen_t = c_int;
                 pub type sa_family_t = u16;
                 pub type in_port_t = u16;
                 pub type in_addr_t = u32;
+                #[repr(C)]
                 pub struct sockaddr {
                     pub sa_family: sa_family_t,
                     pub sa_data: [u8, ..14],
                 }
+                #[repr(C)]
                 pub struct sockaddr_storage {
                     pub ss_family: sa_family_t,
                     pub __ss_pad1: [u8, ..6],
                     pub __ss_align: i64,
                     pub __ss_pad2: [u8, ..112],
                 }
+                #[repr(C)]
                 pub struct sockaddr_in {
                     pub sin_family: sa_family_t,
                     pub sin_port: in_port_t,
                     pub sin_addr: in_addr,
                     pub sin_zero: [u8, ..8],
                 }
+                #[repr(C)]
                 pub struct in_addr {
                     pub s_addr: in_addr_t,
                 }
+                #[repr(C)]
                 pub struct sockaddr_in6 {
                     pub sin6_family: sa_family_t,
                     pub sin6_port: in_port_t,
@@ -1217,17 +1281,21 @@ pub mod types {
                     pub sin6_addr: in6_addr,
                     pub sin6_scope_id: u32,
                 }
+                #[repr(C)]
                 pub struct in6_addr {
                     pub s6_addr: [u16, ..8]
                 }
+                #[repr(C)]
                 pub struct ip_mreq {
                     pub imr_multiaddr: in_addr,
                     pub imr_interface: in_addr,
                 }
+                #[repr(C)]
                 pub struct ip6_mreq {
                     pub ipv6mr_multiaddr: in6_addr,
                     pub ipv6mr_interface: c_uint,
                 }
+                #[repr(C)]
                 pub struct addrinfo {
                     pub ai_flags: c_int,
                     pub ai_family: c_int,
@@ -1238,6 +1306,7 @@ pub mod types {
                     pub ai_addr: *mut sockaddr,
                     pub ai_next: *mut addrinfo,
                 }
+                #[repr(C)]
                 pub struct sockaddr_un {
                     pub sun_family: sa_family_t,
                     pub sun_path: [c_char, ..108]
@@ -1320,7 +1389,7 @@ pub mod types {
                 use types::os::arch::c95::{c_char, c_int, c_uint, size_t};
                 use types::os::arch::c95::{c_long, c_ulong};
                 use types::os::arch::c95::{wchar_t};
-                use types::os::arch::c99::{c_ulonglong, c_longlong};
+                use types::os::arch::c99::{c_ulonglong, c_longlong, uintptr_t};
 
                 pub type BOOL = c_int;
                 pub type BYTE = u8;
@@ -1354,6 +1423,7 @@ pub mod types {
                 pub type LPWCH = *mut WCHAR;
                 pub type LPCH = *mut CHAR;
 
+                #[repr(C)]
                 pub struct SECURITY_ATTRIBUTES {
                     pub nLength: DWORD,
                     pub lpSecurityDescriptor: LPVOID,
@@ -1377,6 +1447,7 @@ pub mod types {
                 pub type time64_t = i64;
                 pub type int64 = i64;
 
+                #[repr(C)]
                 pub struct STARTUPINFO {
                     pub cb: DWORD,
                     pub lpReserved: LPWSTR,
@@ -1399,6 +1470,7 @@ pub mod types {
                 }
                 pub type LPSTARTUPINFO = *mut STARTUPINFO;
 
+                #[repr(C)]
                 pub struct PROCESS_INFORMATION {
                     pub hProcess: HANDLE,
                     pub hThread: HANDLE,
@@ -1407,6 +1479,7 @@ pub mod types {
                 }
                 pub type LPPROCESS_INFORMATION = *mut PROCESS_INFORMATION;
 
+                #[repr(C)]
                 pub struct SYSTEM_INFO {
                     pub wProcessorArchitecture: WORD,
                     pub wReserved: WORD,
@@ -1422,6 +1495,7 @@ pub mod types {
                 }
                 pub type LPSYSTEM_INFO = *mut SYSTEM_INFO;
 
+                #[repr(C)]
                 pub struct MEMORY_BASIC_INFORMATION {
                     pub BaseAddress: LPVOID,
                     pub AllocationBase: LPVOID,
@@ -1433,6 +1507,7 @@ pub mod types {
                 }
                 pub type LPMEMORY_BASIC_INFORMATION = *mut MEMORY_BASIC_INFORMATION;
 
+                #[repr(C)]
                 pub struct OVERLAPPED {
                     pub Internal: *mut c_ulong,
                     pub InternalHigh: *mut c_ulong,
@@ -1443,6 +1518,7 @@ pub mod types {
 
                 pub type LPOVERLAPPED = *mut OVERLAPPED;
 
+                #[repr(C)]
                 pub struct FILETIME {
                     pub dwLowDateTime: DWORD,
                     pub dwHighDateTime: DWORD,
@@ -1450,6 +1526,7 @@ pub mod types {
 
                 pub type LPFILETIME = *mut FILETIME;
 
+                #[repr(C)]
                 pub struct GUID {
                     pub Data1: DWORD,
                     pub Data2: WORD,
@@ -1457,6 +1534,7 @@ pub mod types {
                     pub Data4: [BYTE, ..8],
                 }
 
+                #[repr(C)]
                 pub struct WSAPROTOCOLCHAIN {
                     pub ChainLen: c_int,
                     pub ChainEntries: [DWORD, ..MAX_PROTOCOL_CHAIN as uint],
@@ -1464,6 +1542,7 @@ pub mod types {
 
                 pub type LPWSAPROTOCOLCHAIN = *mut WSAPROTOCOLCHAIN;
 
+                #[repr(C)]
                 pub struct WSAPROTOCOL_INFO {
                     pub dwServiceFlags1: DWORD,
                     pub dwServiceFlags2: DWORD,
@@ -1506,6 +1585,7 @@ pub mod types {
 
                 pub type pthread_t = uintptr_t;
 
+                #[repr(C)]
                 pub struct glob_t {
                     pub gl_pathc:  size_t,
                     pub __unused1: c_int,
@@ -1522,11 +1602,13 @@ pub mod types {
                     pub __unused8: *mut c_void,
                 }
 
+                #[repr(C)]
                 pub struct timeval {
                     pub tv_sec: time_t,
                     pub tv_usec: suseconds_t,
                 }
 
+                #[repr(C)]
                 pub struct timespec {
                     pub tv_sec: time_t,
                     pub tv_nsec: c_long,
@@ -1544,11 +1626,13 @@ pub mod types {
                 pub type sa_family_t = u8;
                 pub type in_port_t = u16;
                 pub type in_addr_t = u32;
+                #[repr(C)]
                 pub struct sockaddr {
                     pub sa_len: u8,
                     pub sa_family: sa_family_t,
                     pub sa_data: [u8, ..14],
                 }
+                #[repr(C)]
                 pub struct sockaddr_storage {
                     pub ss_len: u8,
                     pub ss_family: sa_family_t,
@@ -1556,6 +1640,7 @@ pub mod types {
                     pub __ss_align: i64,
                     pub __ss_pad2: [u8, ..112],
                 }
+                #[repr(C)]
                 pub struct sockaddr_in {
                     pub sin_len: u8,
                     pub sin_family: sa_family_t,
@@ -1563,9 +1648,11 @@ pub mod types {
                     pub sin_addr: in_addr,
                     pub sin_zero: [u8, ..8],
                 }
+                #[repr(C)]
                 pub struct in_addr {
                     pub s_addr: in_addr_t,
                 }
+                #[repr(C)]
                 pub struct sockaddr_in6 {
                     pub sin6_len: u8,
                     pub sin6_family: sa_family_t,
@@ -1574,17 +1661,21 @@ pub mod types {
                     pub sin6_addr: in6_addr,
                     pub sin6_scope_id: u32,
                 }
+                #[repr(C)]
                 pub struct in6_addr {
                     pub s6_addr: [u16, ..8]
                 }
+                #[repr(C)]
                 pub struct ip_mreq {
                     pub imr_multiaddr: in_addr,
                     pub imr_interface: in_addr,
                 }
+                #[repr(C)]
                 pub struct ip6_mreq {
                     pub ipv6mr_multiaddr: in6_addr,
                     pub ipv6mr_interface: c_uint,
                 }
+                #[repr(C)]
                 pub struct addrinfo {
                     pub ai_flags: c_int,
                     pub ai_family: c_int,
@@ -1595,6 +1686,7 @@ pub mod types {
                     pub ai_addr: *mut sockaddr,
                     pub ai_next: *mut addrinfo,
                 }
+                #[repr(C)]
                 pub struct sockaddr_un {
                     pub sun_len: u8,
                     pub sun_family: sa_family_t,
@@ -1652,6 +1744,7 @@ pub mod types {
                 pub type blksize_t = i64;
                 pub type blkcnt_t = i32;
 
+                #[repr(C)]
                 pub struct stat {
                     pub st_dev: dev_t,
                     pub st_mode: mode_t,
@@ -1677,11 +1770,13 @@ pub mod types {
                     pub st_qspare: [int64_t, ..2],
                 }
 
+                #[repr(C)]
                 pub struct utimbuf {
                     pub actime: time_t,
                     pub modtime: time_t,
                 }
 
+                #[repr(C)]
                 pub struct pthread_attr_t {
                     pub __sig: c_long,
                     pub __opaque: [c_char, ..36]
@@ -1692,6 +1787,7 @@ pub mod types {
             pub mod bsd44 {
             }
             pub mod extra {
+                #[repr(C)]
                 pub struct mach_timebase_info {
                     pub numer: u32,
                     pub denom: u32,
@@ -1750,6 +1846,7 @@ pub mod types {
                 pub type blksize_t = i64;
                 pub type blkcnt_t = i32;
 
+                #[repr(C)]
                 pub struct stat {
                     pub st_dev: dev_t,
                     pub st_mode: mode_t,
@@ -1775,11 +1872,13 @@ pub mod types {
                     pub st_qspare: [int64_t, ..2],
                 }
 
+                #[repr(C)]
                 pub struct utimbuf {
                     pub actime: time_t,
                     pub modtime: time_t,
                 }
 
+                #[repr(C)]
                 pub struct pthread_attr_t {
                     pub __sig: c_long,
                     pub __opaque: [c_char, ..56]
@@ -1790,6 +1889,7 @@ pub mod types {
             pub mod bsd44 {
             }
             pub mod extra {
+                #[repr(C)]
                 pub struct mach_timebase_info {
                     pub numer: u32,
                     pub denom: u32,
diff --git a/src/libnative/io/c_unix.rs b/src/libnative/io/c_unix.rs
index af4d309dfe2..1f8584cbd09 100644
--- a/src/libnative/io/c_unix.rs
+++ b/src/libnative/io/c_unix.rs
@@ -91,6 +91,7 @@ extern {
 mod select {
     pub static FD_SETSIZE: uint = 1024;
 
+    #[repr(C)]
     pub struct fd_set {
         fds_bits: [i32, ..(FD_SETSIZE / 32)]
     }
@@ -109,6 +110,7 @@ mod select {
 
     pub static FD_SETSIZE: uint = 1024;
 
+    #[repr(C)]
     pub struct fd_set {
         // FIXME: shouldn't this be a c_ulong?
         fds_bits: [uint, ..(FD_SETSIZE / uint::BITS)]
@@ -139,6 +141,7 @@ mod signal {
     // This definition is not as accurate as it could be, {pid, uid, status} is
     // actually a giant union. Currently we're only interested in these fields,
     // however.
+    #[repr(C)]
     pub struct siginfo {
         si_signo: libc::c_int,
         si_errno: libc::c_int,
@@ -148,6 +151,7 @@ mod signal {
         pub status: libc::c_int,
     }
 
+    #[repr(C)]
     pub struct sigaction {
         pub sa_handler: extern fn(libc::c_int),
         pub sa_mask: sigset_t,
@@ -155,10 +159,13 @@ mod signal {
         sa_restorer: *mut libc::c_void,
     }
 
+    #[repr(C)]
     #[cfg(target_word_size = "32")]
     pub struct sigset_t {
         __val: [libc::c_ulong, ..32],
     }
+
+    #[repr(C)]
     #[cfg(target_word_size = "64")]
     pub struct sigset_t {
         __val: [libc::c_ulong, ..16],
@@ -182,6 +189,7 @@ mod signal {
     // This definition is not as accurate as it could be, {pid, uid, status} is
     // actually a giant union. Currently we're only interested in these fields,
     // however.
+    #[repr(C)]
     pub struct siginfo {
         si_signo: libc::c_int,
         si_code: libc::c_int,
@@ -191,6 +199,7 @@ mod signal {
         pub status: libc::c_int,
     }
 
+    #[repr(C)]
     pub struct sigaction {
         pub sa_flags: libc::c_uint,
         pub sa_handler: extern fn(libc::c_int),
@@ -199,6 +208,7 @@ mod signal {
         sa_resv: [libc::c_int, ..1],
     }
 
+    #[repr(C)]
     pub struct sigset_t {
         __val: [libc::c_ulong, ..32],
     }
@@ -231,6 +241,7 @@ mod signal {
 
     // This structure has more fields, but we're not all that interested in
     // them.
+    #[repr(C)]
     pub struct siginfo {
         pub si_signo: libc::c_int,
         pub si_errno: libc::c_int,
@@ -242,6 +253,7 @@ mod signal {
 
     #[cfg(target_os = "macos")]
     #[cfg(target_os = "ios")]
+    #[repr(C)]
     pub struct sigaction {
         pub sa_handler: extern fn(libc::c_int),
         sa_tramp: *mut libc::c_void,
@@ -251,6 +263,7 @@ mod signal {
 
     #[cfg(target_os = "freebsd")]
     #[cfg(target_os = "dragonfly")]
+    #[repr(C)]
     pub struct sigaction {
         pub sa_handler: extern fn(libc::c_int),
         pub sa_flags: libc::c_int,
diff --git a/src/librustdoc/html/markdown.rs b/src/librustdoc/html/markdown.rs
index 97fa58d5077..305c18480f6 100644
--- a/src/librustdoc/html/markdown.rs
+++ b/src/librustdoc/html/markdown.rs
@@ -65,6 +65,7 @@ static HOEDOWN_EXTENSIONS: libc::c_uint =
 
 type hoedown_document = libc::c_void;  // this is opaque to us
 
+#[repr(C)]
 struct hoedown_renderer {
     opaque: *mut hoedown_html_renderer_state,
     blockcode: Option<extern "C" fn(*mut hoedown_buffer, *const hoedown_buffer,
@@ -78,6 +79,7 @@ struct hoedown_renderer {
     other: [libc::size_t, ..28],
 }
 
+#[repr(C)]
 struct hoedown_html_renderer_state {
     opaque: *mut libc::c_void,
     toc_data: html_toc_data,
@@ -87,6 +89,7 @@ struct hoedown_html_renderer_state {
                                           *mut libc::c_void)>,
 }
 
+#[repr(C)]
 struct html_toc_data {
     header_count: libc::c_int,
     current_level: libc::c_int,
@@ -100,6 +103,7 @@ struct MyOpaque {
     toc_builder: Option<TocBuilder>,
 }
 
+#[repr(C)]
 struct hoedown_buffer {
     data: *const u8,
     size: libc::size_t,
diff --git a/src/librustuv/uvll.rs b/src/librustuv/uvll.rs
index b06065659bd..c0f674d1eec 100644
--- a/src/librustuv/uvll.rs
+++ b/src/librustuv/uvll.rs
@@ -103,6 +103,7 @@ pub type uv_buf_len_t = libc::size_t;
 pub type uv_buf_len_t = libc::c_ulong;
 
 // see libuv/include/uv-unix.h
+#[repr(C)]
 #[cfg(unix)]
 pub struct uv_buf_t {
     pub base: *mut u8,
@@ -114,6 +115,7 @@ pub type uv_os_socket_t = c_int;
 
 // see libuv/include/uv-win.h
 #[cfg(windows)]
+#[repr(C)]
 pub struct uv_buf_t {
     pub len: uv_buf_len_t,
     pub base: *mut u8,
@@ -135,6 +137,7 @@ pub enum uv_poll_event {
     UV_WRITABLE = 2,
 }
 
+#[repr(C)]
 pub struct uv_process_options_t {
     pub exit_cb: uv_exit_cb,
     pub file: *const libc::c_char,
@@ -178,11 +181,13 @@ pub type uv_tty_t = c_void;
 pub type uv_signal_t = c_void;
 pub type uv_shutdown_t = c_void;
 
+#[repr(C)]
 pub struct uv_timespec_t {
     pub tv_sec: libc::c_long,
     pub tv_nsec: libc::c_long
 }
 
+#[repr(C)]
 pub struct uv_stat_t {
     pub st_dev: libc::uint64_t,
     pub st_mode: libc::uint64_t,
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