From: Simon Ruderich Date: Tue, 13 Mar 2012 22:43:48 +0000 (+0100) Subject: Correctly handle files with "c++" in their name. X-Git-Tag: 0.01~131 X-Git-Url: https://ruderich.org/simon/gitweb/?p=blhc%2Fblhc.git;a=commitdiff_plain;h=2475b608a1edcc1a00d8046e32b55472dd81684f Correctly handle files with "c++" in their name. Names like "c++defs.h-t" and "c++defs.h" are used by some build scripts. --- 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 ";