summaryrefslogtreecommitdiff
path: root/tests/expectations/tests/namespace.rs
blob: 72c17ee64acdf877849e4e4ba0ad3a13e8882af9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
#![allow(
    dead_code,
    non_snake_case,
    non_camel_case_types,
    non_upper_case_globals
)]

#[allow(non_snake_case, non_camel_case_types, non_upper_case_globals)]
pub mod root {
    #[allow(unused_imports)]
    use self::super::root;
    extern "C" {
        #[link_name = "\u{1}_Z9top_levelv"]
        pub fn top_level();
    }
    pub mod whatever {
        #[allow(unused_imports)]
        use self::super::super::root;
        pub type whatever_other_thing_t = whatever_int_t;
        pub type whatever_int_t = ::std::os::raw::c_int;
        extern "C" {
            #[link_name = "\u{1}_ZN8whatever11in_whateverEv"]
            pub fn in_whatever();
        }
    }
    pub mod _bindgen_mod_id_17 {
        #[allow(unused_imports)]
        use self::super::super::root;
        #[repr(C)]
        #[derive(Debug, Default, Copy, Clone)]
        pub struct A {
            pub b: root::whatever::whatever_int_t,
        }
        #[test]
        fn bindgen_test_layout_A() {
            assert_eq!(
                ::std::mem::size_of::<A>(),
                4usize,
                concat!("Size of: ", stringify!(A))
            );
            assert_eq!(
                ::std::mem::align_of::<A>(),
                4usize,
                concat!("Alignment of ", stringify!(A))
            );
            fn test_field_b() {
                assert_eq!(
                    unsafe {
                        let uninit = ::std::mem::MaybeUninit::<A>::uninit();
                        let ptr = uninit.as_ptr();
                        ::std::ptr::addr_of!((*ptr).b) as usize - ptr as usize
                    },
                    0usize,
                    concat!(
                        "Offset of field: ",
                        stringify!(A),
                        "::",
                        stringify!(b)
                    )
                );
            }
            test_field_b();
        }
    }
    #[repr(C)]
    #[derive(Debug)]
    pub struct C<T> {
        pub _base: root::_bindgen_mod_id_17::A,
        pub m_c: T,
        pub m_c_ptr: *mut T,
        pub m_c_arr: [T; 10usize],
        pub _phantom_0: ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
    }
    impl<T> Default for C<T> {
        fn default() -> Self {
            let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
            unsafe {
                ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
                s.assume_init()
            }
        }
    }
    pub mod w {
        #[allow(unused_imports)]
        use self::super::super::root;
        pub type whatever_int_t = ::std::os::raw::c_uint;
        #[repr(C)]
        #[derive(Debug)]
        pub struct D<T> {
            pub m_c: root::C<T>,
            pub _phantom_0:
                ::std::marker::PhantomData<::std::cell::UnsafeCell<T>>,
        }
        impl<T> Default for D<T> {
            fn default() -> Self {
                let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
                unsafe {
                    ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
                    s.assume_init()
                }
            }
        }
        extern "C" {
            #[link_name = "\u{1}_ZN1w3hehEv"]
            pub fn heh() -> root::w::whatever_int_t;
        }
        extern "C" {
            #[link_name = "\u{1}_ZN1w3fooEv"]
            pub fn foo() -> root::C<::std::os::raw::c_int>;
        }
        extern "C" {
            #[link_name = "\u{1}_ZN1w4barrEv"]
            pub fn barr() -> root::C<f32>;
        }
    }
    pub mod foobar {
        #[allow(unused_imports)]
        use self::super::super::root;
        extern "C" {
            #[link_name = "\u{1}_ZN6foobar3fooEv"]
            pub fn foo();
        }
    }
    pub mod faraway {
        #[allow(unused_imports)]
        use self::super::super::root;
        extern "C" {
            #[link_name = "\u{1}_ZN7faraway3barEv"]
            pub fn bar();
        }
    }
}