public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Marc Poulhiès" <poulhies@adacore.com>
To: gcc-patches@gcc.gnu.org
Cc: Javier Miranda <miranda@adacore.com>
Subject: [COMMITTED] ada: Flag unsupported dispatching constructor calls
Date: Mon, 14 Nov 2022 14:52:45 +0100	[thread overview]
Message-ID: <20221114135245.53157-1-poulhies@adacore.com> (raw)

From: Javier Miranda <miranda@adacore.com>

gcc/ada/

	* exp_intr.adb
	(Expand_Dispatching_Constructor_Call): Improve warning message.
	* freeze.adb
	(Check_No_Parts_Violations): Improve error message.

Tested on x86_64-pc-linux-gnu, committed on master.

---
 gcc/ada/exp_intr.adb | 9 ++++++---
 gcc/ada/freeze.adb   | 3 +++
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/gcc/ada/exp_intr.adb b/gcc/ada/exp_intr.adb
index cb9b5be1090..d18ed69eeae 100644
--- a/gcc/ada/exp_intr.adb
+++ b/gcc/ada/exp_intr.adb
@@ -315,9 +315,12 @@ package body Exp_Intr is
             Error_Msg_N
               ("unsupported dispatching constructor call if the type "
                & "of the built object has task components??", N);
-            Error_Msg_N
-              ("\work around this problem by replacing task components "
-               & "with access-to-task-type components??", N);
+
+            Error_Msg_Sloc := Sloc (Root_Type (Etype (Entity (Name (N)))));
+            Error_Msg_NE
+              ("\work around this by adding ''with no_task_parts'' to "
+               & "the declaration of the root type& defined#???",
+               N, Root_Type (Etype (Entity (Name (N)))));
          end if;
       end if;
 
diff --git a/gcc/ada/freeze.adb b/gcc/ada/freeze.adb
index 032c73d3dfb..7f78b4315a8 100644
--- a/gcc/ada/freeze.adb
+++ b/gcc/ada/freeze.adb
@@ -3188,6 +3188,9 @@ package body Freeze is
                if Has_Task (Typ) then
                   Error_Msg_N
                     ("aspect % applied to task type &", Typ);
+                  Error_Msg_N
+                    ("\replace task components with access-to-task-type "
+                     & "components??", Typ);
                end if;
 
             else
-- 
2.34.1


             reply	other threads:[~2022-11-14 13:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-14 13:52 Marc Poulhiès [this message]
  -- strict thread matches above, loose matches on Subject: below --
2022-11-04 13:58 Marc Poulhiès

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=20221114135245.53157-1-poulhies@adacore.com \
    --to=poulhies@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=miranda@adacore.com \
    /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: link
Be 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).