This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Ada] Legality of self-referential outputs in aspect/pragma Depends


This patch updates the analysis of aspect/pragma Depends to verify the legality
of a self-referential output.

------------
-- Source --
------------

--  semantics.ads

package Semantics
  with Abstract_State =>
    ((Input_State  with Volatile, Input),
     (Output_State with Volatile, Output))
is
   Input_Var  : Integer;  --  in
   Mixed_Var  : Integer;  --  in out
   Output_Var : Integer;  --     out

   procedure Error (Formal : out Integer) with
     Global =>
       (Input =>
          (Input_State, Input_Var),
        Output =>
          (Output_State, Output_Var),
        In_Out =>
           Mixed_Var),

     Depends =>
       ((Formal,        --  error
         Mixed_Var,     --  ok, already in out
         Output_State,  --  error
         Output_Var)    --  error
            =>+ (Input_Var,
                 Input_State,
                 Mixed_Var));
end Semantics;

----------------------------
-- Compilation and output --
----------------------------

$ gcc -c -gnat12 -gnatd.V semantics.ads
semantics.ads:20:10: item "Formal" must have mode in out
semantics.ads:22:10: item "Output_State" must have mode in out
semantics.ads:23:10: item "Output_Var" must have mode in out

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

2013-04-23  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_prag.adb (Analyze_Dependency_Clause): Update all calls to
	Analyze_Input_Output.
	(Analyze_Input_List): Update all calls to Analyze_Input_Output.
	(Analyze_Input_Output): Add formal parameter Self_Ref along with
	comment on its usage. Update all calls to Analyze_Input_Output.
	(Analyze_Pragma): Add new local variable Self_Ref to capture
	the presence of a self-referential dependency clause. Update
	all calls to Analyze_Input_Output.
	(Check_Mode): Add formal parameter Self_Ref along with comment on its
	usage. Verify the legality of a self-referential output.

Attachment: difs
Description: Text document


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]