X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=bin%2Fblhc;h=e3c14b4cdcd668b6ad8b99f7641846a02c0876f7;hb=65d6d7541a860d1523fdcee94b81db2d7a59317c;hp=8606368f9f34e112582c4fe3a7a4ef02477b794d;hpb=32513c3cf648aab94fb011e488a79bb38c2fafd1;p=blhc%2Fblhc.git diff --git a/bin/blhc b/bin/blhc index 8606368..e3c14b4 100755 --- a/bin/blhc +++ b/bin/blhc @@ -24,7 +24,7 @@ use warnings; use Getopt::Long (); use Text::ParseWords (); -our $VERSION = '0.12'; +our $VERSION = '0.13'; # CONSTANTS/VARIABLES @@ -616,7 +616,7 @@ sub compile_flag_regexp { my @result = (); foreach my $flag (@flags) { # Compile flag regexp for faster execution. - my $regex = qr/\s$flag(?:\s|\\)/; + my $regex = qr/\s(['"]?)$flag\1(?:\s|\\)/; # Store flag name in replacement string for correct flags in messages # with qr//ed flag regexps. @@ -1022,9 +1022,29 @@ foreach my $file (@ARGV) { $complete_line = undef; } + my $noenv = $line; + # Strip (basic) environment variables for compiler detection. This + # prevents false positives when environment variables contain + # compiler binaries. Nested quotes, command substitution, etc. is + # not supported. + $noenv =~ s/^ + \s* + (?: + [a-zA-Z_]+ # environment variable name + = + (?: + [^\s"'\$`\\]+ # non-quoted string + | + '[^"'\$`\\]*' # single-quoted string + | + "[^"'\$`\\]*" # double-quoted string + ) + \s+ + )* + //x; # Ignore lines with no compiler commands. next if not $non_verbose - and not $line =~ /$cc_regex_normal/o; + and not $noenv =~ /$cc_regex_normal/o; # Ignore lines with no filenames with extensions. May miss some # non-verbose builds (e.g. "gcc -o test" [sic!]), but shouldn't be # a problem as the log will most likely contain other non-verbose