Codebase list rust-stfu8 / 5c260e3
update of cpp-macros Sylvestre Ledru 3 years ago
2 changed file(s) with 98 addition(s) and 0 deletion(s). Raw diff Collapse all Expand all
0 Index: cpp-macros/Cargo.toml
1 ===================================================================
2 --- cpp-macros.orig/Cargo.toml
3 +++ cpp-macros/Cargo.toml
4 @@ -28,7 +28,7 @@ features = ["docs-only"]
5 [lib]
6 proc-macro = true
7 [dependencies.aho-corasick]
8 -version = "0.7.15"
9 +version = "0.7"
10
11 [dependencies.byteorder]
12 version = "1.0"
13 @@ -36,8 +36,8 @@ version = "1.0"
14 [dependencies.cpp_common]
15 version = "=0.5.6"
16
17 -[dependencies.if_rust_version]
18 -version = "1.0"
19 +#[dependencies.if_rust_version]
20 +#version = "1.0"
21
22 [dependencies.lazy_static]
23 version = "1.0"
24 Index: cpp-macros/src/lib.rs
25 ===================================================================
26 --- cpp-macros.orig/src/lib.rs
27 +++ cpp-macros/src/lib.rs
28 @@ -17,7 +17,7 @@ use syn::parse::Parser;
29 use syn::Ident;
30
31 use byteorder::{LittleEndian, ReadBytesExt};
32 -use if_rust_version::if_rust_version;
33 +//use if_rust_version::if_rust_version;
34 use lazy_static::lazy_static;
35 use quote::{quote, quote_spanned};
36 use std::fs::File;
37 @@ -304,17 +304,18 @@ NOTE: They cannot be generated by macro
38 const _assert_align: [(); #ret_align] = [(); ::core::mem::align_of::<#ret_ty>()];
39 }
40 };
41 - if_rust_version!(>= 1.36 { quote!(
42 +/* if_rust_version!(>= 1.36 {*/ quote!(
43 #assert_size
44 let mut result = ::core::mem::MaybeUninit::<#ret_ty>::uninit();
45 #extern_name(#(#call_args,)* result.as_mut_ptr());
46 result.assume_init()
47 - )} else { quote!(
48 + )
49 +/* )} else { quote!(
50 #assert_size
51 let mut result: #ret_ty = ::core::mem::uninitialized();
52 #extern_name(#(#call_args,)* &mut result);
53 result
54 - )})
55 + )})*/
56 };
57
58 let input = proc_macro2::TokenStream::from_iter([closure.body].iter().cloned());
59 @@ -471,15 +472,15 @@ NOTE: They cannot be generated by macro
60
61 if size_data[0].has_flag(flags::IS_COPY_CONSTRUCTIBLE) {
62 if !size_data[0].has_flag(flags::IS_TRIVIALLY_COPYABLE) && !class.derives("Copy") {
63 - let call_construct = if_rust_version!(>= 1.36 { quote!(
64 + let call_construct = /*if_rust_version!(>= 1.36 { */quote!(
65 let mut result = ::core::mem::MaybeUninit::<Self>::uninit();
66 #copyctr_name(& *self, result.as_mut_ptr());
67 result.assume_init()
68 - )} else { quote!(
69 + )/*} else { quote!(
70 let mut result : Self = ::core::mem::uninitialized();
71 #copyctr_name(& *self, &mut result);
72 result
73 - )});
74 + )})*/;
75 result = quote! { #result
76 impl ::core::clone::Clone for #class_name {
77 fn clone(&self) -> Self {
78 @@ -503,15 +504,15 @@ NOTE: They cannot be generated by macro
79 }
80
81 if size_data[0].has_flag(flags::IS_DEFAULT_CONSTRUCTIBLE) {
82 - let call_construct = if_rust_version!(>= 1.36 { quote!(
83 + let call_construct = /*if_rust_version!(>= 1.36 { */quote!(
84 let mut result = ::core::mem::MaybeUninit::<Self>::uninit();
85 #defaultctr_name(result.as_mut_ptr());
86 result.assume_init()
87 - )} else { quote!(
88 + )/*} else { quote!(
89 let mut result : Self = ::core::mem::uninitialized();
90 #defaultctr_name(&mut result);
91 result
92 - )});
93 + )})*/;
94 result = quote! { #result
95 impl ::core::default::Default for #class_name {
96 fn default() -> Self {