diff mbox series

[Ada] Avoid reanalysis of malformed dependency relations

Message ID 20201214155603.GA3975@adacore.com
State New
Headers show
Series [Ada] Avoid reanalysis of malformed dependency relations | expand

Commit Message

Pierre-Marie de Rodat Dec. 14, 2020, 3:56 p.m. UTC
When analysis of pragma Depends/Refined_Depends returns early because of
a malformed pragma, it marks the pragma as analyzed to avoid repeated
work.  This is now done consistently for all early returns.

Cleanup only; the GNAT and GNATprove behaviours are not really affected
by this patch.

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

gcc/ada/

	* sem_prag.adb (Analyze_Depends_In_Decl_Part): Replace early
	returns with goto Leave.
	(Collect_Subprogram_Inputs_Outputs): Fix style in comment.
diff mbox series

Patch

diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb
--- a/gcc/ada/sem_prag.adb
+++ b/gcc/ada/sem_prag.adb
@@ -1975,7 +1975,7 @@  package body Sem_Prag is
          --  clause as this will lead to misleading errors.
 
          if Has_Extra_Parentheses (Deps) then
-            return;
+            goto Leave;
          end if;
 
          if Present (Component_Associations (Deps)) then
@@ -2066,7 +2066,7 @@  package body Sem_Prag is
 
          else
             Error_Msg_N ("malformed dependency relation", Deps);
-            return;
+            goto Leave;
          end if;
 
       --  The top level dependency relation is malformed. This is a syntax
@@ -30226,7 +30226,7 @@  package body Sem_Prag is
          Global  := Get_Pragma (Subp_Id, Pragma_Refined_Global);
 
       --  Subprogram declaration or stand-alone body case, look for pragmas
-      --  Depends and Global
+      --  Depends and Global.
 
       else
          Depends := Get_Pragma (Spec_Id, Pragma_Depends);