gnat_ugn.texi: Add Short_Enums to documentation of -gnatet/-gnateT.
authorRobert Dewar <dewar@adacore.com>
Mon, 27 Jan 2014 16:27:02 +0000 (16:27 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 27 Jan 2014 16:27:02 +0000 (17:27 +0100)
2014-01-27  Robert Dewar  <dewar@adacore.com>

* gnat_ugn.texi: Add Short_Enums to documentation of
-gnatet/-gnateT.

2014-01-27  Robert Dewar  <dewar@adacore.com>

* 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
gcc/ada/gnat_ugn.texi
gcc/ada/sem_prag.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads

index 363c4c9..929297b 100644 (file)
@@ -1,3 +1,14 @@
+2014-01-27  Robert Dewar  <dewar@adacore.com>
+
+       * gnat_ugn.texi: Add Short_Enums to documentation of
+       -gnatet/-gnateT.
+
+2014-01-27  Robert Dewar  <dewar@adacore.com>
+
+       * 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  <charlet@adacore.com>
 
        * a-intnam-lynxos.ads, mlib-tgt-specific-lynxos.adb,
index ca3eacc..17983ef 100644 (file)
@@ -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
index e76e688..70f9017 100644 (file)
@@ -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
 
index cf00b2f..9c9a227 100644 (file)
@@ -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 --
    ----------------
index 3fb9cda..2e291ae 100644 (file)
@@ -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),