Previously, an informational message that was not a warning was treated as an error. This patch changes that, so such an informational message is not an error. There are no such messages in the compiler, so no test is available. This patch is mainly for use by SPARK, which wants to have informational messages that are not warnings, but are not errors.
Tested on x86_64-pc-linux-gnu, committed on trunk 2016-04-27 Bob Duff <d...@adacore.com> * errout.ads: Document the fact that informational messages don't have to be warnings. * errout.adb (Error_Msg_Internal): In statistics counts, deal correctly with informational messages that are not warnings. (Error_Msg_NEL): Remove useless 'if' aroung Set_Posted, because Set_Posted already checks for errors and ignores others. * erroutc.adb (Prescan_Message): Set Is_Serious_Error to False if Is_Info_Msg; the previous code was assuming that Is_Info_Msg implies Is_Warning_Msg. * errutil.adb (Error_Msg): In statistics counts, deal correctly with informational messages that are not warnings.
Index: errout.adb =================================================================== --- errout.adb (revision 235481) +++ errout.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2016, 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- -- @@ -1153,15 +1153,22 @@ end if; end if; - -- Bump appropriate statistics count + -- Bump appropriate statistics counts - if Errors.Table (Cur_Msg).Warn or else Errors.Table (Cur_Msg).Style then - Warnings_Detected := Warnings_Detected + 1; + if Errors.Table (Cur_Msg).Info then + Info_Messages := Info_Messages + 1; - if Errors.Table (Cur_Msg).Info then - Info_Messages := Info_Messages + 1; + -- Could be (usually is) both "info" and "warning" + + if Errors.Table (Cur_Msg).Warn then + Warnings_Detected := Warnings_Detected + 1; end if; + elsif Errors.Table (Cur_Msg).Warn + or else Errors.Table (Cur_Msg).Style + then + Warnings_Detected := Warnings_Detected + 1; + elsif Errors.Table (Cur_Msg).Check then Check_Messages := Check_Messages + 1; @@ -1298,9 +1305,7 @@ Last_Killed := True; end if; - if not (Is_Warning_Msg or Is_Style_Msg) then - Set_Posted (N); - end if; + Set_Posted (N); end Error_Msg_NEL; ------------------ @@ -3077,7 +3082,6 @@ begin if Is_Serious_Error then - -- We always set Error_Posted on the node itself Set_Error_Posted (N); Index: errout.ads =================================================================== --- errout.ads (revision 235481) +++ errout.ads (working copy) @@ -6,7 +6,7 @@ -- -- -- S p e c -- -- -- --- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2016, 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- -- @@ -324,7 +324,7 @@ -- "[restriction warning]" at the end of the warning message. For -- continuations, use this on each continuation message. - -- Insertion character ?$? (elaboration information messages) + -- Insertion character ?$? (elaboration informational messages) -- Like ?, but if the flag Warn_Doc_Switch is True, adds the string -- "[-gnatel]" at the end of the info message. This is used for the -- messages generated by the switch -gnatel. For continuations, use @@ -419,12 +419,13 @@ -- message. Style messages are also considered to be warnings, but -- they do not get a tag. - -- Insertion sequence "info: " (information message) + -- Insertion sequence "info: " (informational message) -- This appears only at the start of the message (and not any of its -- continuations, if any), and indicates that the message is an info -- message. The message will be output with this prefix, and if there -- are continuations that are not printed using the -gnatj switch they - -- will also have this prefix. + -- will also have this prefix. Informational messages are usually also + -- warnings, but they don't have to be. -- Insertion sequence "low: " or "medium: " or "high: " (check message) -- This appears only at the start of the message (and not any of its Index: errutil.adb =================================================================== --- errutil.adb (revision 235481) +++ errutil.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1991-2014, Free Software Foundation, Inc. -- +-- Copyright (C) 1991-2016, 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- -- @@ -302,18 +302,23 @@ Errors.Table (Cur_Msg).Next := Next_Msg; - -- Bump appropriate statistics count + -- Bump appropriate statistics counts - if Errors.Table (Cur_Msg).Warn + if Errors.Table (Cur_Msg).Info then + Info_Messages := Info_Messages + 1; + + -- Could be (usually is) both "info" and "warning" + + if Errors.Table (Cur_Msg).Warn then + Warnings_Detected := Warnings_Detected + 1; + end if; + + elsif Errors.Table (Cur_Msg).Warn or else Errors.Table (Cur_Msg).Style then Warnings_Detected := Warnings_Detected + 1; - if Errors.Table (Cur_Msg).Info then - Info_Messages := Info_Messages + 1; - end if; - elsif Errors.Table (Cur_Msg).Check then Check_Messages := Check_Messages + 1; Index: erroutc.adb =================================================================== --- erroutc.adb (revision 235481) +++ erroutc.adb (working copy) @@ -6,7 +6,7 @@ -- -- -- B o d y -- -- -- --- Copyright (C) 1992-2015, Free Software Foundation, Inc. -- +-- Copyright (C) 1992-2016, 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- -- @@ -633,7 +633,7 @@ -- Deal with warning case - if Errors.Table (E).Warn then + if Errors.Table (E).Warn or else Errors.Table (E).Info then -- For info messages, prefix message with "info: " @@ -855,7 +855,7 @@ end if; end loop; - if Is_Warning_Msg or Is_Style_Msg or Is_Check_Msg then + if Is_Info_Msg or Is_Warning_Msg or Is_Style_Msg or Is_Check_Msg then Is_Serious_Error := False; end if; end Prescan_Message;