]> ruderich.org/simon Gitweb - blhc/blhc.git/commitdiff
Don't recognize options which contain compiler names as compiler lines.
authorSimon Ruderich <simon@ruderich.org>
Wed, 11 Apr 2012 11:40:24 +0000 (13:40 +0200)
committerSimon Ruderich <simon@ruderich.org>
Wed, 11 Apr 2012 11:40:24 +0000 (13:40 +0200)
For example "-c++".

MANIFEST
bin/blhc
t/logs/false-positives [new file with mode: 0644]
t/tests.t

index 4df8ddba3d3bea462727469fe61b65e8cb682111..c714bdcf8f8cc4a7c011d4866655e95a2650574c 100644 (file)
--- a/MANIFEST
+++ b/MANIFEST
@@ -28,6 +28,7 @@ t/logs/debian-cmake-2
 t/logs/debian-cmake-ok
 t/logs/debian-hardening-wrapper
 t/logs/empty
+t/logs/false-positives
 t/logs/g++
 t/logs/gcc
 t/logs/good
index 4682d9b86f0d22c210653665ced35f11d893566e..1d35e0ba489008f5c2eee8bab499256e0445d2b3 100755 (executable)
--- a/bin/blhc
+++ b/bin/blhc
@@ -31,6 +31,7 @@ our $VERSION = '0.01';
 
 # Regex to catch compiler commands.
 my $cc_regex = qr/
+    (?<!\s-)               # ignore options, e.g. "-c++" [sic!] (used by swig)
     (?<!\.)                # ignore file names, e.g. "test.gcc"
     (?:cc|gcc|g\+\+|c\+\+)
     (?:-[\d.]+)?           # version suffix, e.g. "gcc-4.6"
diff --git a/t/logs/false-positives b/t/logs/false-positives
new file mode 100644 (file)
index 0000000..3e63b8d
--- /dev/null
@@ -0,0 +1,5 @@
+dpkg-buildpackage: source package test
+
+# Some false positives.
+
+swig -Wall -c++ -python test.i
index e238b1ad58aa188ec45cc51ef02c487f82b821ff..c6906e2a59aaaa5a304f68264e5341d07d90a2a9 100644 (file)
--- a/t/tests.t
+++ b/t/tests.t
@@ -19,7 +19,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 130;
+use Test::More tests => 132;
 
 
 sub is_blhc {
@@ -475,12 +475,10 @@ CFLAGS missing (-Werror=format-security): cd /tmp/test/src && /usr/bin/gcc -g -O
 # configure/make
 
 is_blhc 'configure', '', 1,
-        'No compiler commands!
-';
+        $empty;
 
 is_blhc 'make', '', 1,
-        'No compiler commands!
-';
+        $empty;
 
 
 
@@ -660,6 +658,12 @@ is_blhc 'debian-hardening-wrapper', '', 16,
         $debian_hardening_wrapper;
 
 
+# false positives
+
+is_blhc 'false-positives', '', 1,
+        $empty;
+
+
 # buildd support
 
 is_blhc 'empty', '--buildd', 1,