diff mbox series

[Ada] Spurious style message on missing overriding indicator

Message ID 20210708135032.GA2465942@adacore.com
State New
Headers show
Series [Ada] Spurious style message on missing overriding indicator | expand

Commit Message

Pierre-Marie de Rodat July 8, 2021, 1:50 p.m. UTC
In the presence of style switch -gnatyO, the compiler emits a spurious
style violation message naming an inherited operation that does not come
from an explicit subprogram declaration.

Tested on x86_64-pc-linux-gnu, committed on trunk

gcc/ada/

	* style.adb (Missing_Overriding): Do not emit message when
	parent of subprogram is a full type declaration.
diff mbox series

Patch

diff --git a/gcc/ada/style.adb b/gcc/ada/style.adb
--- a/gcc/ada/style.adb
+++ b/gcc/ada/style.adb
@@ -265,11 +265,15 @@  package body Style is
       --  indicators were introduced in Ada 2005. We apply Comes_From_Source
       --  to Original_Node to catch the case of a procedure body declared with
       --  "is null" that has been rewritten as a normal empty body.
+      --  We do not emit a warning on an inherited operation that comes from
+      --  a type derivation.
 
       if Style_Check_Missing_Overriding
         and then (Comes_From_Source (Original_Node (N))
                    or else Is_Generic_Instance (E))
         and then Ada_Version_Explicit >= Ada_2005
+        and then Present (Parent (E))
+        and then Nkind (Parent (E)) /= N_Full_Type_Declaration
       then
          --  If the subprogram is an instantiation,  its declaration appears
          --  within a wrapper package that precedes the instance node. Place