diff options
author | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-03-24 15:55:42 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2022-03-25 11:22:18 +0100 |
commit | 7fa6e72b1a1a18a8b511a796514bc32591b26e2f (patch) | |
tree | 0bb3a5f0719d3ac63b8a785366903889ffa58859 /gcc/rust | |
parent | 6c99a5a8f1a62976ff58d89034642f28128a2033 (diff) | |
download | gcc-7fa6e72b1a1a18a8b511a796514bc32591b26e2f.zip gcc-7fa6e72b1a1a18a8b511a796514bc32591b26e2f.tar.gz gcc-7fa6e72b1a1a18a8b511a796514bc32591b26e2f.tar.bz2 |
macros: Parse :meta properly
This allows us to match attribute bodies in macro invocations, which we
can use later down the line to perform conditional compilation
Diffstat (limited to 'gcc/rust')
-rw-r--r-- | gcc/rust/expand/rust-macro-expand.cc | 6 | ||||
-rw-r--r-- | gcc/rust/parse/rust-parse.h | 2 |
2 files changed, 2 insertions, 6 deletions
diff --git a/gcc/rust/expand/rust-macro-expand.cc b/gcc/rust/expand/rust-macro-expand.cc index 6227344..2620fea 100644 --- a/gcc/rust/expand/rust-macro-expand.cc +++ b/gcc/rust/expand/rust-macro-expand.cc @@ -490,11 +490,7 @@ 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 (); + parser.parse_attribute_body (); break; case AST::MacroFragSpec::TT: diff --git a/gcc/rust/parse/rust-parse.h b/gcc/rust/parse/rust-parse.h index 88bd311..1362c56 100644 --- a/gcc/rust/parse/rust-parse.h +++ b/gcc/rust/parse/rust-parse.h @@ -143,6 +143,7 @@ public: AST::Visibility parse_visibility (); std::unique_ptr<AST::IdentifierPattern> parse_identifier_pattern (); std::unique_ptr<AST::TokenTree> parse_token_tree (); + AST::Attribute parse_attribute_body (); private: void skip_after_semicolon (); @@ -162,7 +163,6 @@ private: AST::Attribute parse_inner_attribute (); AST::AttrVec parse_outer_attributes (); AST::Attribute parse_outer_attribute (); - AST::Attribute parse_attribute_body (); std::unique_ptr<AST::AttrInput> parse_attr_input (); AST::Attribute parse_doc_comment (); |