[Ada] No trailing spaces in listings

Arnaud Charlet charlet@adacore.com
Thu Dec 13 13:38:00 GMT 2007


Tested on i686-linux, committed on trunk.

This is a small improvement/clean up: there is no more trailings spaces after
the line number in listings when the source line is empty.
The test for this is to compile with -gnatl a source with empty lines.
There should be no trailing space after the line number for these empty
lines.

2007-12-13  Vincent Celier  <celier@adacore.com>

	* errout.adb (Output_Source_Line): Do not keep a trailing space after
	the source line number if the source line is empty.

-------------- next part --------------
Index: errout.adb
===================================================================
--- errout.adb	(revision 130811)
+++ errout.adb	(working copy)
@@ -1783,6 +1783,9 @@ package body Errout is
       Line_Number_Output : Boolean := False;
       --  Set True once line number is output
 
+      Empty_Line : Boolean := True;
+      --  Set False if line includes at least one character
+
    begin
       if Sfile /= Current_Error_Source_File then
          Write_Str ("==============Error messages for ");
@@ -1870,6 +1873,7 @@ package body Errout is
             end if;
          end if;
 
+         Empty_Line := False;
          S := S + 1;
       end loop;
 
@@ -1877,7 +1881,11 @@ package body Errout is
       --  training spaces preserved (so we output the line exactly as input).
 
       if Line_Number_Output then
-         Write_Eol_Keep_Blanks;
+         if Empty_Line then
+            Write_Eol;
+         else
+            Write_Eol_Keep_Blanks;
+         end if;
       end if;
    end Output_Source_Line;
 


More information about the Gcc-patches mailing list