X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=blobdiff_plain;f=bin%2Fblhc;h=89cde257f5a7e5c39619759578a06b6ee88d0280;hp=fa2c507fff10c679a94d277b3b95571bf7cebe31;hb=93afe23c678d5fdc749a07c94e7ee9ddb4d5e9bb;hpb=0261fdd4ff435c302e6e85bfb1954940e004c26b diff --git a/bin/blhc b/bin/blhc index fa2c507..89cde25 100755 --- a/bin/blhc +++ b/bin/blhc @@ -42,6 +42,10 @@ my $cc_regex_full = qr/ (?:[a-z0-9_]+-(?:linux-|kfreebsd-)?gnu(?:eabi|eabihf)?-)? $cc_regex /x; +# Regex to check if a line contains a compiler command. +my $cc_regex_normal = qr/ + \b$cc_regex(?:\s|\\) + /x; # Regex to catch (GCC) compiler warnings. my $warning_regex = qr/^(.+?):(\d+):\d+: warning: (.+?) \[(.+?)\]$/; @@ -769,7 +773,7 @@ foreach my $file (@ARGV) { # Ignore lines with no compiler commands. next if not $non_verbose - and not $line =~ /\b$cc_regex(?:\s|\\)/o; + and not $line =~ /$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 @@ -793,6 +797,14 @@ foreach my $file (@ARGV) { \s.+\s -I/usr/share/qt4/mkspecs/[a-z]+-g\++(?:-64)? \s}x; + # Ignore false positives when the line contains only CC=gcc but no + # other gcc command. + if ($line =~ /(.*)CC=$cc_regex_full(.*)/o) { + my $before = $1; + my $after = $2; + next if not $before =~ /$cc_regex_normal/o + and not $after =~ /$cc_regex_normal/o; + } # Check if additional hardening options were used. Used to ensure # they are used for the complete build.