aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>2023-10-23 13:41:35 +0200
committerPhilip Herron <philip.herron@embecosm.com>2023-11-09 15:39:45 +0000
commit6b500406a1c4fcb4aeadda9fb0f6794e4ecb901f (patch)
tree66e741cee8601582a340e63b5208914fb6e3f73c /gcc
parenta5edbe7783225c086d566edefb74187a5c61d1ed (diff)
downloadgcc-6b500406a1c4fcb4aeadda9fb0f6794e4ecb901f.zip
gcc-6b500406a1c4fcb4aeadda9fb0f6794e4ecb901f.tar.gz
gcc-6b500406a1c4fcb4aeadda9fb0f6794e4ecb901f.tar.bz2
Parse named variadic parameters
Add ability to parse named variadic parameters in extern c functions. gcc/rust/ChangeLog: * parse/rust-parse-impl.h (Parser::parse_named_function_param): Add new parsing ability. Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/parse/rust-parse-impl.h9
1 files changed, 8 insertions, 1 deletions
diff --git a/gcc/rust/parse/rust-parse-impl.h b/gcc/rust/parse/rust-parse-impl.h
index cbf4140..f08ab69 100644
--- a/gcc/rust/parse/rust-parse-impl.h
+++ b/gcc/rust/parse/rust-parse-impl.h
@@ -5970,7 +5970,7 @@ Parser<ManagedTokenSource>::parse_named_function_param ()
AST::AttrVec outer_attrs = parse_outer_attributes ();
location_t locus = lexer.peek_token ()->get_locus ();
- if (lexer.peek_token ()->get_id () == ELLIPSIS)
+ if (lexer.peek_token ()->get_id () == ELLIPSIS) // Unnamed variadic
{
lexer.skip_token (); // Skip ellipsis
return AST::NamedFunctionParam (std::move (outer_attrs), locus);
@@ -6002,6 +6002,13 @@ Parser<ManagedTokenSource>::parse_named_function_param ()
return AST::NamedFunctionParam::create_error ();
}
+ if (lexer.peek_token ()->get_id () == ELLIPSIS) // Named variadic
+ {
+ lexer.skip_token (); // Skip ellipsis
+ return AST::NamedFunctionParam (std::move (name), std::move (outer_attrs),
+ locus);
+ }
+
// parse (required) type
std::unique_ptr<AST::Type> param_type = parse_type ();
if (param_type == nullptr)