subscribe 446110 !
tag 446110 +patch
thanks
Hi,
my preferred usage of colorgcc is to have a bunch of symlinks
colorg++-x.y.z -> colorgcc
in the path and the compiler name mapping defined in .colorgccrc
(usually just colorg++-x.y.z: g++-x.y.z), no weird gcc -> colorgcc
symlinks that might break things, and then I just use CXX=colorg++-x.y.z
gccVersion does not help me since I need several different compiler
versions.
The attached patch fixes a few issues:
* only match '.*Color' as color attribute names
(fixes 'Invalid attribute name')
* treat any unknown option in the config file as a compiler name
(don't enable overrideCompilerPaths in this case)
* readd support for compilers with extra arguments
(got removed in patch 05)
With this applied locally, I'm now curious about trying the other
patches introduced in -5, mainly improved g++ handling.
Andreas
--- /usr/bin/colorgcc~dist 2007-10-09 22:53:10.000000000 +0200
+++ /usr/bin/colorgcc 2007-10-15 18:20:55.000000000 +0200
@@ -159,10 +159,15 @@
{
@{$translations{$1}} = split(/\s+/, $value);
}
- else
+ elsif ($option =~ m/Color$/)
{
$colors{$option} = color($value);
}
+ else
+ {
+ # treat unknown options as user defined compilers
+ $compilerPaths{$option} = $value;
+ }
}
close(PREFS);
@@ -218,6 +223,20 @@
$compiler = $compilerPaths{$progName} || $compilerPaths{"gcc"};
+# Check for unquoted program name with spaces. If there are spaces
+# and it's not quoted, assume that the spaces separate the program
+# name from some arguments to be prepended to ARGV.
+# If it is quoted, remove the quotes.
+if ($compiler =~ /^"(.*)"$/)
+{
+ $compiler = $1;
+}
+else
+{
+ ($compiler, @preargs) = split(/\s+/, $compiler);
+ @ARGV = (@preargs, @ARGV);
+}
+
# Check that we don't reference self
die "$compiler is self-referencing"
if ( -l $compiler and (stat $compiler)[1] == (stat $0)[1] );