]> ruderich.org/simon Gitweb - blhc/blhc.git/blobdiff - bin/blhc
fix false positive in "libtool: link: g++ -include test.h .."
[blhc/blhc.git] / bin / blhc
index 7d749028d8df82626aafac63242184f48307764c..0c2ba90e922ba4e6a4887f8d98cf7561825bbccf 100755 (executable)
--- a/bin/blhc
+++ b/bin/blhc
@@ -51,6 +51,7 @@ my $warning_regex = qr/^(.+?):(\d+):\d+: warning: (.+?) \[(.+?)\]$/;
 # Regex to catch libtool commands and not lines which show commands executed
 # by libtool (e.g. libtool: link: ...).
 my $libtool_regex = qr/\blibtool\s.*--mode=/;
+my $libtool_link_regex = qr/\blibtool: link: /;
 
 # List of source file extensions which require preprocessing.
 my @source_preprocess_compile_cpp = (
@@ -1101,6 +1102,8 @@ LINE:
         # is_non_verbose_build()).
         next if $skip;
 
+        my $orig_line = $line;
+
         # Remove everything until and including the compiler command. Makes
         # checks easier and faster.
         $line =~ s/^.*?$cc_regex//o;
@@ -1151,7 +1154,11 @@ LINE:
         }
         # These file types require preprocessing.
         if (extension_found(\%extensions_preprocess, @extensions)) {
-            $preprocess = 1;
+            # Prevent false positives with "libtool: link: g++ -include test.h
+            # .." compiler lines.
+            if ($orig_line !~ /$libtool_link_regex/o) {
+                $preprocess = 1;
+            }
         }
 
         if (not $flag_preprocess) {