From f8c469908c795b07b1b55fde894a05df531af5bb Mon Sep 17 00:00:00 2001 From: charlet Date: Mon, 4 Jul 2016 10:17:30 +0000 Subject: 2016-07-04 Justin Squirek * sem_prag.adb (Analyze_Unmodified_Or_Unused and Analyze_Unreferenced_Or_Unused): Change warning message to be more clear about pragma duplicates. 2016-07-04 Yannick Moy * sinput-l.adb (Create_Instantiation_Source): Set component Inlined_Call for inherited pragma case. * sinput.adb, sinput.ads (Instantiation): Return component Inlined_Call for inherited pragma case. 2016-07-04 Bob Duff * sem_type.adb (Remove_Conversions): Protect the call to Left_Opnd by checking for Nkind in N_Unary_Op -- unary operators do not have a left operand. 2016-07-04 Ed Schonberg * sem_ch3.adb (Analyze_Object_Declaration): A declaration of a constant in a protected operation may be a homonym of a private component of the enclosing protected type. This declaration hides the component renaming constructed within the protected operation. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237964 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ada/ChangeLog | 26 ++++++++++++++++++++++++++ gcc/ada/sem_ch3.adb | 12 +++++++++++- gcc/ada/sem_prag.adb | 13 ++++++++----- gcc/ada/sem_type.adb | 6 ++++-- gcc/ada/sinput-l.adb | 10 +++------- gcc/ada/sinput.adb | 2 +- gcc/ada/sinput.ads | 13 +++++++------ 7 files changed, 60 insertions(+), 22 deletions(-) (limited to 'gcc') diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 697352834df..3c8ac5ee3e5 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,29 @@ +2016-07-04 Justin Squirek + + * sem_prag.adb (Analyze_Unmodified_Or_Unused and + Analyze_Unreferenced_Or_Unused): Change warning message to be + more clear about pragma duplicates. + +2016-07-04 Yannick Moy + + * sinput-l.adb (Create_Instantiation_Source): Set component + Inlined_Call for inherited pragma case. + * sinput.adb, sinput.ads (Instantiation): Return component + Inlined_Call for inherited pragma case. + +2016-07-04 Bob Duff + + * sem_type.adb (Remove_Conversions): Protect + the call to Left_Opnd by checking for Nkind in N_Unary_Op -- + unary operators do not have a left operand. + +2016-07-04 Ed Schonberg + + * sem_ch3.adb (Analyze_Object_Declaration): A declaration of a + constant in a protected operation may be a homonym of a private + component of the enclosing protected type. This declaration hides + the component renaming constructed within the protected operation. + 2016-07-04 Bob Duff * xref_lib.adb (Parse_X_Filename, Parse_Identifier_Info): Ignore diff --git a/gcc/ada/sem_ch3.adb b/gcc/ada/sem_ch3.adb index be0fa8f6506..4dec6ff44f4 100644 --- a/gcc/ada/sem_ch3.adb +++ b/gcc/ada/sem_ch3.adb @@ -3466,7 +3466,17 @@ package body Sem_Ch3 is N_Package_Renaming_Declaration and then not Comes_From_Source (Prev_Entity) and then - Is_Generic_Instance (Renamed_Entity (Prev_Entity)))) + Is_Generic_Instance (Renamed_Entity (Prev_Entity))) + + -- The entity may be a homonym of a private component of the + -- enclosing protected object, for which we create a local + -- renaming declaration. The declaration is legal, even + -- if useless when it just captures that component. + + or else + (Ekind (Scope (Current_Scope)) = E_Protected_Type + and then Nkind (Parent (Prev_Entity)) = + N_Object_Renaming_Declaration)) then Prev_Entity := Empty; end if; diff --git a/gcc/ada/sem_prag.adb b/gcc/ada/sem_prag.adb index 8cda6c75bb2..3a14fdffe94 100644 --- a/gcc/ada/sem_prag.adb +++ b/gcc/ada/sem_prag.adb @@ -4568,10 +4568,12 @@ package body Sem_Prag is elsif Has_Pragma_Unmodified (Arg_Id) then if Has_Pragma_Unused (Arg_Id) then Error_Msg_NE - ("??pragma Unused given for &!", Arg_Expr, Arg_Id); + ("??pragma Unused already given for &!", Arg_Expr, + Arg_Id); else Error_Msg_NE - ("??pragma Unmodified given for &!", Arg_Expr, Arg_Id); + ("??pragma Unmodified already given for &!", Arg_Expr, + Arg_Id); end if; -- Otherwise the pragma referenced an illegal entity @@ -4674,11 +4676,12 @@ package body Sem_Prag is if Has_Pragma_Unreferenced (Arg_Id) then if Has_Pragma_Unused (Arg_Id) then Error_Msg_NE - ("??pragma Unused given for &!", Arg_Expr, Arg_Id); + ("??pragma Unused already given for &!", Arg_Expr, + Arg_Id); else Error_Msg_NE - ("??pragma Unreferenced given for &!", Arg_Expr, - Arg_Id); + ("??pragma Unreferenced already given for &!", + Arg_Expr, Arg_Id); end if; -- Apply Unreferenced to the entity diff --git a/gcc/ada/sem_type.adb b/gcc/ada/sem_type.adb index 2879c3cf9d7..a770149128d 100644 --- a/gcc/ada/sem_type.adb +++ b/gcc/ada/sem_type.adb @@ -1619,8 +1619,10 @@ package body Sem_Type is if Nkind (Act1) in N_Op and then Is_Overloaded (Act1) - and then Nkind_In (Left_Opnd (Act1), N_Integer_Literal, - N_Real_Literal) + and then (Nkind (Act1) in N_Unary_Op + or else Nkind_In + (Left_Opnd (Act1), N_Integer_Literal, + N_Real_Literal)) and then Nkind_In (Right_Opnd (Act1), N_Integer_Literal, N_Real_Literal) and then Has_Compatible_Type (Act1, Standard_Boolean) diff --git a/gcc/ada/sinput-l.adb b/gcc/ada/sinput-l.adb index 32c2ac2e835..f0cce8d2cba 100644 --- a/gcc/ada/sinput-l.adb +++ b/gcc/ada/sinput-l.adb @@ -151,16 +151,12 @@ package body Sinput.L is Snew.Template := Xold; -- For a genuine generic instantiation, assign new instance id. For - -- inlined bodies, we retain that of the template, but we save the - -- call location. For inherited pragmas, we simply retain that of - -- the template. + -- inlined bodies or inherited pragmas, we retain that of the + -- template, but we save the call location. - if Inlined_Body then + if Inlined_Body or Inherited_Pragma then Snew.Inlined_Call := Sloc (Inst_Node); - elsif Inherited_Pragma then - null; - else -- If the spec has been instantiated already, and we are now -- creating the instance source for the corresponding body now, diff --git a/gcc/ada/sinput.adb b/gcc/ada/sinput.adb index 0105b2c4618..a03949463e9 100644 --- a/gcc/ada/sinput.adb +++ b/gcc/ada/sinput.adb @@ -493,7 +493,7 @@ package body Sinput is function Instantiation (S : SFI) return Source_Ptr is SIE : Source_File_Record renames Source_File.Table (S); begin - if SIE.Inlined_Body then + if SIE.Inlined_Body or SIE.Inherited_Pragma then return SIE.Inlined_Call; else return Instances.Table (SIE.Instance); diff --git a/gcc/ada/sinput.ads b/gcc/ada/sinput.ads index 21f16f20174..8165a8f6dea 100644 --- a/gcc/ada/sinput.ads +++ b/gcc/ada/sinput.ads @@ -260,14 +260,13 @@ package Sinput is -- Inlined_Call : Source_Ptr; -- Source file location of the subprogram call if this source file entry - -- represents an inlined body. Set to No_Location otherwise. - -- This field is read-only for clients. + -- represents an inlined body or an inherited pragma. Set to No_Location + -- otherwise. This field is read-only for clients. -- Inlined_Body : Boolean; -- This can only be set True if Instantiation has a value other than -- No_Location. If true it indicates that the instantiation is actually -- an instance of an inlined body. - -- ??? Redundant, always equal to (Inlined_Call /= No_Location) -- Inherited_Pragma : Boolean; -- This can only be set True if Instantiation has a value other than @@ -426,9 +425,11 @@ package Sinput is function Instantiation (S : SFI) return Source_Ptr; -- For a source file entry that represents an inlined body, source location - -- of the inlined call. Otherwise, for a source file entry that represents - -- a generic instantiation, source location of the instantiation. Returns - -- No_Location in all other cases. + -- of the inlined call. For a source file entry that represents an + -- inherited pragma, source location of the declaration to which the + -- overriding subprogram for the inherited pragma is attached. Otherwise, + -- for a source file entry that represents a generic instantiation, source + -- location of the instantiation. Returns No_Location in all other cases. ----------------- -- Global Data -- -- cgit v1.2.1