From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 7905) id 41FAC3858287; Tue, 30 Jan 2024 11:58:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 41FAC3858287 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1706615914; bh=hMWjas5GM0waHQJLytxUs3XQQJIzL+DehRMUZvxtdwg=; h=From:To:Subject:Date:From; b=la5+289f0hGbC7Gqcr0U1agh6E60pspSHBtg5U9vZZLXK6gNP0nH5DJyLGKg1B84L CEFDu+qNsmzVaQyYTD1ZQWOXDVuknwE/e0PmmC6MlC8mf4RNSvKj4Ilg9aJjyZ6Blw Iu+K0X93x5OoaiJePFdymDahaTW4cr12aiTuzv28= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Arthur Cohen To: gcc-cvs@gcc.gnu.org Subject: [gcc r14-8545] gccrs: Emit an error on variadic non extern functions X-Act-Checkin: gcc X-Git-Author: Pierre-Emmanuel Patry X-Git-Refname: refs/heads/trunk X-Git-Oldrev: 685491f232459f6182899893a7326582e153f11e X-Git-Newrev: 162137fd260b31633f1dfca850704309e2a2f6f6 Message-Id: <20240130115834.41FAC3858287@sourceware.org> Date: Tue, 30 Jan 2024 11:58:34 +0000 (GMT) List-Id: https://gcc.gnu.org/g:162137fd260b31633f1dfca850704309e2a2f6f6 commit r14-8545-g162137fd260b31633f1dfca850704309e2a2f6f6 Author: Pierre-Emmanuel Patry Date: Mon Nov 20 11:19:46 2023 +0100 gccrs: Emit an error on variadic non extern functions Variadic regular functions were recently added in the parser as they should be rejected in the ast validation pass. This commit add the ast validation pass rejecting this kind of variadic arguments. gcc/rust/ChangeLog: * checks/errors/rust-ast-validation.cc (ASTValidation::visit): Add ast validation pass to reject variadic arguments on regular functions. Signed-off-by: Pierre-Emmanuel Patry Diff: --- gcc/rust/checks/errors/rust-ast-validation.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/gcc/rust/checks/errors/rust-ast-validation.cc b/gcc/rust/checks/errors/rust-ast-validation.cc index 673290959f4b..4142cc6317ee 100644 --- a/gcc/rust/checks/errors/rust-ast-validation.cc +++ b/gcc/rust/checks/errors/rust-ast-validation.cc @@ -93,6 +93,11 @@ ASTValidation::visit (AST::Function &function) function.get_self_param ()->get_locus (), "% parameter is only allowed in associated functions"); + if (function.is_variadic ()) + rust_error_at ( + function.get_function_params ().back ()->get_locus (), + "only foreign or % functions may be C-variadic"); + AST::ContextualASTVisitor::visit (function); }