Remove extra newline in asm

This commit is contained in:
Antoni Boucher 2022-08-27 12:12:06 -04:00
parent 06b6ec0ebe
commit fc56c54416
3 changed files with 10 additions and 12 deletions

View File

@ -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-use.rs
src/test/ui/allocator/xcrate-use2.rs src/test/ui/allocator/xcrate-use2.rs
src/test/ui/asm/may_unwind.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/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-moved-locals.rs
src/test/ui/async-await/async-fn-size-uninit-locals.rs src/test/ui/async-await/async-fn-size-uninit-locals.rs

View File

@ -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/intrinsics/const-eval-select-x86_64.rs
src/test/ui/packed/packed-struct-drop-aligned.rs src/test/ui/packed/packed-struct-drop-aligned.rs
src/test/ui/packed/packed-struct-generic-layout.rs src/test/ui/packed/packed-struct-generic-layout.rs

View File

@ -695,17 +695,16 @@ impl<'gcc, 'tcx> AsmMethods<'tcx> for CodegenCx<'gcc, 'tcx> {
for piece in template { for piece in template {
match *piece { match *piece {
InlineAsmTemplatePiece::String(ref string) => { 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. // NOTE: gcc does not allow inline comment, so remove them.
let line = let comment_index = string[index..].find("//")
if let Some(index) = line.rfind("//") { .map(|comment_index| comment_index + index)
&line[..index] .unwrap_or(string.len());
} template_str.push_str(&string[index..comment_index]);
else { index = string[comment_index..].find('\n')
line .map(|index| index + comment_index)
}; .unwrap_or(string.len());
template_str.push_str(line);
template_str.push('\n');
} }
}, },
InlineAsmTemplatePiece::Placeholder { operand_idx, modifier: _, span: _ } => { InlineAsmTemplatePiece::Placeholder { operand_idx, modifier: _, span: _ } => {