public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Marc Poulhi?s <dkm@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r15-200] ada: Support writable parameters in Depends with side-effects Date: Mon, 6 May 2024 09:18:00 +0000 (GMT) [thread overview] Message-ID: <20240506091800.89CE73858415@sourceware.org> (raw) https://gcc.gnu.org/g:0f3324fd8ba91b16905e4b03eaf1e35a728f1027 commit r15-200-g0f3324fd8ba91b16905e4b03eaf1e35a728f1027 Author: Piotr Trojanek <trojanek@adacore.com> Date: Thu Jan 4 15:01:55 2024 +0100 ada: Support writable parameters in Depends with side-effects Functions with side-effects can modify writable parameters of mode IN, so these parameters must be allowed to appear in their Depends aspects. gcc/ada/ * sem_prag.adb (Find_Role): Handle functions with side-effects like procedures. Diff: --- gcc/ada/sem_prag.adb | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 299e388167f..ab60a8ad1d5 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -1383,10 +1383,11 @@ package body Sem_Prag is (Item_Is_Input : out Boolean; Item_Is_Output : out Boolean) is - -- A constant or an IN parameter of a procedure or a protected - -- entry, if it is of an access-to-variable type, should be - -- handled like a variable, as the underlying memory pointed-to - -- can be modified. Use Adjusted_Kind to do this adjustment. + -- A constant or an IN parameter of a protected entry, procedure, + -- or function with side-effects, if it is of an + -- access-to-variable type, should be handled like a variable, as + -- the underlying memory pointed-to can be modified. Use + -- Adjusted_Kind to do this adjustment. Adjusted_Kind : Entity_Kind := Ekind (Item_Id); @@ -1394,11 +1395,15 @@ package body Sem_Prag is if (Ekind (Item_Id) in E_Constant | E_Generic_In_Parameter or else (Ekind (Item_Id) = E_In_Parameter - and then Ekind (Scope (Item_Id)) - not in E_Function | E_Generic_Function)) + and then + (Ekind (Scope (Item_Id)) not in E_Function + | E_Generic_Function + or else + Is_Function_With_Side_Effects (Scope (Item_Id))))) and then Is_Access_Variable (Etype (Item_Id)) - and then Ekind (Spec_Id) not in E_Function - | E_Generic_Function + and then (Ekind (Spec_Id) not in E_Function + | E_Generic_Function + or else Is_Function_With_Side_Effects (Spec_Id)) then Adjusted_Kind := E_Variable; end if;
reply other threads:[~2024-05-06 9:18 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=20240506091800.89CE73858415@sourceware.org \ --to=dkm@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).