]> ruderich.org/simon Gitweb - blhc/blhc.git/blobdiff - bin/blhc
Ignore compiler lines with no files with extensions.
[blhc/blhc.git] / bin / blhc
index b4d87e45eb9dc856e574906e4958afc04f4317d5..4a1c0b1a5b992f089932136e21fee6d8711b81b4 100755 (executable)
--- a/bin/blhc
+++ b/bin/blhc
@@ -144,7 +144,7 @@ my $file_extension_regex = qr/
     \s
     \S+         # Filename without extension.
     \.
-    ([^\\.\s]+) # File extension.
+    ([^\\.,;:\s]+) # File extension.
     (?=\s|\\)   # At end of word. Can't use \b because some files have non
                 # word characters at the end and because \b matches double
                 # extensions (like .cpp.o). Works always as all lines are
@@ -572,23 +572,21 @@ FILE: foreach my $file (@ARGV) {
                 }
 
                 # Ignore lines with no compiler commands.
-                next if $line !~ /\b$cc_regex(?:\s|\\)/o and not $non_verbose;
+                next if not $non_verbose
+                        and not $line =~ /\b$cc_regex(?:\s|\\)/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 commands which are detected.
+                next if not $non_verbose
+                        and not $line =~ /$file_extension_regex/o;
 
                 # Ignore false positives.
                 #
                 # `./configure` output.
                 next if not $non_verbose
                         and $line =~ /^(?:checking|(?:C|c)onfigure:) /;
-                next if $line =~ /^\s*(?:Host\s+)?(?:C\s+)?
-                                   (?:C|c)ompiler[\s.]*:?\s+
-                                   $cc_regex_full
-                                   (?:\s-std=[a-z0-9:+]+)?\s*$
-                                 /xo
-                        or $line =~ /^\s*(?:- )?(?:HOST_)?(?:CC|CXX)\s*=\s*$cc_regex_full\s*$/o
-                        or $line =~ /^\s*-- Check for working (?:C|CXX) compiler: /
-                        or $line =~ /^\s*(?:echo )?Using [A-Z_]+\s*=\s*/;
-                # `make` output.
-                next if $line =~ /^Making [a-z]+ in \S+/; # e.g. "[...] in c++"
+                next if $line =~ /^\s*(?:- )?(?:HOST_)?(?:CC|CXX)\s*=\s*$cc_regex_full\s*$/o;
 
                 # Check if additional hardening options were used. Used to
                 # ensure they are used for the complete build.