public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [COMMITTED 01/30] ada: Refactor checks for Refined_Global in generic instances
@ 2024-06-10  9:07 Marc Poulhiès
  2024-06-10  9:07 ` [COMMITTED 02/30] ada: Refactor checks for Refined_Depends " Marc Poulhiès
                   ` (28 more replies)
  0 siblings, 29 replies; 30+ messages in thread
From: Marc Poulhiès @ 2024-06-10  9:07 UTC (permalink / raw)
  To: gcc-patches; +Cc: Piotr Trojanek

From: Piotr Trojanek <trojanek@adacore.com>

Code cleanup; semantics is unaffected.

gcc/ada/

	* sem_prag.adb (Check_In_Out_States, Check_Input_States,
	Check_Output_States, Check_Proof_In_States,
	Check_Refined_Global_List, Report_Extra_Constituents,
	Report_Missing_Items): Remove multiple checks for being inside
	an instance.
	(Analyze_Refined_Global_In_Decl_Part): Add single check for
	being inside an instance.

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

---
 gcc/ada/sem_prag.adb | 86 ++++++++++++--------------------------------
 1 file changed, 23 insertions(+), 63 deletions(-)

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
index a895fd2053a..86a25dc7d0c 100644
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -28712,16 +28712,10 @@ package body Sem_Prag is
       --  Start of processing for Check_In_Out_States
 
       begin
-         --  Do not perform this check in an instance because it was already
-         --  performed successfully in the generic template.
-
-         if In_Instance then
-            null;
-
          --  Inspect the In_Out items of the corresponding Global pragma
          --  looking for a state with a visible refinement.
 
-         elsif Has_In_Out_State and then Present (In_Out_Items) then
+         if Has_In_Out_State and then Present (In_Out_Items) then
             Item_Elmt := First_Elmt (In_Out_Items);
             while Present (Item_Elmt) loop
                Item_Id := Node (Item_Elmt);
@@ -28821,16 +28815,10 @@ package body Sem_Prag is
       --  Start of processing for Check_Input_States
 
       begin
-         --  Do not perform this check in an instance because it was already
-         --  performed successfully in the generic template.
-
-         if In_Instance then
-            null;
-
          --  Inspect the Input items of the corresponding Global pragma looking
          --  for a state with a visible refinement.
 
-         elsif Has_In_State and then Present (In_Items) then
+         if Has_In_State and then Present (In_Items) then
             Item_Elmt := First_Elmt (In_Items);
             while Present (Item_Elmt) loop
                Item_Id := Node (Item_Elmt);
@@ -28944,16 +28932,10 @@ package body Sem_Prag is
       --  Start of processing for Check_Output_States
 
       begin
-         --  Do not perform this check in an instance because it was already
-         --  performed successfully in the generic template.
-
-         if In_Instance then
-            null;
-
          --  Inspect the Output items of the corresponding Global pragma
          --  looking for a state with a visible refinement.
 
-         elsif Has_Out_State and then Present (Out_Items) then
+         if Has_Out_State and then Present (Out_Items) then
             Item_Elmt := First_Elmt (Out_Items);
             while Present (Item_Elmt) loop
                Item_Id := Node (Item_Elmt);
@@ -29050,16 +29032,10 @@ package body Sem_Prag is
       --  Start of processing for Check_Proof_In_States
 
       begin
-         --  Do not perform this check in an instance because it was already
-         --  performed successfully in the generic template.
-
-         if In_Instance then
-            null;
-
          --  Inspect the Proof_In items of the corresponding Global pragma
          --  looking for a state with a visible refinement.
 
-         elsif Has_Proof_In_State and then Present (Proof_In_Items) then
+         if Has_Proof_In_State and then Present (Proof_In_Items) then
             Item_Elmt := First_Elmt (Proof_In_Items);
             while Present (Item_Elmt) loop
                Item_Id := Node (Item_Elmt);
@@ -29214,13 +29190,7 @@ package body Sem_Prag is
       --  Start of processing for Check_Refined_Global_List
 
       begin
-         --  Do not perform this check in an instance because it was already
-         --  performed successfully in the generic template.
-
-         if In_Instance then
-            null;
-
-         elsif Nkind (List) = N_Null then
+         if Nkind (List) = N_Null then
             null;
 
          --  Single global item declaration
@@ -29465,18 +29435,10 @@ package body Sem_Prag is
       --  Start of processing for Report_Extra_Constituents
 
       begin
