Merge pull request #210 from rust-lang/fix/asm-newline
Remove extra newline in asm
This commit is contained in:
commit
866f9c527a
@ -8,8 +8,6 @@ src/test/ui/allocator/no_std-alloc-error-handler-default.rs
|
||||
src/test/ui/allocator/xcrate-use.rs
|
||||
src/test/ui/allocator/xcrate-use2.rs
|
||||
src/test/ui/asm/may_unwind.rs
|
||||
src/test/ui/asm/x86_64/const.rs
|
||||
src/test/ui/asm/x86_64/issue-96797.rs
|
||||
src/test/ui/asm/x86_64/multiple-clobber-abi.rs
|
||||
src/test/ui/async-await/async-fn-size-moved-locals.rs
|
||||
src/test/ui/async-await/async-fn-size-uninit-locals.rs
|
||||
|
@ -1,3 +1,4 @@
|
||||
src/test/ui/asm/x86_64/issue-96797.rs
|
||||
src/test/ui/intrinsics/const-eval-select-x86_64.rs
|
||||
src/test/ui/packed/packed-struct-drop-aligned.rs
|
||||
src/test/ui/packed/packed-struct-generic-layout.rs
|
||||
|
19
src/asm.rs
19
src/asm.rs
@ -695,17 +695,16 @@ fn codegen_global_asm(&self, template: &[InlineAsmTemplatePiece], operands: &[Gl
|
||||
for piece in template {
|
||||
match *piece {
|
||||
InlineAsmTemplatePiece::String(ref string) => {
|
||||
for line in string.lines() {
|
||||
let mut index = 0;
|
||||
while index < string.len() {
|
||||
// NOTE: gcc does not allow inline comment, so remove them.
|
||||
let line =
|
||||
if let Some(index) = line.rfind("//") {
|
||||
&line[..index]
|
||||
}
|
||||
else {
|
||||
line
|
||||
};
|
||||
template_str.push_str(line);
|
||||
template_str.push('\n');
|
||||
let comment_index = string[index..].find("//")
|
||||
.map(|comment_index| comment_index + index)
|
||||
.unwrap_or(string.len());
|
||||
template_str.push_str(&string[index..comment_index]);
|
||||
index = string[comment_index..].find('\n')
|
||||
.map(|index| index + comment_index)
|
||||
.unwrap_or(string.len());
|
||||
}
|
||||
},
|
||||
InlineAsmTemplatePiece::Placeholder { operand_idx, modifier: _, span: _ } => {
|
||||
|
Loading…
Reference in New Issue
Block a user