gcc2tasks.pl 613 Bytes
Newer Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl -w

=head1 NAME

msvc2tasks.pl - Convert GCC warnings into Qt Creator task files.

=head1 SYNOPSIS

    gcc2tasks.pl < logfile > taskfile

=cut

use strict;

while (my $line = <STDIN> ) {
    chomp($line);
    # --- extract file name based matching:
    # file.cpp:214:37: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
    if ($line =~ /^([^:]+):(\d+):\d*:? warning: (.*)$/) {
        my $fileName = $1;
        my $lineNumber = $2;
        my $text = $3;
        $fileName =~ s|\\|/|g;
        print $fileName, "\t", $lineNumber, "\twarn\t", $text,"\n";
    }
}