about summary refs log tree commit diff
path: root/src/liblibc
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 /src/liblibc
parent6e8ff999589a7b4c7f62f7128f3e028a7b3ea64f (diff)
downloadrust-bc19a776312eda23e8add1d9f6db4d9d7401d9cb.tar.gz
rust-bc19a776312eda23e8add1d9f6db4d9d7401d9cb.zip
Add #[repr(C)] to all the things!
Diffstat (limited to 'src/liblibc')
-rw-r--r--src/liblibc/lib.rs104
1 files changed, 102 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,