From c2cfccb1cf1ea317efe9f061394fd1586a0866df Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 22 May 2015 12:20:00 +0200 Subject: [PATCH] [multiple changes] 2015-05-22 Eric Botcazou * sem_ch8.adb (Analyze_Object_Renaming): Copy Has_Volatile_Full_Access from renamed to renaming entities. * sem_prag.adb (Process_Atomic_Independent_Shared_Volatile): Tidy up and remove redundant setting of Has_Volatile_Full_Access. 2015-05-22 Hristian Kirtchev * ghost.adb (Check_Ghost_Completion): Update references to SPARK RM 6.9 rules. (Check_Ghost_Policy): Update references to SPARK RM 6.9 rules. * sem_ch3.adb (Analyze_Object_Declaration): Update references to SPARK RM 6.9 rules. (Check_Completion): Ghost entities do not require a special form of completion. * sem_ch6.adb (Analyze_Generic_Subprogram_Body): Update references to SPARK RM 6.9 rules. (Analyze_Subprogram_Body_Helper): Update references to SPARK RM 6.9 rules. * sem_ch7.adb (Analyze_Package_Body_Helper): Update references to SPARK RM 6.9 rules. (Requires_Completion_In_Body): Ghost entities do not require a special form of completion. 2015-05-22 Robert Dewar * a-csquin.ads: Use Ada 2012 notation. * sem_ch8.adb: Minor reformatting. 2015-05-22 Hristian Kirtchev * sem_ch13.adb (Analyze_Aspect_Specifications): Aspect Import acts as a completion. From-SVN: r223534 --- gcc/ada/ChangeLog | 35 +++++++++++++++++++++++++++++++++++ gcc/ada/a-csquin.ads | 22 +++++----------------- gcc/ada/ghost.adb | 6 +++--- gcc/ada/sem_ch13.adb | 1 + gcc/ada/sem_ch3.adb | 12 +++--------- gcc/ada/sem_ch6.adb | 4 ++-- gcc/ada/sem_ch7.adb | 8 +------- gcc/ada/sem_ch8.adb | 8 +++++--- gcc/ada/sem_prag.adb | 32 +++++++++++++++----------------- 9 files changed, 70 insertions(+), 58 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 7e59e554eaf..cc91e17dbbf 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,38 @@ +2015-05-22 Eric Botcazou + + * sem_ch8.adb (Analyze_Object_Renaming): Copy + Has_Volatile_Full_Access from renamed to renaming entities. + * sem_prag.adb (Process_Atomic_Independent_Shared_Volatile): + Tidy up and remove redundant setting of Has_Volatile_Full_Access. + +2015-05-22 Hristian Kirtchev + + * ghost.adb (Check_Ghost_Completion): Update references to SPARK + RM 6.9 rules. + (Check_Ghost_Policy): Update references to SPARK RM 6.9 rules. + * sem_ch3.adb (Analyze_Object_Declaration): Update references + to SPARK RM 6.9 rules. + (Check_Completion): Ghost entities do not require a special form of + completion. + * sem_ch6.adb (Analyze_Generic_Subprogram_Body): Update references + to SPARK RM 6.9 rules. + (Analyze_Subprogram_Body_Helper): Update references to SPARK RM 6.9 + rules. + * sem_ch7.adb (Analyze_Package_Body_Helper): Update references + to SPARK RM 6.9 rules. + (Requires_Completion_In_Body): Ghost entities do not require a special + form of completion. + +2015-05-22 Robert Dewar + + * a-csquin.ads: Use Ada 2012 notation. + * sem_ch8.adb: Minor reformatting. + +2015-05-22 Hristian Kirtchev + + * sem_ch13.adb (Analyze_Aspect_Specifications): Aspect Import + acts as a completion. + 2015-05-22 Ed Schonberg * sem_ch13.adb: Minor reformatting. diff --git a/gcc/ada/a-csquin.ads b/gcc/ada/a-csquin.ads index 7567444177e..c9957a35d28 100644 --- a/gcc/ada/a-csquin.ads +++ b/gcc/ada/a-csquin.ads @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 2011, Free Software Foundation, Inc. -- +-- Copyright (C) 2011-2015, Free Software Foundation, Inc. -- -- -- -- This specification is derived from the Ada Reference Manual for use with -- -- GNAT. The copyright notice above, and the license provisions that follow -- @@ -41,25 +41,13 @@ package Ada.Containers.Synchronized_Queue_Interfaces is procedure Enqueue (Container : in out Queue; - New_Item : Element_Type) is abstract; - - -- ??? - -- This is the official Ada 2012 syntax: - -- with Synchronization => By_Entry; - - -- This is the temporary work-around: - pragma Implemented (Enqueue, By_Entry); + New_Item : Element_Type) is abstract + with Synchronization => By_Entry; procedure Dequeue (Container : in out Queue; - Element : out Element_Type) is abstract; - - -- ??? - -- This is the official Ada 2012 syntax: - -- with Synchronization => By_Entry; - - -- This is the temporary work-around: - pragma Implemented (Dequeue, By_Entry); + Element : out Element_Type) is abstract + with Synchronization => By_Entry; function Current_Use (Container : Queue) return Count_Type is abstract; diff --git a/gcc/ada/ghost.adb b/gcc/ada/ghost.adb index 2c3be8f4e43..b608a450e64 100644 --- a/gcc/ada/ghost.adb +++ b/gcc/ada/ghost.adb @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 2014-2015, Free Software Foundation, Inc. -- +-- Copyright (C) 2014-2015, 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- -- @@ -106,7 +106,7 @@ package body Ghost is begin -- The Ghost policy in effect at the point of declaration and at the - -- point of completion must match (SPARK RM 6.9(15)). + -- point of completion must match (SPARK RM 6.9(14)). if Is_Checked_Ghost_Entity (Partial_View) and then Policy = Name_Ignore @@ -411,7 +411,7 @@ package body Ghost is else Error_Msg_N - ("ghost entity cannot appear in this context (SPARK RM 6.9(12))", + ("ghost entity cannot appear in this context (SPARK RM 6.9(11))", Ghost_Ref); end if; end Check_Ghost_Context; diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb index eb2c095c210..474aa5e7c6f 100644 --- a/gcc/ada/sem_ch13.adb +++ b/gcc/ada/sem_ch13.adb @@ -3115,6 +3115,7 @@ package body Sem_Ch13 is then if A_Id = Aspect_Import then Set_Is_Imported (E); + Set_Has_Completion (E); -- An imported entity cannot have an explicit -- initialization. diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index 47f6e701b17..65c85762ef7 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -4055,7 +4055,7 @@ package body Sem_Ch3 is -- The Ghost policy in effect at the point of declaration -- and at the point of completion must match - -- (SPARK RM 6.9(15)). + -- (SPARK RM 6.9(14)). if Present (Prev_Entity) and then Is_Ghost_Entity (Prev_Entity) @@ -4237,7 +4237,7 @@ package body Sem_Ch3 is Set_Is_Ghost_Entity (Id); -- The Ghost policy in effect at the point of declaration and at the - -- point of completion must match (SPARK RM 6.9(16)). + -- point of completion must match (SPARK RM 6.9(14)). if Present (Prev_Entity) and then Is_Ghost_Entity (Prev_Entity) then Check_Ghost_Completion (Prev_Entity, Id); @@ -10937,12 +10937,6 @@ package body Sem_Ch3 is if Is_Intrinsic_Subprogram (E) then null; - -- A Ghost entity declared in a non-Ghost package does not force the - -- need for a body (SPARK RM 6.9(11)). - - elsif not Is_Ghost_Entity (Pack_Id) and then Is_Ghost_Entity (E) then - null; - -- The following situation requires special handling: a child unit -- that appears in the context clause of the body of its parent: @@ -19964,7 +19958,7 @@ package body Sem_Ch3 is Set_Is_Ghost_Entity (Full_T); -- The Ghost policy in effect at the point of declaration and at the - -- point of completion must match (SPARK RM 6.9(15)). + -- point of completion must match (SPARK RM 6.9(14)). Check_Ghost_Completion (Priv_T, Full_T); diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb index 001365b712f..e366af2ac02 100644 --- a/gcc/ada/sem_ch6.adb +++ b/gcc/ada/sem_ch6.adb @@ -1267,7 +1267,7 @@ package body Sem_Ch6 is Set_Is_Ghost_Entity (Body_Id); -- The Ghost policy in effect at the point of declaration and at - -- the point of completion must match (SPARK RM 6.9(15)). + -- the point of completion must match (SPARK RM 6.9(14)). Check_Ghost_Completion (Gen_Id, Body_Id); end if; @@ -3265,7 +3265,7 @@ package body Sem_Ch6 is Set_Is_Ghost_Entity (Body_Id); -- The Ghost policy in effect at the point of declaration and - -- at the point of completion must match (SPARK RM 6.9(15)). + -- at the point of completion must match (SPARK RM 6.9(14)). Check_Ghost_Completion (Spec_Id, Body_Id); end if; diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb index 3369fad4aa8..644a0de8ad2 100644 --- a/gcc/ada/sem_ch7.adb +++ b/gcc/ada/sem_ch7.adb @@ -750,7 +750,7 @@ package body Sem_Ch7 is Set_Is_Ghost_Entity (Body_Id); -- The Ghost policy in effect at the point of declaration and at the - -- point of completion must match (SPARK RM 6.9(15)). + -- point of completion must match (SPARK RM 6.9(14)). Check_Ghost_Completion (Spec_Id, Body_Id); end if; @@ -2527,12 +2527,6 @@ package body Sem_Ch7 is then return False; - -- A Ghost entity declared in a non-Ghost package does not force the - -- need for a body (SPARK RM 6.9(11)). - - elsif not Is_Ghost_Entity (Pack_Id) and then Is_Ghost_Entity (Id) then - return False; - -- Otherwise test to see if entity requires a completion. Note that -- subprogram entities whose declaration does not come from source are -- ignored here on the basis that we assume the expander will provide an diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb index c8c9f1f56dc..c1c40bc59aa 100644 --- a/gcc/ada/sem_ch8.adb +++ b/gcc/ada/sem_ch8.adb @@ -1344,11 +1344,13 @@ package body Sem_Ch8 is Set_Is_Volatile (Id, Is_Volatile_Object (Nam)); - -- Also copy settings of Is_Atomic and Is_Independent + -- Also copy settings of Atomic/Independent/Volatile_Full_Access if Is_Entity_Name (Nam) then - Set_Is_Atomic (Id, Is_Atomic (Entity (Nam))); - Set_Is_Independent (Id, Is_Independent (Entity (Nam))); + Set_Is_Atomic (Id, Is_Atomic (Entity (Nam))); + Set_Is_Independent (Id, Is_Independent (Entity (Nam))); + Set_Has_Volatile_Full_Access (Id, + Has_Volatile_Full_Access (Entity (Nam))); end if; -- Treat as volatile if we just set the Volatile flag diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 5ab6f502113..391d546ae78 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -5910,6 +5910,9 @@ package body Sem_Prag is Check_First_Subtype (Arg1); end if; + -- Attribute belongs on the base type. If the view of the type is + -- currently private, it also belongs on the underlying type. + if Prag_Id = Pragma_Atomic or else Prag_Id = Pragma_Shared @@ -5917,31 +5920,26 @@ package body Sem_Prag is Prag_Id = Pragma_Volatile_Full_Access then Set_Atomic_Full (E); - Set_Atomic_Full (Underlying_Type (E)); Set_Atomic_Full (Base_Type (E)); + Set_Atomic_Full (Underlying_Type (E)); end if; -- Atomic/Shared/Volatile_Full_Access imply Independent if Prag_Id /= Pragma_Volatile then Set_Is_Independent (E); - Set_Is_Independent (Underlying_Type (E)); Set_Is_Independent (Base_Type (E)); + Set_Is_Independent (Underlying_Type (E)); if Prag_Id = Pragma_Independent then Record_Independence_Check (N, Base_Type (E)); end if; end if; - -- Attribute belongs on the base type. If the view of the type is - -- currently private, it also belongs on the underlying type. + -- Atomic/Shared/Volatile_Full_Access imply Volatile if Prag_Id /= Pragma_Independent then - if Prag_Id = Pragma_Volatile_Full_Access then - Set_Has_Volatile_Full_Access (Base_Type (E)); - Set_Has_Volatile_Full_Access (Underlying_Type (E)); - end if; - + Set_Is_Volatile (E); Set_Is_Volatile (Base_Type (E)); Set_Is_Volatile (Underlying_Type (E)); @@ -5994,8 +5992,8 @@ package body Sem_Prag is -- treated as atomic, thus incurring a potentially costly -- synchronization operation for every access. - -- For Volatile_Full_Access we can do this for elementary - -- types too, since there is no issue of atomic sync. + -- For Volatile_Full_Access we can do this for elementary types + -- too, since there is no issue of atomic synchronization. -- Of course it would be best if the back end could just adjust -- the alignment etc for the specific object, but that's not @@ -6010,19 +6008,17 @@ package body Sem_Prag is and then Sloc (Utyp) > No_Location and then Get_Source_File_Index (Sloc (E)) = - Get_Source_File_Index (Sloc (Underlying_Type (Etype (E)))) + Get_Source_File_Index (Sloc (Utyp)) then if Prag_Id = Pragma_Volatile_Full_Access then - Set_Has_Volatile_Full_Access - (Underlying_Type (Etype (E))); + Set_Has_Volatile_Full_Access (Utyp); else - Set_Is_Atomic - (Underlying_Type (Etype (E))); + Set_Is_Atomic (Utyp); end if; end if; end if; - -- Atomic/Shared imply both Independent and Volatile + -- Atomic/Shared/Volatile_Full_Access imply Independent if Prag_Id /= Pragma_Volatile then Set_Is_Independent (E); @@ -6032,6 +6028,8 @@ package body Sem_Prag is end if; end if; + -- Atomic/Shared/Volatile_Full_Access imply Volatile + if Prag_Id /= Pragma_Independent then Set_Is_Volatile (E); Set_Treat_As_Volatile (E); -- 2.30.2