]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR ada/14665 (gnatmake invokes wrong cross tools)
authorJoel Sherrill <joel@OARcorp.com>
Thu, 8 Apr 2004 17:30:32 +0000 (17:30 +0000)
committerJoel Sherrill <joel@gcc.gnu.org>
Thu, 8 Apr 2004 17:30:32 +0000 (17:30 +0000)
2004-04-08  Joel Sherrill  <joel@oarcorp.com>

PR ada/14665
* ada/osint.adb (Find_Program_Name): Rework to properly handle
filenames which end in .exe or have versioning suffixes like VMS.

From-SVN: r80514

gcc/ChangeLog
gcc/ada/osint.adb

index b0718ffcfcbcf84283485e553fbc90610ad5d54b..7639f5efac247dc5b83380cac8dce7359c1c3557 100644 (file)
@@ -1,3 +1,9 @@
+2004-04-08  Joel Sherrill  <joel@oarcorp.com>
+
+       PR ada/14665
+       * ada/osint.adb (Find_Program_Name): Rework to properly handle
+       filenames which end in .exe or have versioning suffixes like VMS.
+
 2004-04-08  Andrew Pinski  <pinskia@physics.uc.edu>
 
        PR target/10129
index e2e559fac7e33eadce1087a25cafca86163aef64..2dc5c3215092934337c29b2db484407da2349e93 100644 (file)
@@ -1008,12 +1008,37 @@ package body Osint is
          end if;
       end loop;
 
-      for J in reverse Cindex1 .. Cindex2 loop
-         if Command_Name (J) = '.' then
-            Cindex2 := J - 1;
-            exit;
+      --  Command_Name(Cindex1 .. Cindex2) is now the equivalent of the
+      --  POSIX command "basename argv[0]"
+
+      --  Strip off any versioning information such as found on VMS.
+      --  This would take the form of TOOL.exe followed by a ";" or "."
+      --  and a sequence of one or more numbers.
+
+      if Command_Name (Cindex2) in '0' .. '9' then
+         for J in reverse Cindex1 .. Cindex2 loop
+
+            exit when Command_Name (J) not in '0' .. '9';
+
+            if Command_Name (J) = '.' or Command_Name (J) = ';' then
+               Cindex2 := J - 1;
+               exit;
+            end if;
+         end loop;
+      end if;
+
+      --  Strip off any executable extension (usually nothing or .exe)
+      --  but formally reported by autoconf in the variable EXEEXT
+
+      if Cindex2 - Cindex1 >= 4 then
+         if To_Lower (Command_Name (Cindex2 - 3)) = '.'
+            and then To_Lower (Command_Name (Cindex2 - 2)) = 'e'
+            and then To_Lower (Command_Name (Cindex2 - 1)) = 'x'
+            and then To_Lower (Command_Name (Cindex2)) = 'e'
+         then
+            Cindex2 := Cindex2 - 4;
          end if;
-      end loop;
+      end if;
 
       Name_Len := Cindex2 - Cindex1 + 1;
       Name_Buffer (1 .. Name_Len) := Command_Name (Cindex1 .. Cindex2);