@@ -58,6 +58,11 @@ pub const NESTED_CHAR: ::core::ffi::c_int = LITERAL_CHAR;
5858pub const NESTED_STR: [::core ::ffi ::c_char ; 6 ] = LITERAL_STR ;
5959pub const NESTED_ARRAY: [::core ::ffi ::c_int ; 3 ] = LITERAL_ARRAY ;
6060pub const NESTED_STRUCT: S = LITERAL_STRUCT ;
61+ pub const NEGATIVE_INT: ::core ::ffi ::c_int = - LITERAL_INT ;
62+ pub const INT_ARITHMETIC: ::core ::ffi ::c_int = NESTED_INT + LITERAL_INT + 1 as ::core ::ffi ::c_int ;
63+ pub const MIXED_ARITHMETIC: ::core ::ffi ::c_double = LITERAL_INT as ::core ::ffi ::c_double
64+ + NESTED_FLOAT * LITERAL_CHAR as ::core ::ffi ::c_double
65+ - true_0 as ::core ::ffi ::c_double ;
6166pub const PARENS: ::core ::ffi ::c_int = NESTED_INT * (LITERAL_CHAR + true_0 );
6267pub const PTR_ARITHMETIC: *const ::core ::ffi ::c_char = unsafe {
6368 LITERAL_STR
@@ -66,7 +71,24 @@ pub const PTR_ARITHMETIC: *const ::core::ffi::c_char = unsafe {
6671 .offset(-(3 as : :core ::ffi ::c_int as isize ))
6772};
6873pub const WIDENING_CAST: ::core ::ffi ::c_ulonglong = LITERAL_INT as ::core ::ffi ::c_ulonglong ;
74+ pub const NARROWING_CAST: ::core ::ffi ::c_char = LITERAL_INT as ::core ::ffi ::c_char ;
6975pub const CONVERSION_CAST: ::core ::ffi ::c_double = LITERAL_INT as ::core ::ffi ::c_double ;
76+ pub const INDEXING: ::core ::ffi ::c_char = NESTED_STR [LITERAL_FLOAT as ::core ::ffi ::c_int as usize ];
77+ pub const STR_CONCATENATION: [::core ::ffi ::c_char ; 18 ] = unsafe {
78+ ::core::mem ::transmute ::< [u8 ; 18 ], [::core::ffi ::c_char ; 18 ]> (* b " hello hello world\0 " )
79+ };
80+ pub const REF_MACRO: *const ::core ::ffi ::c_char = unsafe {
81+ NESTED_STR
82+ .as_ptr()
83+ .offset(LITERAL_FLOAT as : :core ::ffi ::c_int as isize ) as *const ::core::ffi::c_char
84+ };
85+ pub const REF_LITERAL: *mut S = & LITERAL_STRUCT as *const S as *mut S ;
86+ pub const TERNARY: ::core ::ffi ::c_int = if LITERAL_BOOL != 0 {
87+ 1 as ::core ::ffi ::c_int
88+ } else {
89+ 2 as ::core ::ffi ::c_int
90+ };
91+ pub const MEMBER: ::core ::ffi ::c_int = LITERAL_STRUCT .i ;
7092#[no_mangle ]
7193pub unsafe extern " C" fn local_muts () {
7294 let mut literal_int: ::core ::ffi ::c_int = LITERAL_INT ;
@@ -85,45 +107,28 @@ pub unsafe extern "C" fn local_muts() {
85107 let mut nested_str: [::core ::ffi ::c_char ; 6 ] = NESTED_STR ;
86108 let mut nested_array: [::core ::ffi ::c_int ; 3 ] = NESTED_ARRAY ;
87109 let mut nested_struct: S = NESTED_STRUCT ;
88- let mut negative_int: ::core ::ffi ::c_int = - LITERAL_INT ;
89- let mut int_arithmetic: ::core ::ffi ::c_int = NESTED_INT + LITERAL_INT + 1 as ::core ::ffi ::c_int ;
90- let mut mixed_arithmetic: ::core ::ffi ::c_float = (LITERAL_INT as ::core ::ffi ::c_double
91- + NESTED_FLOAT * LITERAL_CHAR as ::core ::ffi ::c_double
92- - true_0 as ::core ::ffi ::c_double )
93- as ::core ::ffi ::c_float ;
110+ let mut negative_int: ::core ::ffi ::c_int = NEGATIVE_INT ;
111+ let mut int_arithmetic: ::core ::ffi ::c_int = INT_ARITHMETIC ;
112+ let mut mixed_arithmetic: ::core ::ffi ::c_float = MIXED_ARITHMETIC as ::core ::ffi ::c_float ;
94113 let mut parens: ::core ::ffi ::c_int = PARENS ;
95114 let mut ptr_arithmetic: *const ::core ::ffi ::c_char = PTR_ARITHMETIC ;
96115 let mut widening_cast: ::core ::ffi ::c_ulonglong = WIDENING_CAST ;
97- let mut narrowing_cast: ::core ::ffi ::c_char = LITERAL_INT as :: core :: ffi :: c_char ;
116+ let mut narrowing_cast: ::core ::ffi ::c_char = NARROWING_CAST ;
98117 let mut conversion_cast: ::core ::ffi ::c_double = CONVERSION_CAST ;
99- let mut indexing: ::core ::ffi ::c_char =
100- NESTED_STR [LITERAL_FLOAT as ::core ::ffi ::c_int as usize ];
101- let mut str_concatenation_ptr: *const ::core ::ffi ::c_char =
102- b " hello hello world\0 " .as_ptr () as *const ::core ::ffi ::c_char ;
103- let mut str_concatenation: [::core ::ffi ::c_char ; 18 ] =
104- ::core ::mem ::transmute ::< [u8 ; 18 ], [::core ::ffi ::c_char ; 18 ]> (* b " hello hello world\0 " );
118+ let mut indexing: ::core ::ffi ::c_char = INDEXING ;
119+ let mut str_concatenation_ptr: *const ::core ::ffi ::c_char = STR_CONCATENATION .as_ptr ();
120+ let mut str_concatenation: [::core ::ffi ::c_char ; 18 ] = STR_CONCATENATION ;
105121 let mut builtin: ::core ::ffi ::c_int =
106122 (LITERAL_INT as ::core ::ffi ::c_uint ).leading_zeros () as i32 ;
107- let mut ref_indexing: *const ::core ::ffi ::c_char = NESTED_STR
108- .as_ptr ()
109- .offset (LITERAL_FLOAT as ::core ::ffi ::c_int as isize )
110- as *const ::core ::ffi ::c_char ;
111- let mut ref_struct: *const S = & mut LITERAL_STRUCT as *mut S ;
112- let mut ternary: ::core ::ffi ::c_int = if LITERAL_BOOL != 0 {
113- 1 as ::core ::ffi ::c_int
114- } else {
115- 2 as ::core ::ffi ::c_int
116- };
117- let mut member: ::core ::ffi ::c_int = LITERAL_STRUCT .i ;
123+ let mut ref_indexing: *const ::core ::ffi ::c_char = REF_MACRO ;
124+ let mut ref_struct: *const S = REF_LITERAL ;
125+ let mut ternary: ::core ::ffi ::c_int = TERNARY ;
126+ let mut member: ::core ::ffi ::c_int = MEMBER ;
118127 let mut stmt_expr: ::core ::ffi ::c_float = ({
119128 let mut builtin_0: ::core ::ffi ::c_int =
120129 (LITERAL_INT as ::core ::ffi ::c_uint ).leading_zeros () as i32 ;
121- let mut indexing_0 : ::core ::ffi ::c_char =
122- NESTED_STR [LITERAL_FLOAT as ::core ::ffi ::c_int as usize ];
123- let mut mixed : ::core ::ffi ::c_float = (LITERAL_INT as ::core ::ffi ::c_double
124- + NESTED_FLOAT * LITERAL_CHAR as ::core ::ffi ::c_double
125- - true_0 as ::core ::ffi ::c_double )
126- as ::core ::ffi ::c_float ;
130+ let mut indexing_0 : ::core ::ffi ::c_char = INDEXING ;
131+ let mut mixed : ::core ::ffi ::c_float = MIXED_ARITHMETIC as ::core ::ffi ::c_float ;
127132 let mut i : ::core ::ffi ::c_int = 0 as ::core ::ffi ::c_int ;
128133 while i < builtin_0 {
129134 mixed += indexing_0 as ::core ::ffi ::c_float ;
@@ -150,43 +155,27 @@ pub unsafe extern "C" fn local_consts() {
150155 let nested_str: [::core ::ffi ::c_char ; 6 ] = NESTED_STR ;
151156 let nested_array: [::core ::ffi ::c_int ; 3 ] = NESTED_ARRAY ;
152157 let nested_struct: S = NESTED_STRUCT ;
153- let negative_int: ::core ::ffi ::c_int = - LITERAL_INT ;
154- let int_arithmetic: ::core ::ffi ::c_int = NESTED_INT + LITERAL_INT + 1 as ::core ::ffi ::c_int ;
155- let mixed_arithmetic: ::core ::ffi ::c_float = (LITERAL_INT as ::core ::ffi ::c_double
156- + NESTED_FLOAT * LITERAL_CHAR as ::core ::ffi ::c_double
157- - true_0 as ::core ::ffi ::c_double )
158- as ::core ::ffi ::c_float ;
158+ let negative_int: ::core ::ffi ::c_int = NEGATIVE_INT ;
159+ let int_arithmetic: ::core ::ffi ::c_int = INT_ARITHMETIC ;
160+ let mixed_arithmetic: ::core ::ffi ::c_float = MIXED_ARITHMETIC as ::core ::ffi ::c_float ;
159161 let parens: ::core ::ffi ::c_int = PARENS ;
160162 let ptr_arithmetic: *const ::core ::ffi ::c_char = PTR_ARITHMETIC ;
161163 let widening_cast: ::core ::ffi ::c_ulonglong = WIDENING_CAST ;
162- let narrowing_cast: ::core ::ffi ::c_char = LITERAL_INT as :: core :: ffi :: c_char ;
164+ let narrowing_cast: ::core ::ffi ::c_char = NARROWING_CAST ;
163165 let conversion_cast: ::core ::ffi ::c_double = CONVERSION_CAST ;
164- let indexing: ::core ::ffi ::c_char = NESTED_STR [LITERAL_FLOAT as ::core ::ffi ::c_int as usize ];
165- let str_concatenation_ptr: *const ::core ::ffi ::c_char =
166- b " hello hello world\0 " .as_ptr () as *const ::core ::ffi ::c_char ;
167- let str_concatenation: [::core ::ffi ::c_char ; 18 ] =
168- ::core ::mem ::transmute ::< [u8 ; 18 ], [::core ::ffi ::c_char ; 18 ]> (* b " hello hello world\0 " );
166+ let indexing: ::core ::ffi ::c_char = INDEXING ;
167+ let str_concatenation_ptr: *const ::core ::ffi ::c_char = STR_CONCATENATION .as_ptr ();
168+ let str_concatenation: [::core ::ffi ::c_char ; 18 ] = STR_CONCATENATION ;
169169 let builtin: ::core ::ffi ::c_int = (LITERAL_INT as ::core ::ffi ::c_uint ).leading_zeros () as i32 ;
170- let ref_indexing: *const ::core ::ffi ::c_char = NESTED_STR
171- .as_ptr ()
172- .offset (LITERAL_FLOAT as ::core ::ffi ::c_int as isize )
173- as *const ::core ::ffi ::c_char ;
174- let ref_struct: *const S = & mut LITERAL_STRUCT as *mut S ;
175- let ternary: ::core ::ffi ::c_int = if LITERAL_BOOL != 0 {
176- 1 as ::core ::ffi ::c_int
177- } else {
178- 2 as ::core ::ffi ::c_int
179- };
180- let member: ::core ::ffi ::c_int = LITERAL_STRUCT .i ;
170+ let ref_indexing: *const ::core ::ffi ::c_char = REF_MACRO ;
171+ let ref_struct: *const S = REF_LITERAL ;
172+ let ternary: ::core ::ffi ::c_int = TERNARY ;
173+ let member: ::core ::ffi ::c_int = MEMBER ;
181174 let stmt_expr: ::core ::ffi ::c_float = ({
182175 let mut builtin_0: ::core ::ffi ::c_int =
183176 (LITERAL_INT as ::core ::ffi ::c_uint ).leading_zeros () as i32 ;
184- let mut indexing_0 : ::core ::ffi ::c_char =
185- NESTED_STR [LITERAL_FLOAT as ::core ::ffi ::c_int as usize ];
186- let mut mixed : ::core ::ffi ::c_float = (LITERAL_INT as ::core ::ffi ::c_double
187- + NESTED_FLOAT * LITERAL_CHAR as ::core ::ffi ::c_double
188- - true_0 as ::core ::ffi ::c_double )
189- as ::core ::ffi ::c_float ;
177+ let mut indexing_0 : ::core ::ffi ::c_char = INDEXING ;
178+ let mut mixed : ::core ::ffi ::c_float = MIXED_ARITHMETIC as ::core ::ffi ::c_float ;
190179 let mut i : ::core ::ffi ::c_int = 0 as ::core ::ffi ::c_int ;
191180 while i < builtin_0 {
192181 mixed += indexing_0 as ::core ::ffi ::c_float ;
@@ -215,30 +204,25 @@ static mut global_static_const_nested_str_ptr: *const ::core::ffi::c_char = NEST
215204static mut global_static_const_nested_str : [::core ::ffi ::c_char ; 6 ] = NESTED_STR ;
216205static mut global_static_const_nested_array : [::core ::ffi ::c_int ; 3 ] = NESTED_ARRAY ;
217206static mut global_static_const_nested_struct : S = NESTED_STRUCT ;
218- static mut global_static_const_negative_int : ::core ::ffi ::c_int = - LITERAL_INT ;
219- static mut global_static_const_int_arithmetic : ::core ::ffi ::c_int =
220- NESTED_INT + LITERAL_INT + 1 as ::core ::ffi ::c_int ;
207+ static mut global_static_const_negative_int : ::core ::ffi ::c_int = NEGATIVE_INT ;
208+ static mut global_static_const_int_arithmetic : ::core ::ffi ::c_int = INT_ARITHMETIC ;
221209static mut global_static_const_mixed_arithmetic : ::core ::ffi ::c_float =
222- (LITERAL_INT as ::core ::ffi ::c_double + NESTED_FLOAT * LITERAL_CHAR as ::core ::ffi ::c_double
223- - true_0 as ::core ::ffi ::c_double ) as ::core ::ffi ::c_float ;
210+ MIXED_ARITHMETIC as ::core ::ffi ::c_float ;
224211static mut global_static_const_parens : ::core ::ffi ::c_int = PARENS ;
225212static mut global_static_const_ptr_arithmetic : * const ::core: :ffi ::c_char =
226213 ::core ::ptr ::null ::< ::core ::ffi ::c_char > ();
227214static mut global_static_const_widening_cast : ::core ::ffi ::c_ulonglong = WIDENING_CAST ;
228- static mut global_static_const_narrowing_cast : ::core ::ffi ::c_char =
229- LITERAL_INT as ::core ::ffi ::c_char ;
215+ static mut global_static_const_narrowing_cast : ::core ::ffi ::c_char = NARROWING_CAST ;
230216static mut global_static_const_conversion_cast : ::core ::ffi ::c_double = CONVERSION_CAST ;
231217static mut global_static_const_indexing : ::core ::ffi ::c_char = 0 ;
232218static mut global_static_const_str_concatenation_ptr : * const ::core: :ffi ::c_char =
233- b " hello hello world\0 " .as_ptr () as *const ::core ::ffi ::c_char ;
234- static mut global_static_const_str_concatenation : [::core ::ffi ::c_char ; 18 ] = unsafe {
235- ::core ::mem ::transmute ::< [u8 ; 18 ], [::core ::ffi ::c_char ; 18 ]> (* b " hello hello world\0 " )
236- };
219+ STR_CONCATENATION .as_ptr ();
220+ static mut global_static_const_str_concatenation : [::core ::ffi ::c_char ; 18 ] = STR_CONCATENATION ;
237221static mut global_static_const_builtin : ::core ::ffi ::c_int =
238222 (LITERAL_INT as ::core ::ffi ::c_uint ).leading_zeros () as i32 ;
239223static mut global_static_const_ref_indexing : * const ::core: :ffi ::c_char =
240224 ::core ::ptr ::null ::< ::core ::ffi ::c_char > ();
241- static mut global_static_const_ref_struct : * const S = & LITERAL_STRUCT as * const S as * mut S ;
225+ static mut global_static_const_ref_struct : * const S = REF_LITERAL ;
242226static mut global_static_const_ternary : ::core ::ffi ::c_int = 0 ;
243227static mut global_static_const_member : ::core ::ffi ::c_int = 0 ;
244228#[no_mangle ]
@@ -278,14 +262,12 @@ pub static mut global_const_nested_array: [::core::ffi::c_int; 3] = NESTED_ARRAY
278262#[no_mangle ]
279263pub static mut global_const_nested_struct : S = NESTED_STRUCT ;
280264#[no_mangle ]
281- pub static mut global_const_negative_int : ::core ::ffi ::c_int = - LITERAL_INT ;
265+ pub static mut global_const_negative_int : ::core ::ffi ::c_int = NEGATIVE_INT ;
282266#[no_mangle ]
283- pub static mut global_const_int_arithmetic : ::core ::ffi ::c_int =
284- NESTED_INT + LITERAL_INT + 1 as ::core ::ffi ::c_int ;
267+ pub static mut global_const_int_arithmetic : ::core ::ffi ::c_int = INT_ARITHMETIC ;
285268#[no_mangle ]
286269pub static mut global_const_mixed_arithmetic : ::core ::ffi ::c_float =
287- (LITERAL_INT as ::core ::ffi ::c_double + NESTED_FLOAT * LITERAL_CHAR as ::core ::ffi ::c_double
288- - true_0 as ::core ::ffi ::c_double ) as ::core ::ffi ::c_float ;
270+ MIXED_ARITHMETIC as ::core ::ffi ::c_float ;
289271#[no_mangle ]
290272pub static mut global_const_parens : ::core ::ffi ::c_int = PARENS ;
291273#[no_mangle ]
@@ -294,27 +276,24 @@ pub static mut global_const_ptr_arithmetic: *const ::core::ffi::c_char =
294276#[no_mangle ]
295277pub static mut global_const_widening_cast : ::core ::ffi ::c_ulonglong = WIDENING_CAST ;
296278#[no_mangle ]
297- pub static mut global_const_narrowing_cast : ::core ::ffi ::c_char =
298- LITERAL_INT as ::core ::ffi ::c_char ;
279+ pub static mut global_const_narrowing_cast : ::core ::ffi ::c_char = NARROWING_CAST ;
299280#[no_mangle ]
300281pub static mut global_const_conversion_cast : ::core ::ffi ::c_double = CONVERSION_CAST ;
301282#[no_mangle ]
302283pub static mut global_const_indexing : ::core ::ffi ::c_char = 0 ;
303284#[no_mangle ]
304285pub static mut global_const_str_concatenation_ptr : * const ::core: :ffi ::c_char =
305- b " hello hello world \0 " .as_ptr () as * const :: core :: ffi :: c_char ;
286+ STR_CONCATENATION .as_ptr ();
306287#[no_mangle ]
307- pub static mut global_const_str_concatenation : [::core ::ffi ::c_char ; 18 ] = unsafe {
308- ::core ::mem ::transmute ::< [u8 ; 18 ], [::core ::ffi ::c_char ; 18 ]> (* b " hello hello world\0 " )
309- };
288+ pub static mut global_const_str_concatenation : [::core ::ffi ::c_char ; 18 ] = STR_CONCATENATION ;
310289#[no_mangle ]
311290pub static mut global_const_builtin : ::core ::ffi ::c_int =
312291 (LITERAL_INT as ::core ::ffi ::c_uint ).leading_zeros () as i32 ;
313292#[no_mangle ]
314293pub static mut global_const_ref_indexing : * const ::core: :ffi ::c_char =
315294 ::core ::ptr ::null ::< ::core ::ffi ::c_char > ();
316295#[no_mangle ]
317- pub static mut global_const_ref_struct : * const S = & LITERAL_STRUCT as * const S as * mut S ;
296+ pub static mut global_const_ref_struct : * const S = REF_LITERAL ;
318297#[no_mangle ]
319298pub static mut global_const_ternary : ::core ::ffi ::c_int = 0 ;
320299#[no_mangle ]
@@ -420,29 +399,15 @@ pub unsafe extern "C" fn late_init_var() -> ::core::ffi::c_int {
420399}
421400unsafe extern "C" fn c2rust_run_static_initializers() {
422401 global_static_const_ptr_arithmetic = PTR_ARITHMETIC ;
423- global_static_const_indexing = NESTED_STR [LITERAL_FLOAT as ::core ::ffi ::c_int as usize ];
424- global_static_const_ref_indexing = NESTED_STR
425- .as_ptr ()
426- .offset (LITERAL_FLOAT as ::core ::ffi ::c_int as isize )
427- as *const ::core ::ffi ::c_char ;
428- global_static_const_ternary = if LITERAL_BOOL != 0 {
429- 1 as ::core ::ffi ::c_int
430- } else {
431- 2 as ::core ::ffi ::c_int
432- };
433- global_static_const_member = LITERAL_STRUCT .i ;
402+ global_static_const_indexing = INDEXING ;
403+ global_static_const_ref_indexing = REF_MACRO ;
404+ global_static_const_ternary = TERNARY ;
405+ global_static_const_member = MEMBER ;
434406 global_const_ptr_arithmetic = PTR_ARITHMETIC ;
435- global_const_indexing = NESTED_STR [LITERAL_FLOAT as ::core ::ffi ::c_int as usize ];
436- global_const_ref_indexing = NESTED_STR
437- .as_ptr ()
438- .offset (LITERAL_FLOAT as ::core ::ffi ::c_int as isize )
439- as *const ::core ::ffi ::c_char ;
440- global_const_ternary = if LITERAL_BOOL != 0 {
441- 1 as ::core ::ffi ::c_int
442- } else {
443- 2 as ::core ::ffi ::c_int
444- };
445- global_const_member = LITERAL_STRUCT .i ;
407+ global_const_indexing = INDEXING ;
408+ global_const_ref_indexing = REF_MACRO ;
409+ global_const_ternary = TERNARY ;
410+ global_const_member = MEMBER ;
446411}
447412#[used]
448413#[cfg_attr(target_os = "linux", link_section = ".init_array")]
0 commit comments