[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 4 Jul 2016 10:17:30 +0000 (12:17 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 4 Jul 2016 10:17:30 +0000 (12:17 +0200)
2016-07-04  Justin Squirek  <squirek@adacore.com>

* sem_prag.adb (Analyze_Unmodified_Or_Unused and
Analyze_Unreferenced_Or_Unused): Change warning message to be
more clear about pragma duplicates.

2016-07-04  Yannick Moy  <moy@adacore.com>

* sinput-l.adb (Create_Instantiation_Source): Set component
Inlined_Call for inherited pragma case.
* sinput.adb, sinput.ads (Instantiation): Return component
Inlined_Call for inherited pragma case.

2016-07-04  Bob Duff  <duff@adacore.com>

* sem_type.adb (Remove_Conversions): Protect
the call to Left_Opnd by checking for Nkind in N_Unary_Op --
unary operators do not have a left operand.

2016-07-04  Ed Schonberg  <schonberg@adacore.com>

* sem_ch3.adb (Analyze_Object_Declaration): A declaration of a
constant in a protected operation may be a homonym of a private
component of the enclosing protected type. This declaration hides
the component renaming constructed within the protected operation.

From-SVN: r237964

gcc/ada/ChangeLog
gcc/ada/sem_ch3.adb
gcc/ada/sem_prag.adb
gcc/ada/sem_type.adb
gcc/ada/sinput-l.adb
gcc/ada/sinput.adb
gcc/ada/sinput.ads

index 6973528..3c8ac5e 100644 (file)
@@ -1,3 +1,29 @@
+2016-07-04  Justin Squirek  <squirek@adacore.com>
+
+       * sem_prag.adb (Analyze_Unmodified_Or_Unused and
+       Analyze_Unreferenced_Or_Unused): Change warning message to be
+       more clear about pragma duplicates.
+
+2016-07-04  Yannick Moy  <moy@adacore.com>
+
+       * sinput-l.adb (Create_Instantiation_Source): Set component
+       Inlined_Call for inherited pragma case.
+       * sinput.adb, sinput.ads (Instantiation): Return component
+       Inlined_Call for inherited pragma case.
+
+2016-07-04  Bob Duff  <duff@adacore.com>
+
+       * sem_type.adb (Remove_Conversions): Protect
+       the call to Left_Opnd by checking for Nkind in N_Unary_Op --
+       unary operators do not have a left operand.
+
+2016-07-04  Ed Schonberg  <schonberg@adacore.com>
+
+       * sem_ch3.adb (Analyze_Object_Declaration): A declaration of a
+       constant in a protected operation may be a homonym of a private
+       component of the enclosing protected type. This declaration hides
+       the component renaming constructed within the protected operation.
+
 2016-07-04  Bob Duff  <duff@adacore.com>
 
        * xref_lib.adb (Parse_X_Filename, Parse_Identifier_Info): Ignore
index be0fa8f..4dec6ff 100644 (file)
@@ -3466,7 +3466,17 @@ package body Sem_Ch3 is
                                                N_Package_Renaming_Declaration
                    and then not Comes_From_Source (Prev_Entity)
                    and then
-                     Is_Generic_Instance (Renamed_Entity (Prev_Entity))))
+                     Is_Generic_Instance (Renamed_Entity (Prev_Entity)))
+
+               --  The entity may be a homonym of a private component of the
+               --  enclosing protected object, for which we create a local
+               --  renaming declaration. The declaration is legal, even
+               --  if useless when it just captures that component.
+
+               or else
+                  (Ekind (Scope (Current_Scope)) = E_Protected_Type
+                  and then Nkind (Parent (Prev_Entity)) =
+                     N_Object_Renaming_Declaration))
          then
             Prev_Entity := Empty;
          end if;
index 8cda6c7..3a14fdf 100644 (file)
@@ -4568,10 +4568,12 @@ package body Sem_Prag is
                elsif Has_Pragma_Unmodified (Arg_Id) then
                   if Has_Pragma_Unused (Arg_Id) then
                      Error_Msg_NE
-                       ("??pragma Unused given for &!", Arg_Expr, Arg_Id);
+                       ("??pragma Unused already given for &!", Arg_Expr,
+                         Arg_Id);
                   else
                      Error_Msg_NE
