sem_prag.adb (Analyze_Depends_In_Decl_Part): Add continuation message for missing...
authorYannick Moy <moy@adacore.com>
Wed, 6 Sep 2017 10:50:12 +0000 (10:50 +0000)
committerArnaud Charlet <charlet@gcc.gnu.org>
Wed, 6 Sep 2017 10:50:12 +0000 (12:50 +0200)
2017-09-06  Yannick Moy  <moy@adacore.com>

* sem_prag.adb (Analyze_Depends_In_Decl_Part): Add continuation
message for missing input.

2017-09-06  Yannick Moy  <moy@adacore.com>

* inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Prevent inlining
of protected subprograms and entries.
* sem_util.adb, sem_util.ads (Is_Subp_Or_Entry_Inside_Protected):
New function to detect when a subprogram of entry is defined
inside a protected object.

From-SVN: r251778

gcc/ada/ChangeLog
gcc/ada/inline.adb
gcc/ada/sem_prag.adb
gcc/ada/sem_util.adb
gcc/ada/sem_util.ads

index f914d23890113d249b8e2fa8711024ec6dd157ba..733214da004d37c82ab7951f28b2ef67300171a7 100644 (file)
@@ -1,3 +1,16 @@
+2017-09-06  Yannick Moy  <moy@adacore.com>
+
+       * sem_prag.adb (Analyze_Depends_In_Decl_Part): Add continuation
+       message for missing input.
+
+2017-09-06  Yannick Moy  <moy@adacore.com>
+
+       * inline.adb (Can_Be_Inlined_In_GNATprove_Mode): Prevent inlining
+       of protected subprograms and entries.
+       * sem_util.adb, sem_util.ads (Is_Subp_Or_Entry_Inside_Protected):
+       New function to detect when a subprogram of entry is defined
+       inside a protected object.
+
 2017-09-06  Bob Duff  <duff@adacore.com>
 
        * sysdep.c (__gnat_has_cap_sys_nice): New function to determine
index 007d59c9fdae3afb03b18b8f6708b3d4ef8d6b15..6b6222b4d820afca72ea5a5ce8f7b335fed08203 100644 (file)
@@ -1406,6 +1406,13 @@ package body Inline is
       elsif Instantiation_Location (Sloc (Id)) /= No_Location then
          return False;
 
+      --  Do not inline subprograms and entries defined inside protected types,
+      --  which typically are not helper subprograms, which also avoids getting
+      --  spurious messages on calls that cannot be inlined.
+
+      elsif Is_Subp_Or_Entry_Inside_Protected (Id) then
+         return False;
+
       --  Do not inline predicate functions (treated specially by GNATprove)
 
       elsif Is_Predicate_Function (Id) then
index bfca18d87df7b1b5f8587cf54ce7b4361994640d..5066e7689f7bc1cb7945e7974ca0a3f75f5054d0 100644 (file)
@@ -1457,6 +1457,9 @@ package body Sem_Prag is
 
                   Error_Msg := Name_Find;
                   SPARK_Msg_NE (Get_Name_String (Error_Msg), N, Item_Id);
+                  SPARK_Msg_NE
+                    ("\add `null ='> &` dependency to ignore this input",
+                     N, Item_Id);
                end if;
 
             --  Output case (SPARK RM 6.1.5(10))
index 0159a709ffa13fd53d5f3f246402b024a599aa3c..a06ce637748064c4ee92085e57b47507539a486b 100644 (file)
@@ -15539,6 +15539,32 @@ package body Sem_Util is
         and then Ekind (Defining_Entity (N)) /= E_Subprogram_Body;
    end Is_Subprogram_Stub_Without_Prior_Declaration;
 
+   ---------------------------------------
+   -- Is_Subp_Or_Entry_Inside_Protected --
+   ---------------------------------------
+
+   function Is_Subp_Or_Entry_Inside_Protected (E : Entity_Id) return Boolean is
+      Scop : Entity_Id;
+
+   begin
+      case Ekind (E) is
+         when Entry_Kind | Subprogram_Kind =>
+            Scop := Scope (E);
+
+            while Present (Scop) loop
+               if Ekind (Scop) = E_Protected_Type then
+                  return True;
+               end if;
+               Scop := Scope (Scop);
+            end loop;
+
+            return False;
+
+         when others =>
+            return False;
+      end case;
+   end Is_Subp_Or_Entry_Inside_Protected;
+
    --------------------------
    -- Is_Suspension_Object --
    --------------------------
index 6db454b2adc112af2746a836a106ab2994cf4bc5..b73dc0e7879778d2532343683f20238e4c7a483d 100644 (file)
@@ -1842,6 +1842,10 @@ package Sem_Util is
    --  Return True if N is a subprogram stub with no prior subprogram
    --  declaration.
 
+   function Is_Subp_Or_Entry_Inside_Protected (E : Entity_Id) return Boolean;
+   --  Return True if E is an entry or a subprogram that is part (directly or
+   --  in a nested way) of a protected type.
+
    function Is_Suspension_Object (Id : Entity_Id) return Boolean;
    --  Determine whether arbitrary entity Id denotes Suspension_Object defined
    --  in Ada.Synchronous_Task_Control.