From b534f49ed624fc05812c551dac997bd0db78dcb4 Mon Sep 17 00:00:00 2001 From: Arnaud Charlet Date: Fri, 20 Feb 2015 14:52:31 +0100 Subject: [PATCH] [multiple changes] 2015-02-20 Robert Dewar * switch-c.adb, bindgen.adb: Minor reformatting. 2015-02-20 Ed Schonberg * sem_prag.adb (Analyze_Pragma, case Type_Invariant): Invariant'class is allowed on an abstract type. 2015-02-20 Ed Schonberg * sem_ch3.adb (Access_Definition): If the access definition is for a protected component and defines an access to protected subprogram, do not create an itype reference for it because a full type declaration will be built in order to generate the proper equivalent type. (Analyze_Subtype_Declaration): Add information of incomplete subtypes, for Ada 2012 extended uses of incomplete types. From-SVN: r220856 --- gcc/ada/ChangeLog | 19 +++++++++++++++++++ gcc/ada/bindgen.adb | 1 + gcc/ada/sem_ch3.adb | 19 ++++++++++++++----- gcc/ada/sem_prag.adb | 2 +- gcc/ada/switch-c.adb | 6 ++---- 5 files changed, 37 insertions(+), 10 deletions(-) diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index c277bb8..9fdfd9e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,22 @@ +2015-02-20 Robert Dewar + + * switch-c.adb, bindgen.adb: Minor reformatting. + +2015-02-20 Ed Schonberg + + * sem_prag.adb (Analyze_Pragma, case Type_Invariant): + Invariant'class is allowed on an abstract type. + +2015-02-20 Ed Schonberg + + * sem_ch3.adb (Access_Definition): If the access definition is + for a protected component and defines an access to protected + subprogram, do not create an itype reference for it because a + full type declaration will be built in order to generate the + proper equivalent type. + (Analyze_Subtype_Declaration): Add information of incomplete + subtypes, for Ada 2012 extended uses of incomplete types. + 2015-02-20 Gary Dismukes * sem_res.adb: Minor reformatting. diff --git a/gcc/ada/bindgen.adb b/gcc/ada/bindgen.adb index b3589d4..798db09 100644 --- a/gcc/ada/bindgen.adb +++ b/gcc/ada/bindgen.adb @@ -1979,6 +1979,7 @@ package body Bindgen is end if; -- Add a "-Ldir" for each directory in the object path + if VM_Target /= CLI_Target then for J in 1 .. Nb_Dir_In_Obj_Search_Path loop declare diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index c651148..009b394 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -878,7 +878,14 @@ package body Sem_Ch3 is -- create a reference to it after the enclosing protected definition -- because the itype will be used in the subsequent bodies. - if Ekind (Current_Scope) = E_Protected_Type then + -- If the anonymous access itself is protected, a full type + -- declaratiton will be created for it, so that the equivalent + -- record type can be constructed. For further details, see + -- Replace_Anonymous_Access_To_Protected-Subprogram. + + if Ekind (Current_Scope) = E_Protected_Type + and then not Protected_Present (Access_To_Subprogram_Definition (N)) + then Build_Itype_Reference (Anon_Type, Parent (Current_Scope)); end if; @@ -4978,16 +4985,17 @@ package body Sem_Ch3 is end if; if Has_Discriminants (T) then - Set_Discriminant_Constraint (Id, - Discriminant_Constraint (T)); + Set_Discriminant_Constraint + (Id, Discriminant_Constraint (T)); Set_Stored_Constraint_From_Discriminant_Constraint (Id); end if; - when E_Incomplete_Type => + when Incomplete_Kind => if Ada_Version >= Ada_2005 then -- In Ada 2005 an incomplete type can be explicitly tagged: - -- propagate indication. + -- propagate indication. Note that we also have to include + -- subtypes for Ada 2012 extended use of incomplete types. Set_Ekind (Id, E_Incomplete_Subtype); Set_Is_Tagged_Type (Id, Is_Tagged_Type (T)); @@ -4996,6 +5004,7 @@ package body Sem_Ch3 is if Is_Tagged_Type (Id) then Set_No_Tagged_Streams_Pragma (Id, No_Tagged_Streams_Pragma (T)); + Set_Direct_Primitive_Operations (Id, New_Elmt_List); end if; -- Ada 2005 (AI-412): Decorate an incomplete subtype of an diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index df97ee6..823e4cb 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -15732,7 +15732,7 @@ package body Sem_Prag is -- Not allowed for abstract type - if Is_Abstract_Type (Typ) then + if Is_Abstract_Type (Typ) and then not Class_Present (N) then Error_Pragma_Arg ("pragma% not allowed for abstract type", Arg1); end if; diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb index b431081..4f2f06e 100644 --- a/gcc/ada/switch-c.adb +++ b/gcc/ada/switch-c.adb @@ -219,10 +219,8 @@ package body Switch.C is (Switch_Chars (Ptr + 4 .. Max)) then Runtime_Dir := - new String' - (System.OS_Lib.Normalize_Pathname - (Switch_Chars (Ptr + 4 .. Max))); - + new String'(System.OS_Lib.Normalize_Pathname + (Switch_Chars (Ptr + 4 .. Max))); else Runtime_Dir := new String'(Switch_Chars (Ptr + 4 .. Max)); -- 2.7.4