Skip to content

Commit 12257cc

Browse files
committed
Format and fix clippy warnings
1 parent 7b519d6 commit 12257cc

File tree

5 files changed

+45
-39
lines changed

5 files changed

+45
-39
lines changed

build_system/src/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ pub fn build_sysroot(env: &HashMap<String, String>, config: &ConfigInfo) -> Resu
130130
if config.no_default_features {
131131
rustflags.push_str(" -Csymbol-mangling-version=v0");
132132
}
133-
rustflags.push_str(" --print link-args");
133+
//rustflags.push_str(" --print link-args");
134134

135135
let mut args: Vec<&dyn AsRef<OsStr>> = vec![&"cargo", &"build", &"--target", &config.target];
136136
for feature in &config.features {

build_system/src/test.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -695,8 +695,8 @@ fn test_libcore(env: &Env, args: &TestArg) -> Result<(), String> {
695695
/*let mut env = env.clone();
696696
env.insert("RUSTC_LOG".to_string(), "rustc_codegen_ssa::back::link=info".to_string());*/
697697
/*let rustflags =
698-
env.entry("RUSTFLAGS".to_string())
699-
.or_default();*/
698+
env.entry("RUSTFLAGS".to_string())
699+
.or_default();*/
700700
//rustflags.push_str(" -C link-arg=-Wl,--verbose");
701701
//rustflags.push_str(" -C link-arg=-Wl,--fatal-warnings");
702702
//rustflags.push_str(" -C link-arg=-Wl,--warn-unresolved-symbols");

src/back/write.rs

Lines changed: 38 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use std::{env, fs};
22

3-
use gccjit::{Context, OutputKind};
3+
use gccjit::OutputKind;
44
use rustc_codegen_ssa::back::link::ensure_removed;
55
use rustc_codegen_ssa::back::write::{BitcodeSection, CodegenContext, EmitObj, ModuleConfig};
66
use rustc_codegen_ssa::{CompiledModule, ModuleCodegen};
@@ -34,10 +34,10 @@ pub(crate) unsafe fn codegen(
3434
// TODO: remove this environment variable.
3535
let fat_lto = env::var("EMBED_LTO_BITCODE").as_deref() == Ok("1");
3636

37-
if cgcx.msvc_imps_needed {
37+
/*if cgcx.msvc_imps_needed {
3838
println!("************************************************** Imps needed");
3939
create_msvc_imps(cgcx, context);
40-
}
40+
}*/
4141

4242
let bc_out = cgcx.output_filenames.temp_path(OutputType::Bitcode, module_name);
4343
let obj_out = cgcx.output_filenames.temp_path(OutputType::Object, module_name);
@@ -58,56 +58,67 @@ pub(crate) unsafe fn codegen(
5858
}*/
5959

6060
if config.emit_bc || config.emit_obj == EmitObj::Bitcode {
61-
let _timer = cgcx
62-
.prof
63-
.generic_activity_with_arg("GCC_module_codegen_emit_bitcode", &*module.name);
61+
let _timer = cgcx.prof.generic_activity_with_arg(
62+
"GCC_module_codegen_emit_bitcode",
63+
&*module.name,
64+
);
6465
context.add_command_line_option("-flto=auto");
6566
context.add_command_line_option("-flto-partition=one");
6667
// TODO: remove since we don't want fat objects when it is for Bitcode only.
6768
context.add_command_line_option("-ffat-lto-objects");
68-
context
69-
.compile_to_file(OutputKind::ObjectFile, bc_out.to_str().expect("path to str"));
69+
context.compile_to_file(
70+
OutputKind::ObjectFile,
71+
bc_out.to_str().expect("path to str"),
72+
);
7073
}
7174

7275
if config.emit_obj == EmitObj::ObjectCode(BitcodeSection::Full) {
73-
let _timer = cgcx
74-
.prof
75-
.generic_activity_with_arg("GCC_module_codegen_embed_bitcode", &*module.name);
76+
let _timer = cgcx.prof.generic_activity_with_arg(
77+
"GCC_module_codegen_embed_bitcode",
78+
&*module.name,
79+
);
7680
// TODO(antoyo): maybe we should call embed_bitcode to have the proper iOS fixes?
7781
//embed_bitcode(cgcx, llcx, llmod, &config.bc_cmdline, data);
7882

7983
context.add_command_line_option("-flto=auto");
8084
context.add_command_line_option("-flto-partition=one");
8185
context.add_command_line_option("-ffat-lto-objects");
8286
// TODO(antoyo): Send -plugin/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/liblto_plugin.so to linker (this should be done when specifying the appropriate rustc cli argument).
83-
context
84-
.compile_to_file(OutputKind::ObjectFile, bc_out.to_str().expect("path to str"));
87+
context.compile_to_file(
88+
OutputKind::ObjectFile,
89+
bc_out.to_str().expect("path to str"),
90+
);
8591
}
86-
}
87-
else {
92+
} else {
8893
if config.emit_bc || config.emit_obj == EmitObj::Bitcode {
89-
let _timer = cgcx
90-
.prof
91-
.generic_activity_with_arg("GCC_module_codegen_emit_bitcode", &*module.name);
92-
context
93-
.compile_to_file(OutputKind::ObjectFile, bc_out.to_str().expect("path to str"));
94+
let _timer = cgcx.prof.generic_activity_with_arg(
95+
"GCC_module_codegen_emit_bitcode",
96+
&*module.name,
97+
);
98+
context.compile_to_file(
99+
OutputKind::ObjectFile,
100+
bc_out.to_str().expect("path to str"),
101+
);
94102
}
95103

96104
if config.emit_obj == EmitObj::ObjectCode(BitcodeSection::Full) {
97105
// TODO: we might want to emit to emit an error here, saying to set the
98106
// environment variable EMBED_LTO_BITCODE.
99-
let _timer = cgcx
100-
.prof
101-
.generic_activity_with_arg("GCC_module_codegen_embed_bitcode", &*module.name);
107+
let _timer = cgcx.prof.generic_activity_with_arg(
108+
"GCC_module_codegen_embed_bitcode",
109+
&*module.name,
110+
);
102111
// TODO(antoyo): maybe we should call embed_bitcode to have the proper iOS fixes?
103112
//embed_bitcode(cgcx, llcx, llmod, &config.bc_cmdline, data);
104113

105114
context.add_command_line_option("-flto=auto");
106115
context.add_command_line_option("-flto-partition=one");
107116
context.add_command_line_option("-ffat-lto-objects");
108117
// TODO(antoyo): Send -plugin/usr/lib/gcc/x86_64-pc-linux-gnu/11.1.0/liblto_plugin.so to linker (this should be done when specifying the appropriate rustc cli argument).
109-
context
110-
.compile_to_file(OutputKind::ObjectFile, bc_out.to_str().expect("path to str"));
118+
context.compile_to_file(
119+
OutputKind::ObjectFile,
120+
bc_out.to_str().expect("path to str"),
121+
);
111122
}
112123
}
113124
}
@@ -230,10 +241,7 @@ pub(crate) fn save_temp_bitcode(
230241
}*/
231242
}
232243

233-
fn create_msvc_imps<'gcc>(
234-
cgcx: &CodegenContext<GccCodegenBackend>,
235-
_context: &Context<'gcc>,
236-
) {
244+
/*fn create_msvc_imps<'gcc>(cgcx: &CodegenContext<GccCodegenBackend>, _context: &Context<'gcc>) {
237245
if !cgcx.msvc_imps_needed {
238246
return;
239247
}
@@ -259,4 +267,4 @@ fn create_msvc_imps<'gcc>(
259267
llvm::set_linkage(imp, llvm::Linkage::ExternalLinkage);
260268
}
261269
}*/
262-
}
270+
}*/

