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] Use of non-static constants in aspect Global


This patch updates the legality checks of aspect/pragma Global to allow
references to enclosing formal parameters.

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

--  formal_references.adb

procedure Formal_References
  (In_Formal     : Integer;
   In_Out_Formal : in out Integer;
   Out_Formal    : out Integer)
is
   procedure Nested (Own_Formal : Integer)
     with Global => (Input  => (In_Formal, Own_Formal),
                     In_Out => In_Out_Formal,
                     Output => Out_Formal),
          Depends => (Out_Formal    => (In_Formal, In_Out_Formal, Own_Formal),
                      In_Out_Formal => In_Out_Formal)
   is begin null; end Nested;
begin
   null;
end Formal_References;

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

$gcc -c -gnat12 -gnatd.V formal_references.adb
formal_references.adb:7:44: global item cannot reference formal parameter

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

2013-10-14  Hristian Kirtchev  <kirtchev@adacore.com>

	* sem_prag.adb (Analyze_Global_Item): Allow
	references to enclosing formal parameters.

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]