aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/hir/tree
diff options
context:
space:
mode:
authorArthur Cohen <arthur.cohen@embecosm.com>2024-06-14 16:45:34 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2025-03-17 16:35:49 +0100
commitd129c4ed8045f2e5f53b5cdddfd4caec1aa9d8e9 (patch)
treec0949facaba007fc8b71d95547dacc1cffa41bc8 /gcc/rust/hir/tree
parenta3e002aa61e5d2effe7de143604431299114a0ae (diff)
downloadgcc-d129c4ed8045f2e5f53b5cdddfd4caec1aa9d8e9.zip
gcc-d129c4ed8045f2e5f53b5cdddfd4caec1aa9d8e9.tar.gz
gcc-d129c4ed8045f2e5f53b5cdddfd4caec1aa9d8e9.tar.bz2
gccrs: expand: Keep track of semicoloned builtin macros
This is quite a rough fix (like a lot of the macro expansion code...) but it allows built-in macros to be treated as statements. I *think* asm!() might be the only one where it really matters, but also doing something like { line!(); } will now work, whereas before the macro invocation would not get expanded properly and would be ignored. gcc/rust/ChangeLog: * ast/rust-ast-fragment.h: Pass `is_semicolon` information to builtin macro transcribers. * ast/rust-macro.h: Pass semicolon information to transcriber.. * expand/rust-macro-builtins-asm.cc (MacroBuiltin::asm_handler): Likewise. (parse_asm): Likewise. * expand/rust-macro-builtins-asm.h (parse_asm): Likewise. * expand/rust-macro-builtins-format-args.cc (MacroBuiltin::format_args_handler): Likewise. * expand/rust-macro-builtins-include.cc (MacroBuiltin::include_bytes_handler): Likewise. (MacroBuiltin::include_str_handler): Likewise. (MacroBuiltin::include_handler): Likewise. * expand/rust-macro-builtins-location.cc (MacroBuiltin::file_handler): Likewise. (MacroBuiltin::column_handler): Likewise. (MacroBuiltin::line_handler): Likewise. * expand/rust-macro-builtins-log-debug.cc (MacroBuiltin::assert_handler): Likewise. * expand/rust-macro-builtins-utility.cc (MacroBuiltin::compile_error_handler): Likewise. (MacroBuiltin::concat_handler): Likewise. (MacroBuiltin::env_handler): Likewise. (MacroBuiltin::cfg_handler): Likewise. (MacroBuiltin::stringify_handler): Likewise. * expand/rust-macro-builtins.cc (format_args_maker): Likewise. (inline_asm_maker): Likewise. (MacroBuiltin::sorry): Likewise. (MacroBuiltin::proc_macro_builtin): Likewise. * expand/rust-macro-builtins.h: Likewise. * expand/rust-macro-expand.cc (MacroExpander::expand_decl_macro): Likewise. (MacroExpander::expand_invoc): Likewise. * ast/rust-ast-visitor.cc (DefaultASTVisitor::visit): Remove rust_unreachable. * ast/rust-ast.cc (InlineAsm::accept_vis): Likewise. * hir/tree/rust-hir.cc (InlineAsm::accept_vis): Likewise.
Diffstat (limited to 'gcc/rust/hir/tree')
-rw-r--r--gcc/rust/hir/tree/rust-hir.cc5
1 files changed, 1 insertions, 4 deletions
diff --git a/gcc/rust/hir/tree/rust-hir.cc b/gcc/rust/hir/tree/rust-hir.cc
index bcaf66e..8388d58 100644
--- a/gcc/rust/hir/tree/rust-hir.cc
+++ b/gcc/rust/hir/tree/rust-hir.cc
@@ -3772,14 +3772,11 @@ BorrowExpr::accept_vis (HIRFullVisitor &vis)
void
InlineAsm::accept_vis (HIRExpressionVisitor &vis)
-{
- rust_unreachable ();
-}
+{}
void
InlineAsm::accept_vis (HIRFullVisitor &vis)
{
- rust_unreachable ();
vis.visit (*this);
}