]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorArnaud Charlet <charlet@gcc.gnu.org>
Tue, 7 Apr 2009 16:56:30 +0000 (18:56 +0200)
committerArnaud Charlet <charlet@gcc.gnu.org>
Tue, 7 Apr 2009 16:56:30 +0000 (18:56 +0200)
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

gcc/ada/ChangeLog
gcc/ada/exp_ch13.adb
gcc/ada/exp_ch4.adb
gcc/ada/prj-nmsc.adb
gcc/ada/sem_ch10.adb
gcc/ada/sem_ch6.adb
gcc/ada/sem_ch8.adb
gcc/ada/switch-c.adb
gcc/ada/uintp.adb
gcc/ada/usage.adb

index 9211323337b733c5fd3d19ab1113b3e81b6296fc..ba8fd1feaf444b64acda9837ca1527e0856347a2 100644 (file)
@@ -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
index ebfd212f491abadc805cd843325e72c9c761ce54..7d903eb6fedff74a1da11db304ef599cd7488664 100644 (file)
@@ -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))
index df1d2bb26a9b30d1f4e55f8a62c85ebe2c6f8aeb..771efd49dd2d247b40325d780c33b17a16c4b02d 100644 (file)
@@ -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;
index db6a70cd7b019cc2700db2dcaf2e4024202a3674..e4478602f645733ad1f8866862fabcd5078dd1d6 100644 (file)
@@ -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;
 
index a135cd9f2cc0672cab88f8d132a5ff7f1f0502e7..9e20de16836dc53718ad8e8ab4aaead8fa4feee5 100644 (file)
@@ -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
 
index e8ffbaaff68867081bac98e3a0e06315d05c400a..79d45c974d7c99543af55ff72cf4ee75b547a6fa 100644 (file)
@@ -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
index 1930c7955c0bdd0ee943f6c252e2f122a9364b3b..88741a4fa6f46a1a44302d63df8299de90903db3 100644 (file)
@@ -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;
 
index 937a3a86b6fc1ee6e440641fb9a2ea2f2fced463..ddd4859c2e21f55e0c4fe4ae89063cb0c2a84026 100644 (file)
@@ -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');
index b1f0599360820d52a993b215a31e3a8a095699c9..1bb0393b9516a4a74dc76d8034228593a6d4260e 100644 (file)
@@ -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.
index de3d57931dd5121b530131852ecfbb864617eef5..3d14ce31435ce45e96016fa1207663cb2ce86b74 100644 (file)
@@ -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