aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-10-10 14:36:35 +0200
committerArthur Cohen <arthur.cohen@embecosm.com>2024-01-16 19:09:15 +0100
commit1e039d2f848a97994f909e239a0d4e17f8933f46 (patch)
treef3037a53ee0d79da8b8220e7056b4f2709cd2a32 /gcc
parent10af70269c8858444b8c5f7c22a5b51be7af9ac2 (diff)
downloadgcc-1e039d2f848a97994f909e239a0d4e17f8933f46.zip
gcc-1e039d2f848a97994f909e239a0d4e17f8933f46.tar.gz
gcc-1e039d2f848a97994f909e239a0d4e17f8933f46.tar.bz2
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 <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index dde3d63..1a04266 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -1133,7 +1133,8 @@ Parser<ManagedTokenSource>::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",