public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r12-5656] [Ada] Simplify building of inequality function body Date: Wed, 1 Dec 2021 10:25:18 +0000 (GMT) [thread overview] Message-ID: <20211201102518.CC9013858002@sourceware.org> (raw) https://gcc.gnu.org/g:659e775a17415341113dcbd4b23f52d6cd63f502 commit r12-5656-g659e775a17415341113dcbd4b23f52d6cd63f502 Author: Piotr Trojanek <trojanek@adacore.com> Date: Fri Nov 5 15:13:47 2021 +0100 [Ada] Simplify building of inequality function body gcc/ada/ * exp_ch3.adb (Make_Eq_Body): Refactor to avoid appending to an empty list; also, when exiting early we will not create any list; fix style in comment. Diff: --- gcc/ada/exp_ch3.adb | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/gcc/ada/exp_ch3.adb b/gcc/ada/exp_ch3.adb index c91008f69a8..6c3fb01fdf3 100644 --- a/gcc/ada/exp_ch3.adb +++ b/gcc/ada/exp_ch3.adb @@ -10138,7 +10138,6 @@ package body Exp_Ch3 is -- Local variables Loc : constant Source_Ptr := Sloc (Parent (Tag_Typ)); - Stmts : constant List_Id := New_List; Decl : Node_Id; Eq_Prim : Entity_Id; Left_Op : Entity_Id; @@ -10154,7 +10153,7 @@ package body Exp_Ch3 is -- the body executed is that of the overriding declaration, even if the -- overriding declaration is not visible at the place of the renaming; -- otherwise, the inherited or predefined subprogram is called, see - -- (RM 8.5.4(8)) + -- (RM 8.5.4(8)). -- Stage 1: Search for a renaming of the inequality primitive and also -- search for an overriding of the equality primitive located before the @@ -10264,18 +10263,18 @@ package body Exp_Ch3 is end; end if; - Append_To (Stmts, - Make_Simple_Return_Statement (Loc, - Expression => - Make_Op_Not (Loc, - Make_Function_Call (Loc, - Name => New_Occurrence_Of (Target, Loc), - Parameter_Associations => New_List ( - Make_Identifier (Loc, Chars (Left_Op)), - Make_Identifier (Loc, Chars (Right_Op))))))); - Set_Handled_Statement_Sequence - (Decl, Make_Handled_Sequence_Of_Statements (Loc, Stmts)); + (Decl, + Make_Handled_Sequence_Of_Statements (Loc, New_List ( + Make_Simple_Return_Statement (Loc, + Expression => + Make_Op_Not (Loc, + Make_Function_Call (Loc, + Name => New_Occurrence_Of (Target, Loc), + Parameter_Associations => New_List ( + Make_Identifier (Loc, Chars (Left_Op)), + Make_Identifier (Loc, Chars (Right_Op))))))))); + return Decl; end Make_Neq_Body;
reply other threads:[~2021-12-01 10:25 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20211201102518.CC9013858002@sourceware.org \ --to=pmderodat@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).