diff options
author | Viljar Indus <indus@adacore.com> | 2024-05-06 15:17:27 +0300 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-06-20 10:50:49 +0200 |
commit | d1c07598fad36218809907312f5c3d247b0413aa (patch) | |
tree | b1309fc0b8dc44ca92d5c0cddb78f1e8c7733153 /gcc/ada/errutil.adb | |
parent | 6e5f911e779e7571ce8c6f082f8aafaa2d5eca23 (diff) | |
download | gcc-d1c07598fad36218809907312f5c3d247b0413aa.zip gcc-d1c07598fad36218809907312f5c3d247b0413aa.tar.gz gcc-d1c07598fad36218809907312f5c3d247b0413aa.tar.bz2 |
ada: Treat Info-Warnings as Info messages
There was a general concept of info messages being a subset of
warnings. However that is no longer the case. Messages with an
info insertion character should be treated just as info messages.
gcc/ada/
* atree.ads: Remove Warning_Info_Messages.
* errout.adb: Remove various places where Warning_Info_Messages
was used.
* erroutc.adb: Remove various places where Warning_Info_Messages
was used. Create Error_Msg_Object objects with only an info
attribute if the message contained both info and warning insertion
characters. New method Has_Switch_Tag for detecting if a message
should have an error tag.
* errutil.adb: Create Error_Msg_Object objects with only an info
attribute if the message contained both info and warning insertion
characters.
Diffstat (limited to 'gcc/ada/errutil.adb')
-rw-r--r-- | gcc/ada/errutil.adb | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/gcc/ada/errutil.adb b/gcc/ada/errutil.adb index 4f5aa21..6747fe5 100644 --- a/gcc/ada/errutil.adb +++ b/gcc/ada/errutil.adb @@ -199,6 +199,11 @@ package body Errutil is return; end if; + -- Warning, Style and Info attributes are mutually exclusive + + pragma Assert (Boolean'Pos (Is_Warning_Msg) + Boolean'Pos (Is_Info_Msg) + + Boolean'Pos (Is_Style_Msg) <= 1); + -- Otherwise build error message object for new message Errors.Append @@ -308,15 +313,7 @@ package body Errutil is -- Bump appropriate statistics counts if Errors.Table (Cur_Msg).Info then - - -- Could be (usually is) both "info" and "warning" - - if Errors.Table (Cur_Msg).Warn then - Warning_Info_Messages := Warning_Info_Messages + 1; - Warnings_Detected := Warnings_Detected + 1; - else - Report_Info_Messages := Report_Info_Messages + 1; - end if; + Info_Messages := Info_Messages + 1; elsif Errors.Table (Cur_Msg).Warn or else Errors.Table (Cur_Msg).Style @@ -553,19 +550,19 @@ package body Errutil is Write_Str (" errors"); end if; - if Warnings_Detected - Warning_Info_Messages /= 0 then + if Warnings_Detected /= 0 then Write_Str (", "); - Write_Int (Warnings_Detected - Warning_Info_Messages); + Write_Int (Warnings_Detected); Write_Str (" warning"); - if Warnings_Detected - Warning_Info_Messages /= 1 then + if Warnings_Detected /= 1 then Write_Char ('s'); end if; if Warning_Mode = Treat_As_Error then Write_Str (" (treated as error"); - if Warnings_Detected - Warning_Info_Messages /= 1 then + if Warnings_Detected /= 1 then Write_Char ('s'); end if; @@ -595,9 +592,8 @@ package body Errutil is -- must not be treated as errors when -gnatwe is in effect. if Warning_Mode = Treat_As_Error then - Total_Errors_Detected := - Total_Errors_Detected + Warnings_Detected - Warning_Info_Messages; - Warnings_Detected := Warning_Info_Messages; + Total_Errors_Detected := Total_Errors_Detected + Warnings_Detected; + Warnings_Detected := 0; end if; -- Prevent displaying the same messages again in the future @@ -617,8 +613,7 @@ package body Errutil is Serious_Errors_Detected := 0; Total_Errors_Detected := 0; Warnings_Detected := 0; - Warning_Info_Messages := 0; - Report_Info_Messages := 0; + Info_Messages := 0; Cur_Msg := No_Error_Msg; -- Initialize warnings table, if all warnings are suppressed, supply |