aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada
diff options
context:
space:
mode:
authorArnaud Charlet <charlet@gcc.gnu.org>2009-04-07 18:56:30 +0200
committerArnaud Charlet <charlet@gcc.gnu.org>2009-04-07 18:56:30 +0200
commita2dc5812ff7b8d195399c4f9513dcf0376eba4d5 (patch)
treebf873f637952d8d54457128fc745e447b244ee92 /gcc/ada
parent0ac73189d6da2eccda3b1ffb4bbe89981b4879f4 (diff)
downloadgcc-a2dc5812ff7b8d195399c4f9513dcf0376eba4d5.zip
gcc-a2dc5812ff7b8d195399c4f9513dcf0376eba4d5.tar.gz
gcc-a2dc5812ff7b8d195399c4f9513dcf0376eba4d5.tar.bz2
[multiple changes]
2009-04-07 Thomas Quinot <quinot@adacore.com> * exp_ch4.adb (Expand_Concatenate): Add missing conversion to index type for the case of concatenating a constrained array indexed by an enumeration type. 2009-04-07 Ed Schonberg <schonberg@adacore.com> * sem_ch6.adb (Check_Conformance): when checking conformance of an operation that overrides an abstract operation inherited from an interface, return False if only one of the controlling formals is an access parameter. 2009-04-07 Ed Schonberg <schonberg@adacore.com> * sem_ch8.adb (Analyze_Object_Renaming): additional error messages mandated by AI05-105. 2009-04-07 Vincent Celier <celier@adacore.com> * prj-nmsc.adb (Get_Mains): Warn if a main is an empty string 2009-04-07 Thomas Quinot <quinot@adacore.com> * usage.adb: Minor fix in usage message. * sem_ch10.adb (Remove_Homonyms): Fix subtype of formal in body to match declaration; the correct subtype is Node_Id, not Entity_Id, because the expected node kind is an identifier, not a defining identifier. * switch-c.adb: Minor reformatting. * uintp.adb: Minor reformatting. 2009-04-07 Robert Dewar <dewar@adacore.com> * exp_ch13.adb: Minor reformatting From-SVN: r145696
Diffstat (limited to 'gcc/ada')
-rw-r--r--gcc/ada/ChangeLog39
-rw-r--r--gcc/ada/exp_ch13.adb1
-rw-r--r--gcc/ada/exp_ch4.adb25
-rw-r--r--gcc/ada/prj-nmsc.adb20
-rw-r--r--gcc/ada/sem_ch10.adb27
-rw-r--r--gcc/ada/sem_ch6.adb15
-rw-r--r--gcc/ada/sem_ch8.adb20
-rw-r--r--gcc/ada/switch-c.adb4
-rw-r--r--gcc/ada/uintp.adb2
-rw-r--r--gcc/ada/usage.adb2
10 files changed, 117 insertions, 38 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog
index 9211323..ba8fd1f 100644
--- a/gcc/ada/ChangeLog
+++ b/gcc/ada/ChangeLog
@@ -1,3 +1,42 @@
+2009-04-07 Thomas Quinot <quinot@adacore.com>
+
+ * exp_ch4.adb (Expand_Concatenate): Add missing conversion to index
+ type for the case of concatenating a constrained array indexed by an
+ enumeration type.
+
+2009-04-07 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch6.adb (Check_Conformance): when checking conformance of an
+ operation that overrides an abstract operation inherited from an
+ interface, return False if only one of the controlling formals is an
+ access parameter.
+
+2009-04-07 Ed Schonberg <schonberg@adacore.com>
+
+ * sem_ch8.adb (Analyze_Object_Renaming): additional error messages
+ mandated by AI05-105.
+
+2009-04-07 Vincent Celier <celier@adacore.com>
+
+ * prj-nmsc.adb (Get_Mains): Warn if a main is an empty string
+
+2009-04-07 Thomas Quinot <quinot@adacore.com>
+
+ * usage.adb: Minor fix in usage message.
+
+ * sem_ch10.adb (Remove_Homonyms): Fix subtype of formal in body to
+ match declaration; the correct subtype is Node_Id, not Entity_Id,
+ because the expected node kind is an identifier, not a defining
+ identifier.
+
+ * switch-c.adb: Minor reformatting.
+
+ * uintp.adb: Minor reformatting.
+
+2009-04-07 Robert Dewar <dewar@adacore.com>
+
+ * exp_ch13.adb: Minor reformatting
+
2009-04-07 Robert Dewar <dewar@adacore.com>
* sem_warn.adb (Check_Infinite_Loop_Warning.Test_Ref): Add defence
diff --git a/gcc/ada/exp_ch13.adb b/gcc/ada/exp_ch13.adb
index ebfd212..7d903eb 100644
--- a/gcc/ada/exp_ch13.adb
+++ b/gcc/ada/exp_ch13.adb
@@ -103,6 +103,7 @@ package body Exp_Ch13 is
declare
Decl : constant Node_Id := Declaration_Node (Ent);
Typ : constant Entity_Id := Etype (Ent);
+
begin
if Nkind (Decl) = N_Object_Declaration
and then Present (Expression (Decl))
diff --git a/gcc/ada/exp_ch4.adb b/gcc/ada/exp_ch4.adb
index df1d2bb..771efd4 100644
--- a/gcc/ada/exp_ch4.adb
+++ b/gcc/ada/exp_ch4.adb
@@ -2383,24 +2383,15 @@ package body Exp_Ch4 is
Fixed_Length (NN) := Uint_1;
Result_May_Be_Null := False;
- -- Set bounds of operand
+ -- Set bounds of operand (no need to set high bound since we know
+ -- for sure that result won't be null, so we won't ever use
+ -- Opnd_High_Bound).
Opnd_Low_Bound (NN) :=
Make_Attribute_Reference (Loc,
Prefix => New_Reference_To (Ityp, Loc),
Attribute_Name => Name_First);
- -- ??? The addition below is dubious, what if Ityp is an enum
- -- type, shouldn't this be Ityp'Succ (Ityp'First)?
-
- Opnd_High_Bound (NN) :=
- Make_Op_Add (Loc,
- Left_Opnd =>
- Make_Attribute_Reference (Loc,
- Prefix => New_Reference_To (Ityp, Loc),
- Attribute_Name => Name_First),
- Right_Opnd => Make_Integer_Literal (Loc, 1));
-
Set := True;
-- String literal case (can only occur for strings of course)
@@ -2477,15 +2468,13 @@ package body Exp_Ch4 is
Is_Fixed_Length (NN) := True;
Fixed_Length (NN) := Len;
- -- ??? case where Ityp is an enum type?
-
- Opnd_Low_Bound (NN) :=
+ Opnd_Low_Bound (NN) := To_Ityp (
Make_Integer_Literal (Loc,
- Intval => Expr_Value (Lo));
+ Intval => Expr_Value (Lo)));
- Opnd_High_Bound (NN) :=
+ Opnd_High_Bound (NN) := To_Ityp (
Make_Integer_Literal (Loc,
- Intval => Expr_Value (Hi));
+ Intval => Expr_Value (Hi)));
Set := True;
end;
diff --git a/gcc/ada/prj-nmsc.adb b/gcc/ada/prj-nmsc.adb
index db6a70c..e447860 100644
--- a/gcc/ada/prj-nmsc.adb
+++ b/gcc/ada/prj-nmsc.adb
@@ -6412,6 +6412,8 @@ package body Prj.Nmsc is
is
Mains : constant Variable_Value :=
Prj.Util.Value_Of (Name_Main, Data.Decl.Attributes, In_Tree);
+ List : String_List_Id;
+ Elem : String_Element;
begin
Data.Mains := Mains.Values;
@@ -6432,6 +6434,24 @@ package body Prj.Nmsc is
(Project, In_Tree,
"a library project file cannot have Main specified",
Mains.Location);
+
+ -- Normal case where Main was specified
+
+ else
+ List := Mains.Values;
+ while List /= Nil_String loop
+ Elem := In_Tree.String_Elements.Table (List);
+
+ if Length_Of_Name (Elem.Value) = 0 then
+ Error_Msg
+ (Project, In_Tree,
+ "?a main cannot have an empty name",
+ Elem.Location);
+ exit;
+ end if;
+
+ List := Elem.Next;
+ end loop;
end if;
end Get_Mains;
diff --git a/gcc/ada/sem_ch10.adb b/gcc/ada/sem_ch10.adb
index a135cd9..9e20de1 100644
--- a/gcc/ada/sem_ch10.adb
+++ b/gcc/ada/sem_ch10.adb
@@ -3924,11 +3924,12 @@ package body Sem_Ch10 is
procedure Check_Pragma_Import (P : Node_Id);
-- If a pragma import applies to a previous subprogram, the
- -- enclosing unit may not need a body. The processing is
- -- syntactic and does not require a declaration to be analyzed,
- -- The code below also handles pragma import when applied to
- -- a subprogram that renames another. In this case the pragma
- -- applies to the renamed entity
+ -- enclosing unit may not need a body. The processing is syntactic
+ -- and does not require a declaration to be analyzed. The code
+ -- below also handles pragma Import when applied to a subprogram
+ -- that renames another. In this case the pragma applies to the
+ -- renamed entity.
+ --
-- Chains of multiple renames are not handled by the code below.
-- It is probably impossible to handle all cases without proper
-- name resolution. In such cases the algorithm is conservative
@@ -3945,20 +3946,19 @@ package body Sem_Ch10 is
Imported : Node_Id;
procedure Remove_Homonyms (E : Node_Id);
- -- Make one pass over list of subprograms, Called again if
+ -- Make one pass over list of subprograms. Called again if
-- subprogram is a renaming. E is known to be an identifier.
---------------------
-- Remove_Homonyms --
---------------------
- procedure Remove_Homonyms (E : Entity_Id) is
+ procedure Remove_Homonyms (E : Node_Id) is
R : Entity_Id := Empty;
- -- Name of renamed entity, if any.
+ -- Name of renamed entity, if any
begin
Subp_Id := First_Elmt (Subp_List);
-
while Present (Subp_Id) loop
if Chars (Node (Subp_Id)) = Chars (E) then
if Nkind (Parent (Parent (Node (Subp_Id))))
@@ -3983,18 +3983,17 @@ package body Sem_Ch10 is
elsif Nkind (R) = N_Selected_Component then
Remove_Homonyms (Selector_Name (R));
- else
- -- renaming of attribute
+ -- Renaming of attribute
+ else
null;
end if;
end if;
end Remove_Homonyms;
- -- Start of processing for Check_Pragma_Import
+ -- Start of processing for Check_Pragma_Import
begin
-
-- Find name of entity in Import pragma. We have not analyzed
-- the construct, so we must guard against syntax errors.
@@ -4011,6 +4010,8 @@ package body Sem_Ch10 is
Remove_Homonyms (Imported);
end Check_Pragma_Import;
+ -- Start of processing for Check_Declarations
+
begin
-- Search for Elaborate Body pragma
diff --git a/gcc/ada/sem_ch6.adb b/gcc/ada/sem_ch6.adb
index e8ffbaa..79d45c9 100644
--- a/gcc/ada/sem_ch6.adb
+++ b/gcc/ada/sem_ch6.adb
@@ -3466,13 +3466,24 @@ package body Sem_Ch6 is
Old_Formal := First_Formal (Old_Id);
New_Formal := First_Formal (New_Id);
-
while Present (Old_Formal) and then Present (New_Formal) loop
if Is_Controlling_Formal (Old_Formal)
and then Is_Controlling_Formal (New_Formal)
and then Skip_Controlling_Formals
then
- goto Skip_Controlling_Formal;
+ -- The controlling formals will have different types when
+ -- comparing an interface operation with its match, but both
+ -- or neither must be access parameters.
+
+ if Is_Access_Type (Etype (Old_Formal))
+ =
+ Is_Access_Type (Etype (New_Formal))
+ then
+ goto Skip_Controlling_Formal;
+ else
+ Conformance_Error
+ ("\access parameter does not match!", New_Formal);
+ end if;
end if;
if Ctype = Fully_Conformant then
diff --git a/gcc/ada/sem_ch8.adb b/gcc/ada/sem_ch8.adb
index 1930c79..88741a4 100644
--- a/gcc/ada/sem_ch8.adb
+++ b/gcc/ada/sem_ch8.adb
@@ -53,6 +53,7 @@ with Sem_Ch6; use Sem_Ch6;
with Sem_Ch12; use Sem_Ch12;
with Sem_Disp; use Sem_Disp;
with Sem_Dist; use Sem_Dist;
+with Sem_Eval; use Sem_Eval;
with Sem_Res; use Sem_Res;
with Sem_Util; use Sem_Util;
with Sem_Type; use Sem_Type;
@@ -778,7 +779,7 @@ package body Sem_Ch8 is
if not Is_Overloaded (Nam) then
if Ekind (Etype (Nam)) /= Ekind (T) then
Error_Msg_N
- ("Expect anonymous access type is object renaming", N);
+ ("expect anonymous access type in object renaming", N);
end if;
else
declare
@@ -818,6 +819,23 @@ package body Sem_Ch8 is
then
Error_Msg_N ("(Ada 2005): the renamed object is not "
& "access-to-constant (RM 8.5.1(6))", N);
+
+ elsif not Constant_Present (Access_Definition (N))
+ and then Is_Access_Constant (Etype (Nam))
+ then
+ Error_Msg_N ("(Ada 2005): the renamed object is not "
+ & "access-to-variable (RM 8.5.1(6))", N);
+ end if;
+
+ if Is_Access_Subprogram_Type (Etype (Nam)) then
+ Check_Subtype_Conformant
+ (Designated_Type (T), Designated_Type (Etype (Nam)));
+
+ elsif not Subtypes_Statically_Match
+ (Designated_Type (T), Designated_Type (Etype (Nam)))
+ then
+ Error_Msg_N
+ ("subtype of renamed object does not statically match", N);
end if;
end if;
diff --git a/gcc/ada/switch-c.adb b/gcc/ada/switch-c.adb
index 937a3a8..ddd4859 100644
--- a/gcc/ada/switch-c.adb
+++ b/gcc/ada/switch-c.adb
@@ -278,7 +278,7 @@ package body Switch.C is
when 'D' =>
Ptr := Ptr + 1;
- -- Scan option integer line limit value
+ -- Scan optional integer line limit value
if Ptr <= Max and then Switch_Chars (Ptr) in '0' .. '9' then
Scan_Nat (Switch_Chars, Max, Ptr, Sprint_Line_Limit, 'D');
@@ -528,7 +528,7 @@ package body Switch.C is
Ptr := Ptr + 1;
Print_Generated_Code := True;
- -- Scan option integer line limit value
+ -- Scan optional integer line limit value
if Ptr <= Max and then Switch_Chars (Ptr) in '0' .. '9' then
Scan_Nat (Switch_Chars, Max, Ptr, Sprint_Line_Limit, 'G');
diff --git a/gcc/ada/uintp.adb b/gcc/ada/uintp.adb
index b1f0599..1bb0393 100644
--- a/gcc/ada/uintp.adb
+++ b/gcc/ada/uintp.adb
@@ -131,7 +131,7 @@ package body Uintp is
-- This procedure puts the value of UI into the vector in canonical
-- multiple precision format. The parameter should be of the correct size
-- as determined by a previous call to N_Digits (UI). The first digit of
- -- Vec contains the sign, all other digits are always non- negative. Note
+ -- Vec contains the sign, all other digits are always non-negative. Note
-- that the input may be directly represented, and in this case Vec will
-- contain the corresponding one or two digit value. The low bound of Vec
-- is always 1.
diff --git a/gcc/ada/usage.adb b/gcc/ada/usage.adb
index de3d579..3d14ce3 100644
--- a/gcc/ada/usage.adb
+++ b/gcc/ada/usage.adb
@@ -157,7 +157,7 @@ begin
Write_Switch_Char ("D");
Write_Line ("Debug expanded generated code (max line length = 72)");
Write_Switch_Char ("Dnn");
- Write_Line ("Debug expanded generated code (max line length = nnn)");
+ Write_Line ("Debug expanded generated code (max line length = nn)");
-- Line for -gnatec switch