]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
ada: Remove Warn_Runtime_Raise attribute from Error_Msg_Object
authorViljar Indus <indus@adacore.com>
Mon, 11 Nov 2024 09:01:12 +0000 (11:01 +0200)
committerMarc Poulhiès <dkm@gcc.gnu.org>
Tue, 26 Nov 2024 09:49:35 +0000 (10:49 +0100)
The goal of this attribute is to raise a warning to an error when
the -gnatwE flag is used. This is similar to the existing warnings
as error behavior under the Warn_Err flag so it can be merged.

gcc/ada/ChangeLog:

* errout.adb: Set Warn_Err as true if Is_Runtime_Error was
set in the error message.
* erroutc.adb: Remove instances of Warn_Runtime_Raise.
* erroutc.ads: Likewise.
* errutil.adb: Likewise.

gcc/ada/errout.adb
gcc/ada/erroutc.adb
gcc/ada/erroutc.ads
gcc/ada/errutil.adb

index 644fd1fad37d5c7297ae7473a3201257c71ea702..8858df1173742a48898e757c76a932fddfa7fd9c 100644 (file)
@@ -1246,7 +1246,6 @@ package body Errout is
           Compile_Time_Pragma => Is_Compile_Time_Msg,
           Warn_Err            => False, -- reset below
           Warn_Chr            => Warning_Msg_Char,
-          Warn_Runtime_Raise  => Is_Runtime_Raise,
           Uncond              => Is_Unconditional_Msg,
           Msg_Cont            => Continuation,
           Deleted             => False,
@@ -1258,20 +1257,14 @@ package body Errout is
       Warn_Err :=
         Error_Msg_Kind in Warning | Style
         and then (Warning_Treated_As_Error (Msg_Buffer (1 .. Msglen))
-                  or else Warning_Treated_As_Error
-                            (Get_Warning_Tag (Cur_Msg)));
+                  or else Warning_Treated_As_Error (Get_Warning_Tag (Cur_Msg))
+                  or else Is_Runtime_Raise);
 
       --  Propagate Warn_Err to this message and preceding continuations.
-      --  Likewise, propagate Error_Msg_Kind and Is_Runtime_Raise, because the
-      --  current continued message could have been escalated from warning to
-      --  error.
 
       for J in reverse 1 .. Errors.Last loop
          Errors.Table (J).Warn_Err := Warn_Err;
 
-         Errors.Table (J).Kind := Error_Msg_Kind;
-         Errors.Table (J).Warn_Runtime_Raise := Is_Runtime_Raise;
-
          exit when not Errors.Table (J).Msg_Cont;
       end loop;
 
@@ -3587,28 +3580,13 @@ package body Errout is
                --  not remove style messages here. They are warning messages
                --  but not ones we want removed in this context.
 
-               and then (Errors.Table (E).Kind = Warning
-                           or else
-                         Errors.Table (E).Warn_Runtime_Raise)
+               and then Errors.Table (E).Kind = Warning
 
                --  Don't remove unconditional messages
 
                and then not Errors.Table (E).Uncond
             then
-               if Errors.Table (E).Kind = Warning then
-                  Warnings_Detected := Warnings_Detected - 1;
-               end if;
-
-               --  When warning about a runtime exception has been escalated
-               --  into error, the starting message has increased the total
-               --  errors counter, so here we decrease this counter.
-
-               if Errors.Table (E).Warn_Runtime_Raise
-                 and then not Errors.Table (E).Msg_Cont
-                 and then Warning_Mode = Treat_Run_Time_Warnings_As_Errors
-               then
-                  Total_Errors_Detected := Total_Errors_Detected - 1;
-               end if;
+               Warnings_Detected := Warnings_Detected - 1;
 
                return True;
 
@@ -4361,7 +4339,6 @@ package body Errout is
                   if Error_Msg_Kind = Warning
                     and then Warning_Mode = Treat_Run_Time_Warnings_As_Errors
                   then
-                     Error_Msg_Kind := Non_Serious_Error;
                      Is_Runtime_Raise := True;
                   end if;
 
index c57205418de768c29d04ab285853e4bc3db01d72..9d22996204c171af2b99f57c352adc804e22cffd 100644 (file)
@@ -340,7 +340,6 @@ package body Erroutc is
       w ("  Col                = ", Int (E.Col));
       w ("  Kind               = ", E.Kind'Img);
       w ("  Warn_Err           = ", E.Warn_Err);
-      w ("  Warn_Runtime_Raise = ", E.Warn_Runtime_Raise);
       w ("  Warn_Chr           = '" & E.Warn_Chr & ''');
       w ("  Uncond             = ", E.Uncond);
       w ("  Msg_Cont           = ", E.Msg_Cont);
index 9a70cfa6244411251204d373428376b50b7736de..76cd0205fa84d51120be35a6b4936a484788e2de 100644 (file)
@@ -228,10 +228,6 @@ package Erroutc is
       --  True if this is a warning message which is to be treated as an error
       --  as a result of a match with a Warning_As_Error pragma.
 
-      Warn_Runtime_Raise : Boolean;
-      --  True if this a warning about a constraint error that will be raised
-      --  at runtime.
-
       Warn_Chr : String (1 .. 2);
       --  See Warning_Msg_Char
 
index 62cd8679cf1fe11971b1e39d148ee2aa05d9a862..1094e8ac317934feba00a0151c0245b5bc2c2d53 100644 (file)
@@ -211,7 +211,6 @@ package body Errutil is
             Col                 => Get_Column_Number (Sptr),
             Compile_Time_Pragma => Is_Compile_Time_Msg,
             Warn_Err            => Warning_Mode = Treat_As_Error,
-            Warn_Runtime_Raise  => Is_Runtime_Raise,
             Warn_Chr            => Warning_Msg_Char,
             Uncond              => Is_Unconditional_Msg,
             Msg_Cont            => Continuation,