From 42959b0c5aa6a3ff084de4b27f4b3830c417697f Mon Sep 17 00:00:00 2001 From: Robert Dewar Date: Mon, 27 Jan 2014 16:27:02 +0000 Subject: gnat_ugn.texi: Add Short_Enums to documentation of -gnatet/-gnateT. 2014-01-27 Robert Dewar * gnat_ugn.texi: Add Short_Enums to documentation of -gnatet/-gnateT. 2014-01-27 Robert Dewar * sem_prag.adb (Analyze_Input_Item): Correct check for input item in same package. * sem_util.ads, sem_util.adb (Within_Scope): New function. From-SVN: r207134 --- gcc/ada/ChangeLog | 11 +++++++++++ gcc/ada/gnat_ugn.texi | 1 + gcc/ada/sem_prag.adb | 4 ++-- gcc/ada/sem_util.adb | 19 +++++++++++++++++++ gcc/ada/sem_util.ads | 3 +++ 5 files changed, 36 insertions(+), 2 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 363c4c9..929297b 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,14 @@ +2014-01-27 Robert Dewar + + * gnat_ugn.texi: Add Short_Enums to documentation of + -gnatet/-gnateT. + +2014-01-27 Robert Dewar + + * sem_prag.adb (Analyze_Input_Item): Correct check for input + item in same package. + * sem_util.ads, sem_util.adb (Within_Scope): New function. + 2014-01-26 Arnaud Charlet * a-intnam-lynxos.ads, mlib-tgt-specific-lynxos.adb, diff --git a/gcc/ada/gnat_ugn.texi b/gcc/ada/gnat_ugn.texi index ca3eacc..17983ef 100644 --- a/gcc/ada/gnat_ugn.texi +++ b/gcc/ada/gnat_ugn.texi @@ -3869,6 +3869,7 @@ Long_Size : Pos; -- Standard.Long_Integer'Size Maximum_Alignment : Pos; -- Maximum permitted alignment Max_Unaligned_Field : Pos; -- Maximum size for unaligned bit field Pointer_Size : Pos; -- System.Address'Size +Short_Enums : Nat; -- Short foreign convention enums? Short_Size : Pos; -- Standard.Short_Integer'Size Strict_Alignment : Nat; -- Strict alignment? System_Allocator_Alignment : Nat; -- Alignment for malloc calls diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index e76e688..70f9017 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -2551,11 +2551,11 @@ package body Sem_Prag is -- The input cannot denote states or variables declared -- within the related package. - if In_Same_Code_Unit (Item, Input_Id) then + if Within_Scope (Input_Id, Current_Scope) then Error_Msg_Name_1 := Chars (Pack_Id); Error_Msg_NE ("input item & cannot denote a visible variable or " - & "state of package %", Input, Input_Id); + & "state in package %", Input, Input_Id); -- Detect a duplicate use of the same input item diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index cf00b2f..9c9a227 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -16100,6 +16100,25 @@ package body Sem_Util is return Is_Init_Proc (S); end Within_Init_Proc; + ------------------ + -- Within_Scope -- + ------------------ + + function Within_Scope (E : Entity_Id; S : Entity_Id) return Boolean is + SE : Entity_Id; + begin + SE := Scope (E); + loop + if SE = S then + return True; + elsif SE = Standard_Standard then + return False; + else + SE := Scope (SE); + end if; + end loop; + end Within_Scope; + ---------------- -- Wrong_Type -- ---------------- diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 3fb9cda..2e291ae 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -1754,6 +1754,9 @@ package Sem_Util is function Within_Init_Proc return Boolean; -- Determines if Current_Scope is within an init proc + function Within_Scope (E : Entity_Id; S : Entity_Id) return Boolean; + -- Returns True if entity Id is declared within scope S + procedure Wrong_Type (Expr : Node_Id; Expected_Type : Entity_Id); -- Output error message for incorrectly typed expression. Expr is the node -- for the incorrectly typed construct (Etype (Expr) is the type found), -- cgit v1.1