-                       ("??pragma Unmodified given for &!", Arg_Expr, Arg_Id);
+                       ("??pragma Unmodified already given for &!", Arg_Expr,
+                         Arg_Id);
                   end if;
 
                --  Otherwise the pragma referenced an illegal entity
@@ -4674,11 +4676,12 @@ package body Sem_Prag is
                   if Has_Pragma_Unreferenced (Arg_Id) then
                      if Has_Pragma_Unused (Arg_Id) then
                         Error_Msg_NE
-                          ("??pragma Unused given for &!", Arg_Expr, Arg_Id);
+                          ("??pragma Unused already given for &!", Arg_Expr,
+                            Arg_Id);
                      else
                         Error_Msg_NE
-                          ("??pragma Unreferenced given for &!", Arg_Expr,
-                           Arg_Id);
+                          ("??pragma Unreferenced already given for &!",
+                            Arg_Expr, Arg_Id);
                      end if;
 
                   --  Apply Unreferenced to the entity
index 2879c3c..a770149 100644 (file)
@@ -1619,8 +1619,10 @@ package body Sem_Type is
 
                if Nkind (Act1) in N_Op
                  and then Is_Overloaded (Act1)
-                 and then Nkind_In (Left_Opnd (Act1), N_Integer_Literal,
-                                                      N_Real_Literal)
+                 and then (Nkind (Act1) in N_Unary_Op
+                             or else Nkind_In
+                               (Left_Opnd (Act1), N_Integer_Literal,
+                                                  N_Real_Literal))
                  and then Nkind_In (Right_Opnd (Act1), N_Integer_Literal,
                                                        N_Real_Literal)
                  and then Has_Compatible_Type (Act1, Standard_Boolean)
index 32c2ac2..f0cce8d 100644 (file)
@@ -151,16 +151,12 @@ package body Sinput.L is
          Snew.Template         := Xold;
 
          --  For a genuine generic instantiation, assign new instance id. For
-         --  inlined bodies, we retain that of the template, but we save the
-         --  call location. For inherited pragmas, we simply retain that of
-         --  the template.
+         --  inlined bodies or inherited pragmas, we retain that of the
+         --  template, but we save the call location.
 
-         if Inlined_Body then
+         if Inlined_Body or Inherited_Pragma then
             Snew.Inlined_Call := Sloc (Inst_Node);
 
-         elsif Inherited_Pragma then
-            null;
-
          else
             --  If the spec has been instantiated already, and we are now
             --  creating the instance source for the corresponding body now,
index 0105b2c..a039494 100644 (file)
@@ -493,7 +493,7 @@ package body Sinput is
    function Instantiation (S : SFI) return Source_Ptr is
       SIE : Source_File_Record renames Source_File.Table (S);
    begin
-      if SIE.Inlined_Body then
+      if SIE.Inlined_Body or SIE.Inherited_Pragma then
          return SIE.Inlined_Call;
       else
          return Instances.Table (SIE.Instance);
index 21f16f2..8165a8f 100644 (file)
@@ -260,14 +260,13 @@ package Sinput is
 
    --  Inlined_Call : Source_Ptr;
    --    Source file location of the subprogram call if this source file entry
-   --    represents an inlined body. Set to No_Location otherwise.
-   --    This field is read-only for clients.
+   --    represents an inlined body or an inherited pragma. Set to No_Location
+   --    otherwise. This field is read-only for clients.
 
    --  Inlined_Body : Boolean;
    --    This can only be set True if Instantiation has a value other than
    --    No_Location. If true it indicates that the instantiation is actually
    --    an instance of an inlined body.
-   --    ??? Redundant, always equal to (Inlined_Call /= No_Location)
 
    --  Inherited_Pragma : Boolean;
    --    This can only be set True if Instantiation has a value other than
@@ -426,9 +425,11 @@ package Sinput is
 
    function Instantiation (S : SFI) return Source_Ptr;
    --  For a source file entry that represents an inlined body, source location
-   --  of the inlined call. Otherwise, for a source file entry that represents
-   --  a generic instantiation, source location of the instantiation. Returns
-   --  No_Location in all other cases.
+   --  of the inlined call. For a source file entry that represents an
+   --  inherited pragma, source location of the declaration to which the
+   --  overriding subprogram for the inherited pragma is attached. Otherwise,
+   --  for a source file entry that represents a generic instantiation, source
+   --  location of the instantiation. Returns No_Location in all other cases.
 
    -----------------
    -- Global Data --