[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
This commit is contained in:
Arnaud Charlet 2016-07-04 12:17:30 +02:00
parent 96df3ff4bd
commit f50f7e2c00
7 changed files with 60 additions and 22 deletions

View File

@ -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

View File

@ -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;

View File

@ -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

View File

@ -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)

View File

@ -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,

View File

@ -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);

View File

@ -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 --