summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-04 10:17:30 +0000
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>2016-07-04 10:17:30 +0000
commitf8c469908c795b07b1b55fde894a05df531af5bb (patch)
tree250809c1f3f20dfc031662b25454c1bd0249e8a7 /gcc
parentd3f18ace2dbe9656ae8c2413850e465de3371841 (diff)
downloadgcc-f8c469908c795b07b1b55fde894a05df531af5bb.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@237964 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog26
-rw-r--r--gcc/ada/sem_ch3.adb12
-rw-r--r--gcc/ada/sem_prag.adb13
-rw-r--r--gcc/ada/sem_type.adb6
-rw-r--r--gcc/ada/sinput-l.adb10
-rw-r--r--gcc/ada/sinput.adb2
-rw-r--r--gcc/ada/sinput.ads13
7 files changed, 60 insertions, 22 deletions
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 <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 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 --