diff options
author | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-07-04 12:17:30 +0200 |
---|---|---|
committer | Arnaud Charlet <charlet@gcc.gnu.org> | 2016-07-04 12:17:30 +0200 |
commit | f50f7e2c00bb3cbf404b241d88af8697b33d2279 (patch) | |
tree | 250809c1f3f20dfc031662b25454c1bd0249e8a7 /gcc | |
parent | 96df3ff4bd3b0f2ce63f519955f20f7d93612929 (diff) | |
download | gcc-f50f7e2c00bb3cbf404b241d88af8697b33d2279.zip gcc-f50f7e2c00bb3cbf404b241d88af8697b33d2279.tar.gz gcc-f50f7e2c00bb3cbf404b241d88af8697b33d2279.tar.bz2 |
[multiple changes]
2016-07-04 Justin Squirek <squirek@adacore.com>
* 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 <moy@adacore.com>
* 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 <duff@adacore.com>
* 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 <schonberg@adacore.com>
* 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.
From-SVN: r237964
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 26 | ||||
-rw-r--r-- | gcc/ada/sem_ch3.adb | 12 | ||||
-rw-r--r-- | gcc/ada/sem_prag.adb | 13 | ||||
-rw-r--r-- | gcc/ada/sem_type.adb | 6 | ||||
-rw-r--r-- | gcc/ada/sinput-l.adb | 10 | ||||
-rw-r--r-- | gcc/ada/sinput.adb | 2 | ||||
-rw-r--r-- | gcc/ada/sinput.ads | 13 |
7 files changed, 60 insertions, 22 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index 6973528..3c8ac5e 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,3 +1,29 @@ +2016-07-04 Justin Squirek <squirek@adacore.com> + + * 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 <moy@adacore.com> + + * 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 <duff@adacore.com> + + * 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 <schonberg@adacore.com> + + * 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 <duff@adacore.com> * 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 be0fa8f..4dec6ff 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 8cda6c7..3a14fdf 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 2879c3c..a770149 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 32c2ac2..f0cce8d 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 0105b2c..a039494 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 21f16f2..8165a8f 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 -- |