diff options
Diffstat (limited to 'gcc/ada/errout.adb')
-rw-r--r-- | gcc/ada/errout.adb | 63 |
1 files changed, 57 insertions, 6 deletions
diff --git a/gcc/ada/errout.adb b/gcc/ada/errout.adb index 6f450200ef9..052b43f8dab 100644 --- a/gcc/ada/errout.adb +++ b/gcc/ada/errout.adb @@ -821,9 +821,7 @@ package body Errout is -- with a comma space separator (eliminating a possible (style) or -- info prefix). - if Error_Msg_Line_Length /= 0 - and then Continuation - then + if Error_Msg_Line_Length /= 0 and then Continuation then Cur_Msg := Errors.Last; declare @@ -894,12 +892,24 @@ package body Errout is Msg_Buffer (M .. Msglen); Newl := Newl + Msglen - M + 1; Errors.Table (Cur_Msg).Text := new String'(Newm (1 .. Newl)); + + -- Update warning msg flag and message doc char if needed + + if Is_Warning_Msg then + if not Errors.Table (Cur_Msg).Warn then + Errors.Table (Cur_Msg).Warn := True; + Errors.Table (Cur_Msg).Warn_Chr := Warning_Msg_Char; + + elsif Warning_Msg_Char /= ' ' then + Errors.Table (Cur_Msg).Warn_Chr := Warning_Msg_Char; + end if; + end if; end; return; end if; - -- Otherwise build error message object for new message + -- Here we build a new error object Errors.Append ((Text => new String'(Msg_Buffer (1 .. Msglen)), @@ -911,6 +921,7 @@ package body Errout is Line => Get_Physical_Line_Number (Sptr), Col => Get_Column_Number (Sptr), Warn => Is_Warning_Msg, + Warn_Chr => Warning_Msg_Char, Style => Is_Style_Msg, Serious => Is_Serious_Error, Uncond => Is_Unconditional_Msg, @@ -2655,6 +2666,40 @@ package body Errout is C : Character; -- Current character P : Natural; -- Current index; + procedure Set_Msg_Insertion_Warning; + -- Deal with ? ?? ?x? ?X? insertion sequences + + ------------------------------- + -- Set_Msg_Insertion_Warning -- + ------------------------------- + + procedure Set_Msg_Insertion_Warning is + begin + Warning_Msg_Char := ' '; + + if P <= Text'Last and then Text (P) = '?' then + if Warning_Doc_Switch then + Warning_Msg_Char := '?'; + end if; + + P := P + 1; + + elsif P + 1 <= Text'Last + and then (Text (P) in 'a' .. 'z' + or else + Text (P) in 'A' .. 'Z') + and then Text (P + 1) = '?' + then + if Warning_Doc_Switch then + Warning_Msg_Char := Text (P); + end if; + + P := P + 2; + end if; + end Set_Msg_Insertion_Warning; + + -- Start of processing for Set_Msg_Text + begin Manual_Quote_Mode := False; Is_Unconditional_Msg := False; @@ -2725,10 +2770,16 @@ package body Errout is Is_Unconditional_Msg := True; when '?' => - null; -- already dealt with + Set_Msg_Insertion_Warning; when '<' => - null; -- already dealt with + + -- If tagging of messages is enabled, and this is a warning, + -- then it is treated as being [enabled by default]. + + if Error_Msg_Warn and Warning_Doc_Switch then + Warning_Msg_Char := '?'; + end if; when '|' => null; -- already dealt with |