-         --  Do not perform this check in an instance because it was already
-         --  performed successfully in the generic template.
-
-         if In_Instance then
-            null;
-
-         else
-            Report_Extra_Constituents_In_List (In_Constits);
-            Report_Extra_Constituents_In_List (In_Out_Constits);
-            Report_Extra_Constituents_In_List (Out_Constits);
-            Report_Extra_Constituents_In_List (Proof_In_Constits);
-         end if;
+         Report_Extra_Constituents_In_List (In_Constits);
+         Report_Extra_Constituents_In_List (In_Out_Constits);
+         Report_Extra_Constituents_In_List (Out_Constits);
+         Report_Extra_Constituents_In_List (Proof_In_Constits);
       end Report_Extra_Constituents;
 
       --------------------------
@@ -29488,21 +29450,13 @@ package body Sem_Prag is
          Item_Id   : Entity_Id;
 
       begin
-         --  Do not perform this check in an instance because it was already
-         --  performed successfully in the generic template.
-
-         if In_Instance then
-            null;
-
-         else
-            if Present (Repeat_Items) then
-               Item_Elmt := First_Elmt (Repeat_Items);
-               while Present (Item_Elmt) loop
-                  Item_Id := Node (Item_Elmt);
-                  SPARK_Msg_NE ("missing global item &", N, Item_Id);
-                  Next_Elmt (Item_Elmt);
-               end loop;
-            end if;
+         if Present (Repeat_Items) then
+            Item_Elmt := First_Elmt (Repeat_Items);
+            while Present (Item_Elmt) loop
+               Item_Id := Node (Item_Elmt);
+               SPARK_Msg_NE ("missing global item &", N, Item_Id);
+               Next_Elmt (Item_Elmt);
+            end loop;
          end if;
       end Report_Missing_Items;
 
@@ -29603,6 +29557,13 @@ package body Sem_Prag is
 
       Analyze_Global_In_Decl_Part (N);
 
+      --  Do not perform these checks in an instance because they were already
+      --  performed successfully in the generic template.
+
+      if In_Instance then
+         goto Leave;
+      end if;
+
       --  Perform all refinement checks with respect to completeness and mode
       --  matching.
 
@@ -29671,7 +29632,6 @@ package body Sem_Prag is
       --  in the generic template.
 
       if Serious_Errors_Detected = Errors
-        and then not In_Instance
         and then not Has_Null_State
         and then No_Constit
       then
-- 
2.45.1


^ permalink raw reply	[flat|nested] 30+ messages in thread

end of thread, other threads:[~2024-06-10  9:08 UTC | newest]

Thread overview: 30+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-10  9:07 [COMMITTED 01/30] ada: Refactor checks for Refined_Global in generic instances Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 02/30] ada: Refactor checks for Refined_Depends " Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 03/30] ada: Remove unnecessary guard against empty list Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 04/30] ada: Fix handling of aspects CPU and Interrupt_Priority Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 05/30] ada: Cleanup building of error messages for class-wide contracts Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 06/30] ada: Refactor common code for dynamic and static class-wide preconditions Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 07/30] ada: Add switch to disable expansion of assertions in CodePeer mode Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 08/30] ada: Enable inlining for subprograms with multiple return statements Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 09/30] ada: Simplify check for type without stream operations Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 10/30] ada: Skip processing of NUL character for attribute Type_Key Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 11/30] ada: Adjust comments and doc about the new use of restriction No_Streams Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 12/30] ada: Cleanup repeated code in expansion of stream attributes Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 13/30] ada: Fix incorrect lower bound presumption in gnatlink Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 14/30] ada: Remove incorrect assertion in run-time Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 15/30] ada: Fix usage of SetThreadIdealProcessor Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 16/30] ada: Fix usage of SetThreadAffinityMask Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 17/30] ada: Remove streaming facilities from generics for formal containers Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 18/30] ada: Tune code related to potentially unevaluated expressions Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 19/30] ada: Fix references to Ada RM in comments Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 20/30] ada: Further refine 'Super attribute Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 21/30] ada: Unreferenced warning on abstract subprogram Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 22/30] ada: Crash checking accessibility level on private type Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 23/30] ada: Iterator filter ignored on formal loop Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 24/30] ada: Missing style check for extra parentheses in operators Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 25/30] ada: Resolve compilation issues with container aggregates in draft ACATS B tests Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 26/30] ada: For freezing, treat an extension or delta aggregate like a regular aggregate Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 27/30] ada: Minor code adjustment to "not Present" test Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 28/30] ada: Derived type with convention C must override convention C_Pass_By_Copy Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 29/30] ada: Storage_Error in indirect call to function returning limited type Marc Poulhiès
2024-06-10  9:07 ` [COMMITTED 30/30] ada: Add support for No_Implicit_Conditionals to nonbinary modular types Marc Poulhiès

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).