From 2475b608a1edcc1a00d8046e32b55472dd81684f Mon Sep 17 00:00:00 2001 From: Simon Ruderich Date: Tue, 13 Mar 2012 23:43:48 +0100 Subject: [PATCH] Correctly handle files with "c++" in their name. Names like "c++defs.h-t" and "c++defs.h" are used by some build scripts. --- bin/blhc | 2 +- t/logs/c++ | 4 ++++ t/tests.t | 2 ++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/bin/blhc b/bin/blhc index 030dd21..383fcc1 100755 --- a/bin/blhc +++ b/bin/blhc @@ -224,7 +224,7 @@ while (my $line = <>) { } else { # Ignore lines with no compiler commands. - next if $line !~ /\b(cc\b|gcc\b|g\+\+|c\+\+)/; + next if $line !~ /\b(cc|gcc|g\+\+|c\+\+)(\s|\\)/; # Ignore false positives. # diff --git a/t/logs/c++ b/t/logs/c++ index 21e9a29..76a9e95 100644 --- a/t/logs/c++ +++ b/t/logs/c++ @@ -9,3 +9,7 @@ c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-securit c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc test-d.cc:47:11: warning: unused variable 'test' [-Wunused-variable] c++ -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest + +rm c++test.h +c++\ + test.c diff --git a/t/tests.t b/t/tests.t index 1d40f82..f122c25 100644 --- a/t/tests.t +++ b/t/tests.t @@ -306,6 +306,8 @@ CFLAGS missing (--param=ssp-buffer-size=4 -fPIE): c++ -g -O2 -fstack-protector - CFLAGS missing (-Werror=format-security -fPIE): c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -c test-c.cpp CFLAGS missing (-fPIE): c++ -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -D_FORTIFY_SOURCE=2 -c test-d.cc LDFLAGS missing (-Wl,-z,relro -fPIE -pie -Wl,-z,now): c++ -Wl,-z,defs -o test test-a.o test-b.o test-c.o test-d.o -ltest +CFLAGS missing (-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Wformat-security -Werror=format-security -fPIE): c++\\ test.c +CPPFLAGS missing (-D_FORTIFY_SOURCE=2): c++\\ test.c "; -- 2.45.2