This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: [Ada] Fix for xnmake command line processing


On Wed, 10 Oct 2001, Florian Weimer wrote:

  The -s/-b switches of nmake do not work as documented.  For example,
  "xnmake -s ../xnmake.ads" causes the spec to be written to the file
  "xnmake.ads" (the default) and the body to "../xnmake.ads".

Funny, I just found this bug too, and fixed it in a slightly different
way, which correctly rejects combinations of the -s/-b switch as intended.
Also fixed another related issue, which is that the '/' character was
used as option character, making it impossible to specify absolute
paths on Unix-like systems. See attached patch, which I will aply.

  In addition, the comment at the beginning of the file contains a few
  CVS revision numbers, and if the revision numbers grow, xnmake has
  to be changed to output fewer spaces.  (Alternatively, the trailing
  spaces and the terminating "--" could be dropped entirely.)  This change
  should probably use Ada.Strings.Fixed, but I didn't want to introduce
  a dependency on another run-time library unit.

WRT the last part of your patch, I'd prefer to omit the trailing "--"
altogether for the revision line. This is the convention we have 
started to use a few years ago to prevent problems with changing lengths.

  -Geert

2001-10-10  Geert Bosch  <bosch@gnat.com>

        * xnmake.adb (XNmake): Fix handling of -s/-b options.  No longer 
        use '/' as switch character, allowing for absolute file names.

Index: xnmake.adb
===================================================================
RCS file: /cvs/gcc/gcc/gcc/ada/xnmake.adb,v
retrieving revision 1.1
diff -p -r1.1 xnmake.adb
*** xnmake.adb	2001/10/02 14:57:59	1.1
--- xnmake.adb	2001/10/10 14:36:08
*************** begin
*** 219,225 ****
           Arg : constant String := Argument (ArgN);
  
        begin
!          if Arg (1) = '/' or else Arg (1) = '-' then
              if Arg'Length = 2
                and then (Arg (2) = 'b' or else Arg (2) = 'B')
              then
--- 219,225 ----
           Arg : constant String := Argument (ArgN);
  
        begin
!          if Arg (1) = '-' then
              if Arg'Length = 2
                and then (Arg (2) = 'b' or else Arg (2) = 'B')
              then
*************** begin
*** 248,257 ****
        raise Err;
  
     elsif Given_File /= Nul then
!       if FileS = Nul then
           FileS := Given_File;
  
!       elsif FileB = Nul then
           FileB := Given_File;
  
        else
--- 248,257 ----
        raise Err;
  
     elsif Given_File /= Nul then
!       if FileB = Nul then
           FileS := Given_File;
  
!       elsif FileS = Nul then
           FileB := Given_File;
  
        else


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]