Skip to contentSkip to conversation

get_abi.pl: some fixes

PATCH New Mauro Carvalho Chehab 1 participant 3 messages Sep 30, 2021 Documentation

lore
Share & tools
lore
#0 lore raw

cover get_abi.pl: some fixes

Hi Greg,

This small series contain:

patch 1:
- fixes a rule that searches for some additional regexes. This will make the script slower but will avoid some false-positives (10 seconds instead of 6 seconds here)

patch 2:
- contain some cleanups to the regexes. That will likely make some regular expressions to run faster.

I have an idea that might speedup the script again, but I need to do some tests.

Mauro Carvalho Chehab (2):
scripts: get_abi.pl: fix fallback rule for undefined symbols
scripts: get_abi.pl: better generate regex from what fields

 scripts/get_abi.pl | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)
Signature · 1 line
2.31.1
#1 lore raw

PATCH 1/2 scripts: get_abi.pl: fix fallback rule for undefined symbols

The rule that falls back to the long regex list is wrong:
it is just running again the same loop it did before.

change it to look at the "others" table.

That slows the processing speed, but provides a better list of undefined symbols.

---

To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/2] at: https://lore.kernel.org/all/[email protected]/

 scripts/get_abi.pl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
scripts/get_abi.pl +1 -1
index d32dcd7cca5d..2f3674bb3c9e 100755
@@ -746,7 +746,7 @@ sub check_file($$)
 	}
 
 	if ($leave ne "others") {
-		my @expr = @{$leaf{$leave}->{expr}};
+		my @expr = @{$leaf{"others"}->{expr}};
 		for (my $i = 0; $i < @names; $i++) {
 			foreach my $re (@expr) {
 				print STDERR "$names[$i] =~ /^$re\$/\n" if ($debug && $dbg_undefined);
Signature · 1 line
2.31.1
#2 lore raw

PATCH 2/2 scripts: get_abi.pl: better generate regex from what fields

In reply to Mauro Carvalho Chehab

Using repeating sequencies of .* seem to slow down the processing speed on some cases. Also, currently, a "." character is not properly handled as such.

Change the way regexes are created, in order to produce better search expressions.

---

To mailbombing on a large number of people, only mailing lists were C/C on the cover. See [PATCH 0/2] at: https://lore.kernel.org/all/[email protected]/

 scripts/get_abi.pl | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)
scripts/get_abi.pl +11 -2
index 2f3674bb3c9e..6212f58b69c6 100755
@@ -842,8 +842,8 @@ sub undefined_symbols {
 
 			# Convert what into regular expressions
 
-			$what =~ s,/\.\.\./,/*/,g;
-			$what =~ s,\*,.*,g;
+			# Escape dot characters
+			$what =~ s/\./\xf6/g;
 
 			# Temporarily change [0-9]+ type of patterns
 			$what =~ s/\[0\-9\]\+/\xff/g;
@@ -859,6 +859,8 @@ sub undefined_symbols {
 			$what =~ s/[\{\<\[]([\w_]+)(?:[,|]+([\w_]+)){1,}[\}\>\]]/($1|$2)/g;
 
 			# Handle wildcards
+			$what =~ s,\*,.*,g;
+			$what =~ s,/\xf6..,/.*,g;
 			$what =~ s/\<[^\>]+\>/.*/g;
 			$what =~ s/\{[^\}]+\}/.*/g;
 			$what =~ s/\[[^\]]+\]/.*/g;
@@ -891,6 +893,13 @@ sub undefined_symbols {
 			# Special case: IIO ABI which a parenthesis.
 			$what =~ s/sqrt(.*)/sqrt\(.*\)/;
 
+			# Simplify regexes with multiple .*
+			$what =~ s#(?:\.\*){2,}##g;
+#			$what =~ s#\.\*/\.\*#.*#g;
+
+			# Recover dot characters
+			$what =~ s/\xf6/\./g;
+
 			my $leave = get_leave($what);
 
 			my $added = 0;
Signature · 1 line
2.31.1