From: Viktor Szakats Date: Thu, 26 Sep 2024 19:16:21 +0000 (+0200) Subject: singleuse: make `git grep` faster, add Apple `nm` support X-Git-Tag: curl-8_11_0~310 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=fcc89619d99a7d2473d63fe92b8e4cd820c91ebf;p=thirdparty%2Fcurl.git singleuse: make `git grep` faster, add Apple `nm` support - avoid regexp in grep to make it run faster. - add support for parsing Apple `nm` output: - skip leading underscore from function names. - pick object name from output. Closes #15070 --- diff --git a/scripts/singleuse.pl b/scripts/singleuse.pl index 3731edc85b..42c5d27d8f 100755 --- a/scripts/singleuse.pl +++ b/scripts/singleuse.pl @@ -152,7 +152,7 @@ my %api = ( sub doublecheck { my ($f, $used) = @_; - open(F, "git grep -le '$f\\W' -- lib ${unittests}packages|"); + open(F, "git grep -Fwle '$f' -- lib ${unittests}packages|"); my @also; while() { my $e = $_; @@ -180,13 +180,17 @@ while () { if($l =~ /^([0-9a-z_-]+)\.o:/) { $file = $1; } - if($l =~ /^([0-9a-f]+) T (.*)/) { + # libcurl.a(unity_0_c.c.o): + elsif($l =~ /\(([0-9a-z_.-]+)\.o\):/) { # Apple nm + $file = $1; + } + if($l =~ /^([0-9a-f]+) T _?(.*)/) { my ($name)=($2); #print "Define $name in $file\n"; $file =~ s/^libcurl_la-//; $exist{$name} = $file; } - elsif($l =~ /^ U (.*)/) { + elsif($l =~ /^ U _?(.*)/) { my ($name)=($1); #print "Uses $name in $file\n"; $uses{$name} .= "$file, ";