A missing comma between inline assembly templates did not throw an error
and looped indefinitely.
gcc/rust/ChangeLog:
* expand/rust-macro-builtins-asm.cc (parse_format_strings): Emit an
error when expecting a comma.
gcc/testsuite/ChangeLog:
* rust/compile/issue-4006.rs: New test.
Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
{
if (!parser.skip_token (COMMA))
{
- break;
+ rust_error_at (parser.peek_current_token ()->get_locus (),
+ "expected token %qs", ";");
+ return tl::unexpected<InlineAsmParseError> (COMMITTED);
}
// Ok after the comma is good, we better be parsing correctly
// everything in here, which is formatted string in ABNF
--- /dev/null
+#![feature(rustc_attrs)]
+
+#[rustc_builtin_macro]
+macro_rules! asm {
+ () => {};
+}
+
+pub fn main() {
+ asm!(
+ "xor eax, eax"
+ "xor eax, eax");
+ // { dg-error "expected token .;." "" { target *-*-* } .-1 }
+}