diff options
author | Philip Herron <philip.herron@embecosm.com> | 2022-02-17 10:10:15 +0000 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2022-02-17 13:28:25 +0000 |
commit | 19c5dde80f28c67f657775f770922783faff4b89 (patch) | |
tree | aae90640247a6165ef0dcaaba6cc1eba1676e7ac /gcc | |
parent | 2c03f34027234cbd0e235de84ac04871ecf7b8f0 (diff) | |
download | gcc-19c5dde80f28c67f657775f770922783faff4b89.zip gcc-19c5dde80f28c67f657775f770922783faff4b89.tar.gz gcc-19c5dde80f28c67f657775f770922783faff4b89.tar.bz2 |
When we expand a macro we must visit it to ensure any cfg expansions or recursive macro expansion is required
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/rust/expand/rust-macro-expand.cc | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc index 306b2e5..bce5246 100644 --- a/gcc/rust/expand/rust-macro-expand.cc +++ b/gcc/rust/expand/rust-macro-expand.cc @@ -2535,6 +2535,11 @@ public: // I don't think any macro token trees can be stripped in any way expander.expand_invoc (macro_invoc); + + // we need to visit the expanded fragments since it may need cfg expansion + // and it may be recursive + for (auto &node : macro_invoc.get_fragment ().get_nodes ()) + node.accept_vis (*this); } void visit (AST::MetaItemPath &) override {} @@ -3401,11 +3406,16 @@ MacroExpander::match_fragment (Parser<MacroInvocLexer> &parser, // is meta attributes? case AST::MacroFragSpec::META: + // parser.parse_inner_attribute ? + // parser.parse_outer_attribute ? + // parser.parse_attribute_body ? + // parser.parse_doc_comment ? gcc_unreachable (); break; // what is TT? case AST::MacroFragSpec::TT: + // parser.parse_token_tree() ? gcc_unreachable (); break; @@ -3425,8 +3435,7 @@ MacroExpander::match_matcher (Parser<MacroInvocLexer> &parser, { if (depth_exceeds_recursion_limit ()) { - // FIXME location - rust_error_at (Location (), "reached recursion limit"); + rust_error_at (matcher.get_match_locus (), "reached recursion limit"); return false; } |