src/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,17 +156,17 @@ pub fn compile_codegen_unit(
156156
//println!("*** Static");
157157
context.add_command_line_option("-fno-pie");
158158
context.add_driver_option("-fno-pie");
159-
},
159+
}
160160
rustc_target::spec::RelocModel::Pic => {
161161
//println!("*** Pic");
162162
context.add_command_line_option("-fPIC");
163163
context.add_driver_option("-fPIC");
164-
},
164+
}
165165
rustc_target::spec::RelocModel::Pie => {
166166
//println!("*** Pie");
167167
context.add_command_line_option("-fPIE");
168168
context.add_driver_option("-fPIE");
169-
},
169+
}
170170
model => eprintln!("Unsupported relocation model: {:?}", model),
171171
}
172172

src/consts.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ impl<'gcc, 'tcx> StaticCodegenMethods for CodegenCx<'gcc, 'tcx> {
9292
}
9393
set_global_alignment(self, global, alloc.align);
9494

95-
9695
// TODO: if I still use this code, find the name of the variable in a better way (using
9796
// def_id).
9897
let var_name = format!("{:?}", global);
@@ -169,8 +168,7 @@ impl<'gcc, 'tcx> StaticCodegenMethods for CodegenCx<'gcc, 'tcx> {
169168
let value = self.context.new_bitcast(None, value, val_llty);*/
170169
global.global_set_initializer_rvalue(value);
171170
//println!("=== AFTER INITIALIZE");
172-
}
173-
else {
171+
} else {
174172
global.global_set_initializer_rvalue(value);
175173
}
176174

0 commit comments

Comments
 (0)