# New Ticket Created by  Ron Blaschke 
# Please include the string:  [perl #41141]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=41141 >


Problem: F<tools/dev/cc_flags.pl> prints the input file name before
compilation.  Visual C++ does this too, yielding output like this.

    ...
    src\exec.c
    exec.c
    src\exec_cpu.c
    exec_cpu.c
    src\exec_save.c
    exec_save.c
    ...


Possible Solution: Check if the compiler is Visual C++ and print only
the path to the directory if so.  The new output looks like this.

    ...
    src\exec.c
    src\exec_cpu.c
    src\exec_save.c
    ...

Note that the directory path C<src\> is printed by the script, the file
name by the VC compiler.


Changes Files:
    tools/dev/cc_flags.pl

Ron
Index: tools/dev/cc_flags.pl
===================================================================
--- tools/dev/cc_flags.pl       (revision 16271)
+++ tools/dev/cc_flags.pl       (working copy)
@@ -112,7 +112,17 @@
     }
 
     # print "@ARGV\n";
-    print "$cfile\n";
+    
+    # Visual C++ already prints the source file name...
+    if ($ARGV[0] =~ /cl(?:\.exe)?/i) {
+        # ...but only the file name, so we print the path 
+        # to the directory first
+        if ($cfile =~ /(.*[\/\\])/) {
+            print $1;
+        }
+    } else {
+        print "$cfile\n";
+    }
 }
 exit system(@ARGV) / 256;
 

Reply via email to