(Write_Eol): Remove trailing spaces before writing the line
authorcharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Aug 2007 09:04:48 +0000 (09:04 +0000)
committercharlet <charlet@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 14 Aug 2007 09:04:48 +0000 (09:04 +0000)
(Write_Eol_Keep_Blanks): New procedure to write a line, including
possible trailing spaces.
(Output_Source_Line): Call Write_Eol_Keep_Blanks to output a source line
Fix problem with suppressing warning messages from back end
Improve handling of deleted warnings

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127474 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ada/errout.adb

index cfadbd8..6cb9c38 100644 (file)
@@ -873,8 +873,7 @@ package body Errout is
       Errors.Table (Cur_Msg).Warn     := Is_Warning_Msg;
       Errors.Table (Cur_Msg).Style    := Is_Style_Msg;
       Errors.Table (Cur_Msg).Serious  := Is_Serious_Error;
-      Errors.Table (Cur_Msg).Uncond   := Is_Unconditional_Msg
-                                           or Is_Warning_Msg;
+      Errors.Table (Cur_Msg).Uncond   := Is_Unconditional_Msg;
       Errors.Table (Cur_Msg).Msg_Cont := Continuation;
       Errors.Table (Cur_Msg).Deleted  := False;
 
@@ -971,9 +970,9 @@ package body Errout is
                          or
                        Errors.Table (Prev_Msg).Style)
                  or else
-                       (Errors.Table (Cur_Msg).Warn
+                      (Errors.Table (Cur_Msg).Warn
                          or
-                        Errors.Table (Cur_Msg).Style)
+                       Errors.Table (Cur_Msg).Style)
                then
                   --  All tests passed, delete the message by simply returning
                   --  without any further processing.
@@ -1178,7 +1177,7 @@ package body Errout is
    -- Finalize --
    --------------
 
-   procedure Finalize is
+   procedure Finalize (Last_Call : Boolean) is
       Cur : Error_Msg_Id;
       Nxt : Error_Msg_Id;
       F   : Error_Msg_Id;
@@ -1218,18 +1217,14 @@ package body Errout is
          Cur := Errors.Table (Cur).Next;
       end loop;
 
-      --  Remaining processing should only be done once in the case where
-      --  Finalize has been called more than once.
+      Finalize_Called := True;
 
-      if Finalize_Called then
-         return;
-      else
-         Finalize_Called := True;
-      end if;
-
-      --  Check consistency of specific warnings (may add warnings)
+      --  Check consistency of specific warnings (may add warnings). We only
+      --  do this on the last call, after all possible warnings are posted.
 
-      Validate_Specific_Warnings (Error_Msg'Access);
+      if Last_Call then
+         Validate_Specific_Warnings (Error_Msg'Access);
+      end if;
    end Finalize;
 
    ----------------
@@ -1879,8 +1874,11 @@ package body Errout is
          S := S + 1;
       end loop;
 
+      --  If we have output a source line, then add the line terminator, with
+      --  training spaces preserved (so we output the line exactly as input).
+
       if Line_Number_Output then
-         Write_Eol;
+         Write_Eol_Keep_Blanks;
       end if;
    end Output_Source_Line;
 
@@ -1893,8 +1891,7 @@ package body Errout is
       function Check_For_Warning (N : Node_Id) return Traverse_Result;
       --  This function checks one node for a possible warning message
 
-      function Check_All_Warnings is new
-        Traverse_Func (Check_For_Warning);
+      function Check_All_Warnings is new Traverse_Func (Check_For_Warning);
       --  This defines the traversal operation
 
       -----------------------
@@ -1916,11 +1913,26 @@ package body Errout is
          function To_Be_Removed (E : Error_Msg_Id) return Boolean is
          begin
             if E /= No_Error_Msg
-              and then Errors.Table (E).Optr = Loc
-              and then (Errors.Table (E).Warn or Errors.Table (E).Style)
+
+               --  Don't remove if location does not match
+
+               and then Errors.Table (E).Optr = Loc
+
+               --  Don't remove if not warning message. Note that we do not
+               --  remove style messages here. They are warning messages but
+               --  not ones we want removed in this context.
+
+               and then Errors.Table (E).Warn
+
+               --  Don't remove unconditional messages
+
+               and then not Errors.Table (E).Uncond
             then
                Warnings_Detected := Warnings_Detected - 1;
                return True;
+
+            --  No removal required
+
             else
                return False;
             end if;