diff options
author | liushuyu <liushuyu011@gmail.com> | 2022-07-19 12:32:26 -0600 |
---|---|---|
committer | liushuyu <liushuyu011@gmail.com> | 2022-07-19 12:44:13 -0600 |
commit | 0340a567fedab5f902febcea8f415943ca85b330 (patch) | |
tree | 0b9c5f225860942a490a7ba673e514f1f84bfff5 /gcc | |
parent | 903b7de01555f2e09df3ec3ccb0edcc3e77f9a5e (diff) | |
download | gcc-0340a567fedab5f902febcea8f415943ca85b330.zip gcc-0340a567fedab5f902febcea8f415943ca85b330.tar.gz gcc-0340a567fedab5f902febcea8f415943ca85b330.tar.bz2 |
expand/attr-visitor: recursively expand the macros if needed
Signed-off-by: Zixing Liu <liushuyu011@gmail.com>
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/expand/rust-attribute-visitor.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/rust/expand/rust-attribute-visitor.cc b/gcc/rust/expand/rust-attribute-visitor.cc index 6cd894d..bbcf2cb 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 |