From 1e039d2f848a97994f909e239a0d4e17f8933f46 Mon Sep 17 00:00:00 2001 From: Pierre-Emmanuel Patry Date: Tue, 10 Oct 2023 14:36:35 +0200 Subject: [PATCH] gccrs: Allow call to macro named "default" at item level The parser was too agressive and did reject any line beginning with default even if this was a macro call. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_item): Relax constraints around default identifier at item scope to accept "default" macros. Signed-off-by: Pierre-Emmanuel Patry --- gcc/rust/parse/rust-parse-impl.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h index dde3d63201e2..1a042661568b 100644 --- a/gcc/rust/parse/rust-parse-impl.h +++ b/gcc/rust/parse/rust-parse-impl.h @@ -1133,7 +1133,8 @@ Parser::parse_item (bool called_from_statement) return parse_vis_item (std::move (outer_attrs)); // or should this go straight to parsing union? } - else if (t->get_str () == "default") + else if (t->get_str () == "default" + && lexer.peek_token (1)->get_id () != EXCLAM) { add_error (Error (t->get_locus (), "%qs is only allowed on items within %qs blocks", -- 2.47.2