diff options
Diffstat (limited to 'gcc/rust/expand/rust-macro-expand.cc')
-rw-r--r-- | gcc/rust/expand/rust-macro-expand.cc | 35 |
1 files changed, 9 insertions, 26 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc index a4ed36b..26f584d 100644 --- a/gcc/rust/expand/rust-macro-expand.cc +++ b/gcc/rust/expand/rust-macro-expand.cc @@ -310,7 +310,8 @@ public: { // supposedly does not require - cfg does nothing } - void visit (AST::MacroInvocationSemi ¯o_invoc) override + + void visit (AST::MacroInvocation ¯o_invoc) override { // initial strip test based on outer attrs expander.expand_cfg_attrs (macro_invoc.get_outer_attrs ()); @@ -326,9 +327,13 @@ public: // TODO: maybe have cfg! macro stripping behaviour here? - expander.expand_invoc_semi (macro_invoc); + if (macro_invoc.has_semicolon ()) + expander.expand_invoc_semi (macro_invoc); + else + expander.expand_invoc (macro_invoc); - // we need to visit the expanded fragments since it may need cfg expansion + // 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); @@ -2534,28 +2539,6 @@ public: expander.mappings->insert_macro_def (&rules_def); } - void visit (AST::MacroInvocation ¯o_invoc) override - { - // FIXME - // we probably need another recurision check here - - // initial strip test based on outer attrs - expander.expand_cfg_attrs (macro_invoc.get_outer_attrs ()); - if (expander.fails_cfg_with_expand (macro_invoc.get_outer_attrs ())) - { - macro_invoc.mark_for_strip (); - return; - } - - // 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 {} void visit (AST::MetaItemSeq &) override {} void visit (AST::MetaWord &) override {} @@ -3209,7 +3192,7 @@ MacroExpander::expand_invoc (AST::MacroInvocation &invoc) } void -MacroExpander::expand_invoc_semi (AST::MacroInvocationSemi &invoc) +MacroExpander::expand_invoc_semi (AST::MacroInvocation &invoc) { if (depth_exceeds_recursion_limit ()) { |