SWDEV-341955 - Windows hipcc perl to handle quoted args (#2746)
example - hipcc.pl -DGREETING=\"Hello\" hello.cpp Change-Id: Ib7192d46226563a44c87f3fbe2c22ef2ab84ac3e
This commit is contained in:
committed by
GitHub
parent
1342f1c2fd
commit
4900ce120e
@@ -22,7 +22,6 @@
|
||||
# Need perl > 5.10 to use logic-defined or
|
||||
use 5.006; use v5.10.1;
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
use File::Basename;
|
||||
@@ -30,6 +29,13 @@ use File::Spec::Functions 'catfile';
|
||||
|
||||
# TODO: By default select perl script until change incorporated in HIP build script.
|
||||
my $HIPCC_USE_PERL_SCRIPT = 1;
|
||||
my $isWindows = ($^O eq 'MSWin32' or $^O eq 'msys');
|
||||
# escapes args with quotes SWDEV-341955
|
||||
foreach $arg (@ARGV) {
|
||||
if ($isWindows) {
|
||||
$arg =~ s/[^-a-zA-Z0-9_=+,.:\/\\]/\\$&/g;
|
||||
}
|
||||
}
|
||||
|
||||
my $SCRIPT_DIR=dirname(__FILE__);
|
||||
if ($HIPCC_USE_PERL_SCRIPT) {
|
||||
|
||||
+4
-1
@@ -595,9 +595,12 @@ foreach $arg (@ARGV)
|
||||
# common characters such as alphanumerics.
|
||||
# Do the quoting here because sometimes the $arg is changed in the loop
|
||||
# Important to have all of '-Xlinker' in the set of unquoted characters.
|
||||
if (not $isWindows and $escapeArg) { # Windows needs different quoting, ignore for now
|
||||
if (not $isWindows and $escapeArg) {
|
||||
$arg =~ s/[^-a-zA-Z0-9_=+,.\/]/\\$&/g;
|
||||
}
|
||||
if ($isWindows and $escapeArg) {
|
||||
$arg =~ s/[^-a-zA-Z0-9_=+,.:\/\\]/\\$&/g;
|
||||
}
|
||||
$toolArgs .= " $arg" unless $swallowArg;
|
||||
$prevArg = $arg;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user