aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2011-08-01 17:13:25 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2011-08-01 17:13:25 +0200
commit1f25038381847b32fda35dd91ae0053635509a83 (patch)
treef2a6bb372c9048c9925ba8b26c7e25266961f2d4 /gcc
parent5dabb19c6d5d5ac5d8d3c6e4407668b4b27ebdf2 (diff)
downloadgcc-1f25038381847b32fda35dd91ae0053635509a83.zip
gcc-1f25038381847b32fda35dd91ae0053635509a83.tar.gz
gcc-1f25038381847b32fda35dd91ae0053635509a83.tar.bz2
[multiple changes]
2011-08-01 Thomas Quinot <quinot@adacore.com> * sem_ch6.adb (Enter_Overloaded_Entity): Do not warn about a declaration being hidden when overriding an implicit inherited subprogram. * par-ch10.adb (P_Compilation_Unit): In syntax check only mode (-gnats), do not complain about a source file that contains only a pragma No_Body. 2011-08-01 Ed Schonberg <schonberg@adacore.com> * sem_ch5.adb (Analyze_Iterator_Scheme): Do not overwrite type of loop variable if already set. From-SVN: r177046
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ada/ChangeLog14
-rw-r--r--gcc/ada/par-ch10.adb16
-rw-r--r--gcc/ada/sem_ch5.adb11
-rw-r--r--gcc/ada/sem_ch6.adb11
4 files changed, 47 insertions, 5 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 1e5bba7..bc66804 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,17 @@
+2011-08-01 Thomas Quinot <quinot@adacore.com>
+
+ * sem_ch6.adb (Enter_Overloaded_Entity): Do not warn about a
+ declaration being hidden when overriding an implicit inherited
+ subprogram.
+ * par-ch10.adb (P_Compilation_Unit): In syntax check only mode
+ (-gnats), do not complain about a source file that contains only a
+ pragma No_Body.
+
+2011-08-01 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch5.adb (Analyze_Iterator_Scheme): Do not overwrite type of loop
+ variable if already set.
+
2011-08-01 Arnaud Charlet <charlet@adacore.com>
* g-socket-dummy.adb, s-osinte-linux.ads, g-socket-dummy.ads,
diff --git a/gcc/ada/par-ch10.adb b/gcc/ada/par-ch10.adb
index 37992b6..d3c1c16 100644
--- a/gcc/ada/par-ch10.adb
+++ b/gcc/ada/par-ch10.adb
@@ -114,6 +114,7 @@ package body Ch10 is
Config_Pragmas : List_Id;
P : Node_Id;
SR_Present : Boolean;
+ No_Body : Boolean;
Cunit_Error_Flag : Boolean := False;
-- This flag is set True if we have to scan for a compilation unit
@@ -145,6 +146,10 @@ package body Ch10 is
SR_Present := False;
+ -- If we see a pragma No_Body, remember not to complain about no body
+
+ No_Body := False;
+
if Token = Tok_Pragma then
Save_Scan_State (Scan_State);
Item := P_Pragma;
@@ -179,6 +184,10 @@ package body Ch10 is
Save_Scan_State (Scan_State);
Item := P_Pragma;
+ if Item /= Error and then Pragma_Name (Item) = Name_No_Body then
+ No_Body := True;
+ end if;
+
if Item = Error
or else not Is_Configuration_Pragma_Name (Pragma_Name (Item))
then
@@ -301,7 +310,12 @@ package body Ch10 is
else
if Operating_Mode = Check_Syntax and then Token = Tok_EOF then
- Error_Msg_SC ("?file contains no compilation units");
+
+ -- Do not complain if there is a pragma No_Body
+
+ if not No_Body then
+ Error_Msg_SC ("?file contains no compilation units");
+ end if;
else
Error_Msg_SC ("compilation unit expected");
Cunit_Error_Flag := True;
diff --git a/gcc/ada/sem_ch5.adb b/gcc/ada/sem_ch5.adb
index 90a6926..96c778d 100644
--- a/gcc/ada/sem_ch5.adb
+++ b/gcc/ada/sem_ch5.adb
@@ -1947,7 +1947,16 @@ package body Sem_Ch5 is
Make_Index (DS, LP);
Set_Ekind (Id, E_Loop_Parameter);
- Set_Etype (Id, Etype (DS));
+
+ -- If the loop is part of a predicate or precondition, it may
+ -- be analyzed twice, once in the source and once on the copy
+ -- used to check conformance. Preserve the original itype
+ -- because the second one may be created in a different scope,
+ -- e.g. a precondition procedure, leading to a crash in GIGI.
+
+ if No (Etype (Id)) or else Etype (Id) = Any_Type then
+ Set_Etype (Id, Etype (DS));
+ end if;
-- Treat a range as an implicit reference to the type, to
-- inhibit spurious warnings.
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index 46d3a20..2633fca 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -6048,7 +6048,13 @@ package body Sem_Ch6 is
-- of the real danger that different operators may be applied in
-- various parts of the program.
- if (not Is_Overloadable (E) or else Subtype_Conformant (E, S))
+ -- Note that if E and S have the same scope, there is never any
+ -- hiding. Either the two conflict, and the program is illegal,
+ -- or S is overriding an implicit inherited subprogram.
+
+ if Scope (E) /= Scope (S)
+ and then (not Is_Overloadable (E)
+ or else Subtype_Conformant (E, S))
and then (Is_Immediately_Visible (E)
or else
Is_Potentially_Use_Visible (S))
@@ -6059,8 +6065,7 @@ package body Sem_Ch6 is
elsif Nkind (S) = N_Defining_Operator_Symbol
and then
- Scope (
- Base_Type (Etype (First_Formal (S)))) /= Scope (S)
+ Scope (Base_Type (Etype (First_Formal (S)))) /= Scope (S)
then
Error_Msg_N
("declaration of & hides predefined operator?", S);