public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Iain D Sandoe <iains@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc/devel/c++-coroutines] [Ada] Additional warnings on overlapping actuals of composite types Date: Wed, 10 Jun 2020 23:26:52 +0000 (GMT) [thread overview] Message-ID: <20200610232652.39A53388F05D@sourceware.org> (raw) https://gcc.gnu.org/g:f95fb9d019147b2af0c8107d6c6a6e2b6034d9fe commit f95fb9d019147b2af0c8107d6c6a6e2b6034d9fe Author: Ed Schonberg <schonberg@adacore.com> Date: Mon Mar 9 16:36:55 2020 -0400 [Ada] Additional warnings on overlapping actuals of composite types 2020-06-10 Ed Schonberg <schonberg@adacore.com> gcc/ada/ * sem_warn.adb (Warn_On_Overlapping_Actuals): Add a warning when two actuals in a call overlap, both are composite types that may be passed by reference, and only one of them is writable. Diff: --- gcc/ada/sem_warn.adb | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/gcc/ada/sem_warn.adb b/gcc/ada/sem_warn.adb index b84e82e989a..a3195a19369 100644 --- a/gcc/ada/sem_warn.adb +++ b/gcc/ada/sem_warn.adb @@ -3742,10 +3742,26 @@ package body Sem_Warn is -- If appropriate warning switch is set, we also report warnings on -- overlapping parameters that are record types or array types. + -- It is also worthwhile to warn on overlaps of composite objects when + -- only one of the formals is (in)-out. Note that the RM rule above is + -- a legality rule. We choose to implement this check as a warning to + -- avoid major incompatibilities with legacy code. We exclude internal + -- sources from the warning, because subprograms in Container libraries + -- would be affected by the warning. + + -- Note also that the rule in 6.4.1 (6.17/3), introduced by AI12-0324, + -- is potentially more expensive to verify, and is not yet implemented. + + if Is_Internal_Unit (Current_Sem_Unit) then + return; + end if; + Form1 := First_Formal (Subp); Act1 := First_Actual (N); while Present (Form1) and then Present (Act1) loop - if Is_Covered_Formal (Form1) then + if Is_Covered_Formal (Form1) + or else not Is_Elementary_Type (Etype (Act1)) + then Form2 := First_Formal (Subp); Act2 := First_Actual (N); while Present (Form2) and then Present (Act2) loop
next reply other threads:[~2020-06-10 23:26 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-10 23:26 Iain D Sandoe [this message] 2020-06-11 20:07 Iain D Sandoe
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=20200610232652.39A53388F05D@sourceware.org \ --to=iains@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).