diff mbox series

[COMMITTED,12/30] ada: Change "missing overriding indicator" message from error to warning

Message ID 20240801151738.400796-12-poulhies@adacore.com
State New
Headers show
Series [COMMITTED,01/30] ada: Remove obsolete workaround | expand

Commit Message

Marc Poulhiès Aug. 1, 2024, 3:17 p.m. UTC
From: Steve Baird <baird@adacore.com>

There is no RM rule requiring an overriding indicator in the case where
this message is generated; such a rule was discussed many years ago in an
AI, but that AI was never approved. So generate a warning message instead
of an error message. And don't even do that if we are in an instance (warning
a user they should change the source of an instance seems unlikely to be
helpful, at least in this case).

gcc/ada/

	* sem_disp.adb (Check_Dispatching_Operation): When calling
	Error_Msg_NE to generate a "missing overriding indicator" message,
	generate a warning message instead of an error message (and update
	comment to describe this new behavior).

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

---
 gcc/ada/sem_disp.adb | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/ada/sem_disp.adb b/gcc/ada/sem_disp.adb
index fe822290e45..3c1c49f7064 100644
--- a/gcc/ada/sem_disp.adb
+++ b/gcc/ada/sem_disp.adb
@@ -1666,13 +1666,14 @@  package body Sem_Disp is
       then
          Ovr_Subp := Find_Hidden_Overridden_Primitive (Subp);
 
-         --  Verify that the proper overriding indicator has been supplied.
+         --  Warn if the proper overriding indicator has not been supplied.
 
          if Present (Ovr_Subp)
            and then
              not Must_Override (Specification (Unit_Declaration_Node (Subp)))
+           and then not In_Instance
          then
-            Error_Msg_NE ("missing overriding indicator for&", Subp, Subp);
+            Error_Msg_NE ("missing overriding indicator for&??", Subp, Subp);
          end if;
       end if;