aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2015-10-26 11:45:50 +0100
committerArnaud Charlet <charlet@gcc.gnu.org>2015-10-26 11:45:50 +0100
commit77237288bdc644eed58d9e8bff1cad8c268a499d (patch)
tree9b223781d423fc671f542b52e473605a09494492 /gcc/ada
parent02886c2e8a6056b5e969f57431671d0980596f0b (diff)
downloadgcc-77237288bdc644eed58d9e8bff1cad8c268a499d.zip
gcc-77237288bdc644eed58d9e8bff1cad8c268a499d.tar.gz
gcc-77237288bdc644eed58d9e8bff1cad8c268a499d.tar.bz2
[multiple changes]
2015-10-26 Bob Duff <duff@adacore.com> * sem_ch13.adb (Check_Iterator_Functions): For a Default_Iterator aspect, make sure an implicitly declared interpretation is overridden by an explicit one. * sem_util.ads: Update comment. 2015-10-26 Hristian Kirtchev <kirtchev@adacore.com> * sem_ch7.adb, sem_ch6.adb (Analyze_Subprogram_Body_Helper): Only source bodies should "freeze" the contract of the nearest enclosing package body. From-SVN: r229321
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog13
-rw-r--r--gcc/ada/sem_ch13.adb23
-rw-r--r--gcc/ada/sem_ch6.adb9
-rw-r--r--gcc/ada/sem_ch7.adb6
-rw-r--r--gcc/ada/sem_util.ads7
5 files changed, 45 insertions, 13 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 7b5a828..232b1fc 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,16 @@
+2015-10-26 Bob Duff <duff@adacore.com>
+
+ * sem_ch13.adb (Check_Iterator_Functions): For a Default_Iterator
+ aspect, make sure an implicitly declared interpretation is
+ overridden by an explicit one.
+ * sem_util.ads: Update comment.
+
+2015-10-26 Hristian Kirtchev <kirtchev@adacore.com>
+
+ * sem_ch7.adb, sem_ch6.adb (Analyze_Subprogram_Body_Helper): Only source
+ bodies should "freeze" the contract of the nearest enclosing
+ package body.
+
2015-10-26 Joel Brobecker <brobecker@adacore.com brobecker>
* adaint.c (__gnat_lwp_self): Replace current implementation re-using
diff --git a/gcc/ada/sem_ch13.adb b/gcc/ada/sem_ch13.adb
index 06b5cf8..9ef6263 100644
--- a/gcc/ada/sem_ch13.adb
+++ b/gcc/ada/sem_ch13.adb
@@ -4277,8 +4277,8 @@ package body Sem_Ch13 is
else
declare
Default : Entity_Id := Empty;
- I : Interp_Index;
- It : Interp;
+ I : Interp_Index;
+ It : Interp;
begin
Get_First_Interp (Expr, I, It);
@@ -4289,12 +4289,21 @@ package body Sem_Ch13 is
Remove_Interp (I);
elsif Present (Default) then
- Error_Msg_N ("default iterator must be unique", Expr);
- Error_Msg_Sloc := Sloc (Default);
- Error_Msg_N ("\\possible interpretation#", Expr);
- Error_Msg_Sloc := Sloc (It.Nam);
- Error_Msg_N ("\\possible interpretation#", Expr);
+ -- An explicit one should override an implicit one
+
+ if Comes_From_Source (Default) =
+ Comes_From_Source (It.Nam)
+ then
+ Error_Msg_N ("default iterator must be unique", Expr);
+ Error_Msg_Sloc := Sloc (Default);
+ Error_Msg_N ("\\possible interpretation#", Expr);
+ Error_Msg_Sloc := Sloc (It.Nam);
+ Error_Msg_N ("\\possible interpretation#", Expr);
+
+ elsif Comes_From_Source (It.Nam) then
+ Default := It.Nam;
+ end if;
else
Default := It.Nam;
end if;
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 283b770..0f26158 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -3011,7 +3011,14 @@ package body Sem_Ch6 is
-- decoupled from the usual Freeze_xxx mechanism because it must also
-- work in the context of generics where normal freezing is disabled.
- Analyze_Enclosing_Package_Body_Contract (N);
+ -- Only bodies coming from source should cause this type of "freezing".
+ -- Expression functions that act as bodies and complete an initial
+ -- declaration must be included in this category, hence the use of
+ -- Original_Node.
+
+ if Comes_From_Source (Original_Node (N)) then
+ Analyze_Enclosing_Package_Body_Contract (N);
+ end if;
-- Generic subprograms are handled separately. They always have a
-- generic specification. Determine whether current scope has a
diff --git a/gcc/ada/sem_ch7.adb b/gcc/ada/sem_ch7.adb
index 5814bc8..4874844 100644
--- a/gcc/ada/sem_ch7.adb
+++ b/gcc/ada/sem_ch7.adb
@@ -564,7 +564,11 @@ package body Sem_Ch7 is
-- Freeze_xxx mechanism because it must also work in the context of
-- generics where normal freezing is disabled.
- Analyze_Enclosing_Package_Body_Contract (N);
+ -- Only bodies coming from source should cause this type of "freezing"
+
+ if Comes_From_Source (N) then
+ Analyze_Enclosing_Package_Body_Contract (N);
+ end if;
-- Find corresponding package specification, and establish the current
-- scope. The visible defining entity for the package is the defining
diff --git a/gcc/ada/sem_util.ads b/gcc/ada/sem_util.ads
index 81e63ed..d7d08e6 100644
--- a/gcc/ada/sem_util.ads
+++ b/gcc/ada/sem_util.ads
@@ -538,10 +538,9 @@ package Sem_Util is
function Enclosing_Lib_Unit_Entity
(E : Entity_Id := Current_Scope) return Entity_Id;
- -- Returns the entity of enclosing library unit node which is the
- -- root of the current scope (which must not be Standard_Standard, and the
- -- caller is responsible for ensuring this condition) or other specified
- -- entity.
+ -- Returns the entity of enclosing library unit node which is the root of
+ -- the current scope (which must not be Standard_Standard, and the caller
+ -- is responsible for ensuring this condition) or other specified entity.
function Enclosing_Lib_Unit_Node (N : Node_Id) return Node_Id;
-- Returns the N_Compilation_Unit node of the library unit that is directly