From a9e6f868cb1467dc53328ed3585156bc8bc0620f Mon Sep 17 00:00:00 2001 From: Yannick Moy Date: Wed, 6 Sep 2017 10:50:12 +0000 Subject: [PATCH] sem_prag.adb (Analyze_Depends_In_Decl_Part): Add continuation message for missing input. 2017-09-06 Yannick Moy * sem_prag.adb (Analyze_Depends_In_Decl_Part): Add continuation message for missing input. 2017-09-06 Yannick Moy * 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 | 13 +++++++++++++ gcc/ada/inline.adb | 7 +++++++ gcc/ada/sem_prag.adb | 3 +++ gcc/ada/sem_util.adb | 26 ++++++++++++++++++++++++++ gcc/ada/sem_util.ads | 4 ++++ 5 files changed, 53 insertions(+) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index f914d238901..733214da004 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,16 @@ +2017-09-06 Yannick Moy + + * sem_prag.adb (Analyze_Depends_In_Decl_Part): Add continuation + message for missing input. + +2017-09-06 Yannick Moy + + * 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 * sysdep.c (__gnat_has_cap_sys_nice): New function to determine diff --git a/gcc/ada/inline.adb b/gcc/ada/inline.adb index 007d59c9fda..6b6222b4d82 100644 --- a/gcc/ada/inline.adb +++ b/gcc/ada/inline.adb @@ -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 diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index bfca18d87df..5066e7689f7 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -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)) diff --git a/gcc/ada/sem_util.adb b/gcc/ada/sem_util.adb index 0159a709ffa..a06ce637748 100644 --- a/gcc/ada/sem_util.adb +++ b/gcc/ada/sem_util.adb @@ -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 -- -------------------------- diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads index 6db454b2adc..b73dc0e7879 100644 --- a/gcc/ada/sem_util.ads +++ b/gcc/ada/sem_util.ads @@ -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. -- 2.30.2