[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Mon, 4 Aug 2014 10:10:23 +0000 (12:10 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Mon, 4 Aug 2014 10:10:23 +0000 (12:10 +0200)
2014-08-04  Arnaud Charlet  <charlet@adacore.com>

* sem_scil.ads: Improve comments.
* sem_ch4.adb (Analyze_Equality_Op): Add support for
Allow_Integer_Address (equality between Address and Integer).

2014-08-04  Yannick Moy  <moy@adacore.com>

* a-cfhama.adb, a-cforse.adb: Minor fixes to avoid using prefix
notation on untagged objects.
* sem.ads: Update comment.
* inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Do
not inline subprograms declared in the visible part of a package.

From-SVN: r213560

gcc/ada/ChangeLog
gcc/ada/a-cfhama.adb
gcc/ada/a-cforse.adb
gcc/ada/inline.adb
gcc/ada/sem.ads
gcc/ada/sem_ch4.adb

index d18302471d32882453720f03a03ec03fc0c618ea..441e2a0fb5cea1a100cf40aaa22bb7fa962c2cc9 100644 (file)
@@ -1,3 +1,17 @@
+2014-08-04  Arnaud Charlet  <charlet@adacore.com>
+
+       * sem_scil.ads: Improve comments.
+       * sem_ch4.adb (Analyze_Equality_Op): Add support for
+       Allow_Integer_Address (equality between Address and Integer).
+
+2014-08-04  Yannick Moy  <moy@adacore.com>
+
+       * a-cfhama.adb, a-cforse.adb: Minor fixes to avoid using prefix
+       notation on untagged objects.
+       * sem.ads: Update comment.
+       * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Do
+       not inline subprograms declared in the visible part of a package.
+
 2014-08-04  Ed Schonberg  <schonberg@adacore.com>
 
        * exp_ch5.adb: minor reformatting.
index ea506d8ddc46d2d0885e039dfa5bd1ea848d0dfa..858216f62ea14de6ea4694510309100ae8b5b697 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2010-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 2010-2014, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -144,7 +144,7 @@ package body Ada.Containers.Formal_Hashed_Maps is
       procedure Insert_Element (Source_Node : Count_Type) is
          N : Node_Type renames Source.Nodes (Source_Node);
       begin
-         Target.Insert (N.Key, N.Element);
+         Insert (Target, N.Key, N.Element);
       end Insert_Element;
 
       --  Start of processing for Assign
index bc8ffbaac881940487ced0f6a780ce458389c3ce..d1e6b8cd206ee46c1a4564ae52806641c9640b7f 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 2010-2013, Free Software Foundation, Inc.         --
+--          Copyright (C) 2010-2014, Free Software Foundation, Inc.         --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -1534,8 +1534,8 @@ package body Ada.Containers.Formal_Ordered_Sets is
       end if;
 
       return S : Set (Length (Left) + Length (Right)) do
-         S.Assign (Source => Left);
-         S.Union (Right);
+         Assign (S, Source => Left);
+         Union (S, Right);
       end return;
    end Union;
 
index 380fa25939f31f094c95686c33c2983eeaddbef9..7a3b2a706b66ad4a5cda5d3146b82c124594bcb4 100644 (file)
@@ -1382,11 +1382,9 @@ package body Inline is
       --  Returns True if subprogram Id has any contract (Pre, Post, Global,
       --  Depends, etc.)
 
-      function In_Some_Private_Part (N : Node_Id) return Boolean;
-      --  Returns True if node N is defined in the private part of a package
-
-      function In_Unit_Body (N : Node_Id) return Boolean;
-      --  Returns True if node N is defined in the body of a unit
+      function In_Package_Visible_Spec (Id : Node_Id) return Boolean;
+      --  Returns True if subprogram Id is defined in the visible part of a
+      --  package specification.
 
       function Is_Expression_Function (Id : Entity_Id) return Boolean;
       --  Returns True if subprogram Id was defined originally as an expression
@@ -1405,51 +1403,36 @@ package body Inline is
                      Present (Classifications     (Items)));
       end Has_Some_Contract;
 
-      --------------------------
-      -- In_Some_Private_Part --
-      --------------------------
+      -----------------------------
+      -- In_Package_Visible_Spec --
+      -----------------------------
 
-      function In_Some_Private_Part (N : Node_Id) return Boolean is
-         P  : Node_Id;
-         PP : Node_Id;
+      function In_Package_Visible_Spec  (Id : Node_Id) return Boolean is
+         Decl : Node_Id := Parent (Parent (Id));
+         P    : Node_Id;
 
       begin
-         P := N;
-         while Present (P) and then Present (Parent (P)) loop
-            PP := Parent (P);
-
-            if Nkind (PP) = N_Package_Specification
-              and then List_Containing (P) = Private_Declarations (PP)
-            then
-               return True;
-            end if;
-
-            P := PP;
-         end loop;
-
-         return False;
-      end In_Some_Private_Part;
+         if Nkind (Parent (Id)) = N_Defining_Program_Unit_Name then
+            Decl := Parent (Decl);
+         end if;
 
-      ------------------
-      -- In_Unit_Body --
-      ------------------
+         P := Parent (Decl);
 
-      function In_Unit_Body (N : Node_Id) return Boolean is
-         CU : constant Node_Id := Enclosing_Comp_Unit_Node (N);
-      begin
-         return Present (CU)
-           and then Nkind_In (Unit (CU), N_Package_Body,
-                                         N_Subprogram_Body,
-                                         N_Subunit);
-      end In_Unit_Body;
+         return Nkind (P) = N_Package_Specification
+           and then List_Containing (Decl) = Visible_Declarations (P);
+      end In_Package_Visible_Spec;
 
       ----------------------------
       -- Is_Expression_Function --
       ----------------------------
 
       function Is_Expression_Function (Id : Entity_Id) return Boolean is
-         Decl : constant Node_Id := Parent (Parent (Id));
+         Decl : Node_Id := Parent (Parent (Id));
       begin
+         if Nkind (Parent (Id)) = N_Defining_Program_Unit_Name then
+            Decl := Parent (Decl);
+         end if;
+
          return Nkind (Original_Node (Decl)) = N_Expression_Function;
       end Is_Expression_Function;
 
@@ -1482,13 +1465,9 @@ package body Inline is
       if Nkind (Parent (Id)) = N_Defining_Program_Unit_Name then
          return False;
 
-      --  Do not inline subprograms declared in the visible part of a library
-      --  package.
+      --  Do not inline subprograms declared in the visible part of a package
 
-      elsif Is_Library_Level_Entity (Id)
-        and then not In_Unit_Body (Id)
-        and then not In_Some_Private_Part (Id)
-      then
+      elsif In_Package_Visible_Spec (Id) then
          return False;
 
       --  Do not inline subprograms that have a contract on the spec or the
index 26c760d28837fa36914d4b2260e9bef2a78264c5..e82905ea974042035de86febbed045205785b84b 100644 (file)
@@ -683,13 +683,14 @@ package Sem is
    generic
       with procedure Action (Item : Node_Id);
    procedure Walk_Library_Items;
-   --  Primarily for use by CodePeer. Must be called after semantic analysis
-   --  (and expansion) are complete. Walks each relevant library item, calling
-   --  Action for each, in an order such that one will not run across forward
-   --  references. Each Item passed to Action is the declaration or body of
-   --  a library unit, including generics and renamings. The first item is
-   --  the N_Package_Declaration node for package Standard. Bodies are not
-   --  included, except for the main unit itself, which always comes last.
+   --  Primarily for use by CodePeer and GNATprove. Must be called after
+   --  semantic analysis (and expansion in the case of CodePeer) are complete.
+   --  Walks each relevant library item, calling Action for each, in an order
+   --  such that one will not run across forward references. Each Item passed
+   --  to Action is the declaration or body of a library unit, including
+   --  generics and renamings. The first item is the N_Package_Declaration node
+   --  for package Standard. Bodies are not included, except for the main unit
+   --  itself, which always comes last.
    --
    --  Item is never a subunit
    --
index 2e1722e103964e732458b61427b4f7fe626c3e47..c675f056ccf41ea7e13ed1a26e0f1731756ae461 100644 (file)
@@ -6446,6 +6446,14 @@ package body Sem_Ch4 is
                   return;
                end if;
 
+            elsif Nkind_In (N, N_Op_Eq, N_Op_Ne) then
+               if Address_Integer_Convert_OK (Etype (R), Etype (L)) then
+                  Rewrite (R,
+                    Unchecked_Convert_To (Etype (L), Relocate_Node (R)));
+                  Analyze_Equality_Op (N);
+                  return;
+               end if;
+
             --  For an arithmetic operator or comparison operator, if one
             --  of the operands is numeric, then we know the other operand
             --  is not the same numeric type. If it is a non-numeric type,
@@ -6472,11 +6480,16 @@ package body Sem_Ch4 is
                   if Address_Integer_Convert_OK (Etype (R), Etype (L)) then
                      Rewrite (R,
                        Unchecked_Convert_To (Etype (L), Relocate_Node (R)));
-                     Analyze_Arithmetic_Op (N);
 
+                     if Nkind_In (N, N_Op_Ge, N_Op_Gt, N_Op_Le, N_Op_Lt) then
+                        Analyze_Comparison_Op (N);
+                     else
+                        Analyze_Arithmetic_Op (N);
+                     end if;
                   else
                      Resolve (R, Etype (L));
                   end if;
+
                   return;
 
                elsif Is_Numeric_Type (Etype (R))
@@ -6485,7 +6498,13 @@ package body Sem_Ch4 is
                   if Address_Integer_Convert_OK (Etype (L), Etype (R)) then
                      Rewrite (L,
                        Unchecked_Convert_To (Etype (R), Relocate_Node (L)));
-                     Analyze_Arithmetic_Op (N);
+
+                     if Nkind_In (N, N_Op_Ge, N_Op_Gt, N_Op_Le, N_Op_Lt) then
+                        Analyze_Comparison_Op (N);
+                     else
+                        Analyze_Arithmetic_Op (N);
+                     end if;
+
                      return;
 
                   else
@@ -6509,7 +6528,12 @@ package body Sem_Ch4 is
                      Rewrite (R,
                        Unchecked_Convert_To (
                          Standard_Integer, Relocate_Node (R)));
-                     Analyze_Arithmetic_Op (N);
+
+                     if Nkind_In (N, N_Op_Ge, N_Op_Gt, N_Op_Le, N_Op_Lt) then
+                        Analyze_Comparison_Op (N);
+                     else
+                        Analyze_Arithmetic_Op (N);
+                     end if;
 
                      --  If this is an operand in an enclosing arithmetic
                      --  operation, Convert the result as an address so that