Skip to content

Commit

Permalink
Add repr(C) to structs
Browse files Browse the repository at this point in the history
  • Loading branch information
thepowersgang committed Nov 18, 2018
1 parent 6ad95c2 commit dac37e7
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/impl-aarch64-elf.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
use std::{mem, ptr};
use super::VaPrimitive;

#[repr(C)]
pub struct VaList(*mut VaListInner);

#[repr(C)]
#[derive(Debug)]
#[doc(hidden)]
pub struct VaListInner {
stack: *const (),
gr_top: *const (),
vr_top: *const (),
stack: *const u64,
gr_top: *const u64,
vr_top: *const u64,
gr_offs: i32,
vr_offs: i32,
}
Expand Down
2 changes: 1 addition & 1 deletion src/impl-arm-sysv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::{mem, ptr};
use super::VaPrimitive;

#[allow(non_camel_case_types)]
#[allow(C)]
pub struct VaList(*const u8);

impl VaList {
Expand Down
2 changes: 1 addition & 1 deletion src/impl-x86-sysv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::{mem, ptr};
use super::VaPrimitive;

#[allow(non_camel_case_types)]
#[repr(C)]
pub struct VaList(*const u8);

impl VaList {
Expand Down
6 changes: 4 additions & 2 deletions src/impl-x86_64-elf.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
// x86_64 ELF - Aka the Itanium ABI
//
use std::{mem, ptr};
use std::ffi::c_void;
use super::VaPrimitive;

#[repr(C)]
pub struct VaList(*mut VaListInner);
// /// Saves the state of the VaList, similar to va_copy
//impl Clone for VaList { fn clone(&self) -> Self { va_list(self.0) } }
Expand All @@ -13,8 +15,8 @@ pub struct VaList(*mut VaListInner);
pub struct VaListInner {
gp_offset: u32,
fp_offset: u32,
overflow_arg_area: *const (),
reg_save_area: *const (),
overflow_arg_area: *const c_void,
reg_save_area: *const c_void,
}

impl VaList {
Expand Down
2 changes: 1 addition & 1 deletion src/impl-x86_64-win64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::{mem, ptr};
use super::VaPrimitive;

#[allow(non_camel_case_types)]
#[repr(C)]
pub struct VaList(*const u8);

impl VaList {
Expand Down

0 comments on commit dac37e7

Please sign in to comment.