OSDN Git Service

2005-03-29 Robert Dewar <dewar@adacore.com>
[pf3gnuchains/gcc-fork.git] / gcc / ada / sem_ch11.adb
index 6ce5a30..afd72c1 100644 (file)
@@ -6,7 +6,7 @@
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---          Copyright (C) 1992-2003 Free Software Foundation, Inc.          --
+--          Copyright (C) 1992-2005 Free Software Foundation, Inc.          --
 --                                                                          --
 -- GNAT is free software;  you can  redistribute it  and/or modify it under --
 -- terms of the  GNU General Public License as published  by the Free Soft- --
@@ -34,6 +34,7 @@ with Nlists;   use Nlists;
 with Nmake;    use Nmake;
 with Opt;      use Opt;
 with Restrict; use Restrict;
+with Rident;   use Rident;
 with Rtsfind;  use Rtsfind;
 with Sem;      use Sem;
 with Sem_Ch5;  use Sem_Ch5;
@@ -98,7 +99,6 @@ package body Sem_Ch11 is
          Handler := First_Non_Pragma (L);
          while Present (Handler) loop
             Id1 := First (Exception_Choices (Handler));
-
             while Present (Id1) loop
 
                --  Only check against the exception choices which precede
@@ -119,7 +119,9 @@ package body Sem_Ch11 is
                        ("exception choice duplicates &#", Id, Id1);
 
                   else
-                     if Ada_83 and then Comes_From_Source (Id) then
+                     if Ada_Version = Ada_83
+                       and then Comes_From_Source (Id)
+                     then
                         Error_Msg_N
                           ("(Ada 83): duplicate exception choice&", Id);
                      end if;
@@ -238,14 +240,16 @@ package body Sem_Ch11 is
 
                   else
                      if Present (Renamed_Entity (Entity (Id))) then
-                        if Entity (Id) = Standard_Numeric_Error
-                          and then Warn_On_Obsolescent_Feature
-                        then
-                           Error_Msg_N
-                             ("Numeric_Error is an " &
-                              "obsolescent feature ('R'M 'J.6(1))?", Id);
-                           Error_Msg_N
-                             ("|use Constraint_Error instead?", Id);
+                        if Entity (Id) = Standard_Numeric_Error then
+                           Check_Restriction (No_Obsolescent_Features, Id);
+
+                           if Warn_On_Obsolescent_Feature then
+                              Error_Msg_N
+                                ("Numeric_Error is an " &
+                                 "obsolescent feature ('R'M 'J.6(1))?", Id);
+                              Error_Msg_N
+                                ("\use Constraint_Error instead?", Id);
+                           end if;
                         end if;
                      end if;
 
@@ -359,7 +363,7 @@ package body Sem_Ch11 is
 
    procedure Analyze_Raise_Statement (N : Node_Id) is
       Exception_Id   : constant Node_Id := Name (N);
-      Exception_Name : Entity_Id := Empty;
+      Exception_Name : Entity_Id        := Empty;
       P              : Node_Id;
       Nkind_P        : Node_Kind;
 
@@ -397,7 +401,7 @@ package body Sem_Ch11 is
                     ("?assignment to pass-by-copy formal may have no effect",
                       P);
                   Error_Msg_N
-                    ("\?RAISE statement is abnormal return" &
+                    ("\?RAISE statement may result in abnormal return" &
                      " ('R'M 6.4.1(17))", P);
                end if;
             end if;
@@ -441,6 +445,10 @@ package body Sem_Ch11 is
             Error_Msg_N
               ("exception name expected in raise statement", Exception_Id);
          end if;
+
+         if Present (Expression (N)) then
+            Analyze_And_Resolve (Expression (N), Standard_String);
+         end if;
       end if;
    end Analyze_Raise_Statement;
 
@@ -477,7 +485,6 @@ package body Sem_Ch11 is
             Rewrite (N, Make_Null_Statement (Sloc (N)));
          end if;
       end if;
-
    end Analyze_Raise_xxx_Error;
 
    -----------------------------