public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Thomas Schwinge <tschwinge@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/rust/master] expand/attr-visitor: recursively expand the macros if needed Date: Fri, 22 Jul 2022 13:34:26 +0000 (GMT) [thread overview] Message-ID: <20220722133426.16411383541F@sourceware.org> (raw) https://gcc.gnu.org/g:0340a567fedab5f902febcea8f415943ca85b330 commit 0340a567fedab5f902febcea8f415943ca85b330 Author: liushuyu <liushuyu011@gmail.com> Date: Tue Jul 19 12:32:26 2022 -0600 expand/attr-visitor: recursively expand the macros if needed Signed-off-by: Zixing Liu <liushuyu011@gmail.com> Diff: --- gcc/rust/expand/rust-attribute-visitor.cc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gcc/rust/expand/rust-attribute-visitor.cc b/gcc/rust/expand/rust-attribute-visitor.cc index 6cd894d261e..bbcf2cbadd0 100644 --- a/gcc/rust/expand/rust-attribute-visitor.cc +++ b/gcc/rust/expand/rust-attribute-visitor.cc @@ -3431,8 +3431,17 @@ void AttrVisitor::maybe_expand_expr (std::unique_ptr<AST::Expr> &expr) { auto fragment = expander.take_expanded_fragment (*this); - if (fragment.should_expand ()) - expr = fragment.take_expression_fragment (); + unsigned int original_depth = expander.expansion_depth; + while (fragment.should_expand ()) + { + expr = fragment.take_expression_fragment (); + expander.expansion_depth++; + auto new_fragment = expander.take_expanded_fragment (*this); + if (new_fragment.is_error ()) + break; + fragment = std::move (new_fragment); + } + expander.expansion_depth = original_depth; } void
reply other threads:[~2022-07-22 13:34 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20220722133426.16411383541F@sourceware.org \ --to=tschwinge@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).