Skip to content

Commit 7fc07ca

Browse files
committed
Add UnwindingInlineAsm
1 parent 7277046 commit 7fc07ca

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

src/asm.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ use std::borrow::Cow;
1212

1313
use crate::builder::Builder;
1414
use crate::context::CodegenCx;
15+
use crate::errors::UnwindingInlineAsm;
1516
use crate::type_of::LayoutGccExt;
1617
use crate::callee::get_fn;
1718

@@ -109,7 +110,7 @@ impl<'a, 'gcc, 'tcx> AsmBuilderMethods<'tcx> for Builder<'a, 'gcc, 'tcx> {
109110
fn codegen_inline_asm(&mut self, template: &[InlineAsmTemplatePiece], rust_operands: &[InlineAsmOperandRef<'tcx, Self>], options: InlineAsmOptions, span: &[Span], _instance: Instance<'_>, _dest_catch_funclet: Option<(Self::BasicBlock, Self::BasicBlock, Option<&Self::Funclet>)>) {
110111
if options.contains(InlineAsmOptions::MAY_UNWIND) {
111112
self.sess()
112-
.struct_span_err(span[0], "GCC backend does not support unwinding from inline asm")
113+
.create_err(UnwindingInlineAsm { span: span[0] })
113114
.emit();
114115
return;
115116
}

src/errors.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,10 @@ pub(crate) struct LinkageConstOrMutType {
1313
#[primary_span]
1414
pub span: Span
1515
}
16+
17+
#[derive(SessionDiagnostic)]
18+
#[diag(codegen_gcc::unwinding_inline_asm)]
19+
pub(crate) struct UnwindingInlineAsm {
20+
#[primary_span]
21+
pub span: Span
22+
}

0 commit comments

Comments
 (0)