Package: colorgcc Version: 1.3.2.0-6 Severity: wishlist Tags: patch Hi,
I attach a patch that adds support for colorizing warnings like <command-line>: warning: "FOOBAR" redefined <command-line>: warning: this is the location of the previous definition Andreas -- System Information: Debian Release: lenny/sid APT prefers testing APT policy: (500, 'testing'), (500, 'stable'), (300, 'unstable'), (130, 'experimental') Architecture: i386 (i686) Kernel: Linux 2.6.23-1-686 (SMP w/1 CPU core) Locale: LANG=C, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/bash Versions of packages colorgcc depends on: ii perl 5.8.8-12 Larry Wall's Practical Extraction ii perl-modules 5.8.8-12 Core Perl modules colorgcc recommends no packages. -- no debconf information
--- /usr/bin/colorgcc 2007-10-27 17:34:01.000000000 +0200 +++ /usr/local/bin/colorgcc 2008-01-15 00:21:52.000000000 +0100 @@ -281,6 +281,36 @@ } print("\n"); } + elsif (m/^(<command-line>):(.*)$/) # special-location:message + { + $field1 = $1 || ""; + $field2 = $2 || ""; + + # See if this is a warning message. + $is_warning = 0; + for $translation ("warning", @{$translations{"warning"}}) + { + if ($field2 =~ m/\s+$translation:.*/) + { + $is_warning = 1; + last; + } + } + + if ($is_warning) + { + # Warning + print($colors{"warningFileNameColor"}, "$field1:", color("reset")); + srcscan($field2, $colors{"warningMessageColor"}); + } + else + { + # Error + print($colors{"errorFileNameColor"}, "$field1:", color("reset")); + srcscan($field2, $colors{"errorMessageColor"}); + } + print("\n"); + } elsif (m/^(.*?):(.+):$/) # filename:message: { # No line number, treat as an "introductory" line of text.