1 #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] 2 pub const SOME_DEFUN: u32 = 123; 3 extern "C" { 4 #[link_name = "\u{1}_Z12SomeFunctionv"] SomeFunction()5 pub fn SomeFunction(); 6 } 7 extern "C" { 8 pub static mut someVar: ::std::os::raw::c_int; 9 } 10 #[repr(C)] 11 #[derive(Debug, Default, Copy, Clone)] 12 pub struct someClass { 13 pub _address: u8, 14 } 15 #[allow(clippy::unnecessary_operation, clippy::identity_op)] 16 const _: () = { 17 ["Size of someClass"][::std::mem::size_of::<someClass>() - 1usize]; 18 ["Alignment of someClass"][::std::mem::align_of::<someClass>() - 1usize]; 19 }; 20 extern "C" { 21 #[link_name = "\u{1}_ZN9someClass16somePublicMethodEi"] someClass_somePublicMethod(this: *mut someClass, foo: ::std::os::raw::c_int)22 pub fn someClass_somePublicMethod(this: *mut someClass, foo: ::std::os::raw::c_int); 23 } 24 impl someClass { 25 #[inline] somePublicMethod(&mut self, foo: ::std::os::raw::c_int)26 pub unsafe fn somePublicMethod(&mut self, foo: ::std::os::raw::c_int) { 27 someClass_somePublicMethod(self, foo) 28 } 29 } 30 extern "C" { ExternFunction()31 pub fn ExternFunction(); 32 } 33 extern "C" { 34 #[link_name = "\u{1}_ZN3foo18NamespacedFunctionEv"] foo_NamespacedFunction()35 pub fn foo_NamespacedFunction(); 36 } 37 #[repr(C)] 38 #[derive(Debug, Copy, Clone)] 39 pub struct StructWithAllowlistedDefinition { 40 pub other: *mut StructWithAllowlistedFwdDecl, 41 } 42 #[allow(clippy::unnecessary_operation, clippy::identity_op)] 43 const _: () = { 44 [ 45 "Size of StructWithAllowlistedDefinition", 46 ][::std::mem::size_of::<StructWithAllowlistedDefinition>() - 8usize]; 47 [ 48 "Alignment of StructWithAllowlistedDefinition", 49 ][::std::mem::align_of::<StructWithAllowlistedDefinition>() - 8usize]; 50 [ 51 "Offset of field: StructWithAllowlistedDefinition::other", 52 ][::std::mem::offset_of!(StructWithAllowlistedDefinition, other) - 0usize]; 53 }; 54 impl Default for StructWithAllowlistedDefinition { default() -> Self55 fn default() -> Self { 56 let mut s = ::std::mem::MaybeUninit::<Self>::uninit(); 57 unsafe { 58 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); 59 s.assume_init() 60 } 61 } 62 } 63 #[repr(C)] 64 #[derive(Debug, Default, Copy, Clone)] 65 pub struct StructWithAllowlistedFwdDecl { 66 pub b: ::std::os::raw::c_int, 67 } 68 #[allow(clippy::unnecessary_operation, clippy::identity_op)] 69 const _: () = { 70 [ 71 "Size of StructWithAllowlistedFwdDecl", 72 ][::std::mem::size_of::<StructWithAllowlistedFwdDecl>() - 4usize]; 73 [ 74 "Alignment of StructWithAllowlistedFwdDecl", 75 ][::std::mem::align_of::<StructWithAllowlistedFwdDecl>() - 4usize]; 76 [ 77 "Offset of field: StructWithAllowlistedFwdDecl::b", 78 ][::std::mem::offset_of!(StructWithAllowlistedFwdDecl, b) - 0usize]; 79 }; 80 #[repr(C)] 81 #[derive(Debug, Default, Copy, Clone)] 82 pub struct AllowlistMe { 83 pub foo: ::std::os::raw::c_int, 84 } 85 #[allow(clippy::unnecessary_operation, clippy::identity_op)] 86 const _: () = { 87 ["Size of AllowlistMe"][::std::mem::size_of::<AllowlistMe>() - 4usize]; 88 ["Alignment of AllowlistMe"][::std::mem::align_of::<AllowlistMe>() - 4usize]; 89 [ 90 "Offset of field: AllowlistMe::foo", 91 ][::std::mem::offset_of!(AllowlistMe, foo) - 0usize]; 92 }; 93