Patchwork [Ada] Shorter display for shared library building

login
register
mail settings
Submitter Arnaud Charlet
Date June 22, 2010, 12:34 p.m.
Message ID <20100622123405.GA23035@adacore.com>
Download mbox | patch
Permalink /patch/56470/
State New
Headers show

Comments

Arnaud Charlet - June 22, 2010, 12:34 p.m.
When a shared library is built, in non verbose mode, the displays
of the command used are now truncated if they are deemed too long.

Tested on x86_64-pc-linux-gnu, committed on trunk

2010-06-22  Vincent Celier  <celier@adacore.com>

	* mlib-prj.adb (Display): In non verbose mode, truncate after fourth
	argument.
	* mlib-utl.adb (Gcc): In non verbose mode, truncate the display of the
	gcc command if it is too long.

Patch

Index: mlib-prj.adb
===================================================================
--- mlib-prj.adb	(revision 161073)
+++ mlib-prj.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                     Copyright (C) 2001-2009, AdaCore                     --
+--                     Copyright (C) 2001-2010, AdaCore                     --
 --                                                                          --
 -- 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- --
@@ -2285,6 +2285,11 @@  package body MLib.Prj is
          for Index in 1 .. Argument_Number loop
             Write_Char (' ');
             Write_Str (Arguments (Index).all);
+
+            if not Opt.Verbose_Mode and then Index > 4 then
+               Write_Str (" ...");
+               exit;
+            end if;
          end loop;
 
          Write_Eol;
Index: mlib-utl.adb
===================================================================
--- mlib-utl.adb	(revision 161073)
+++ mlib-utl.adb	(working copy)
@@ -6,7 +6,7 @@ 
 --                                                                          --
 --                                 B o d y                                  --
 --                                                                          --
---                     Copyright (C) 2002-2008, AdaCore                     --
+--                     Copyright (C) 2002-2010, AdaCore                     --
 --                                                                          --
 -- 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- --
@@ -460,11 +460,25 @@  package body MLib.Utl is
       end loop;
 
       if not Opt.Quiet_Output then
-         Write_Str (Driver.all);
+         if Opt.Verbose_Mode then
+            Write_Str (Driver.all);
+
+         elsif Driver_Name /= No_Name then
+            Write_Str (Get_Name_String (Driver_Name));
+
+         else
+            Write_Str (Gcc_Name.all);
+         end if;
 
          for J in 1 .. A loop
-            Write_Char (' ');
-            Write_Str  (Arguments (J).all);
+            if Opt.Verbose_Mode or else J < 4 then
+               Write_Char (' ');
+               Write_Str  (Arguments (J).all);
+
+            else
+               Write_Str (" ...");
+               exit;
+            end if;
          end loop;
 
          --  Do not display all the object files if not in verbose mode, only
@@ -480,10 +494,19 @@  package body MLib.Utl is
             elsif Position = Second then
                Write_Str (" ...");
                Position := Last;
+               exit;
             end if;
          end loop;
 
          for J in Options_2'Range loop
+            if not Opt.Verbose_Mode then
+               if Position = Second then
+                  Write_Str (" ...");
+               end if;
+
+               exit;
+            end if;
+
             Write_Char (' ');
             Write_Str (Options_2 (J).all);
          end loop;