From 7ab0b0cd41fc4bf567694ebedb2d927da9bf2551 Mon Sep 17 00:00:00 2001 From: Eduard Burtescu Date: Thu, 17 Oct 2013 21:24:41 +0300 Subject: Handle inline asm outputs as write-only in liveness, borrowck and trans. --- src/libsyntax/ext/asm.rs | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/libsyntax') diff --git a/src/libsyntax/ext/asm.rs b/src/libsyntax/ext/asm.rs index e836367555a..f4b1c7f1f06 100644 --- a/src/libsyntax/ext/asm.rs +++ b/src/libsyntax/ext/asm.rs @@ -75,16 +75,18 @@ pub fn expand_asm(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) } let (constraint, _str_style) = p.parse_str(); + + if constraint.starts_with("+") { + cx.span_unimpl(*p.last_span, + "'+' (read+write) output operand constraint modifier"); + } else if !constraint.starts_with("=") { + cx.span_err(*p.last_span, "output operand constraint lacks '='"); + } + p.expect(&token::LPAREN); let out = p.parse_expr(); p.expect(&token::RPAREN); - let out = @ast::Expr { - id: ast::DUMMY_NODE_ID, - span: out.span, - node: ast::ExprAddrOf(ast::MutMutable, out) - }; - outputs.push((constraint, out)); } } @@ -98,6 +100,13 @@ pub fn expand_asm(cx: @ExtCtxt, sp: Span, tts: &[ast::token_tree]) } let (constraint, _str_style) = p.parse_str(); + + if constraint.starts_with("=") { + cx.span_err(*p.last_span, "input operand constraint contains '='"); + } else if constraint.starts_with("+") { + cx.span_err(*p.last_span, "input operand constraint contains '+'"); + } + p.expect(&token::LPAREN); let input = p.parse_expr(); p.expect(&token::RPAREN); -- cgit 1.4.1-3-g733a5