diff --git a/Changes b/Changes index 3677caa4e..04727c088 100644 --- a/Changes +++ b/Changes @@ -24,8 +24,9 @@ Verilator 5.015 devel * Support 'let'. * Optimize Verilator executable size by refactoring error reporting routines (#4446). [Anthony Donlon] * Optimize Verilation runtime pointers and graphs (#4396) (#4397) (#4398). [Krzysztof Bieganski, Antmicro Ltd] -* Optimize preparations towards multithreading Verilation (#4463) (#4476) (#4477) (#4479). [Kamil Rakoczy, Antmicro Ltd] +* Optimize preparations towards multithreaded Verilation (#4291) (#4463) (#4476) (#4477) (#4479). [Kamil Rakoczy, Antmicro Ltd] * Fix Windows filename format, etc (#3873) (#4421). [Anthony Donlon]. +* Fix t_dist_cppstyle Perl performance issue (#4085). [Srinivasan Venkataramanan] * Fix using type in parameterized classes without #() (#4281) (#4440). [Anthony Donlon] * Fix false INFINITELOOP on forever..mailbox.get() (#4323). [Srinivasan Venkataramanan] * Fix data type of condition operation on class objects (#4345) (#4352). [Ryszard Rozak, Antmicro Ltd] diff --git a/test_regress/t/t_dist_cppstyle.pl b/test_regress/t/t_dist_cppstyle.pl index 7a8f23e5d..222addde0 100755 --- a/test_regress/t/t_dist_cppstyle.pl +++ b/test_regress/t/t_dist_cppstyle.pl @@ -63,18 +63,19 @@ sub checkPattern { my $pattern = shift; my $message = shift; - my $offset = 0; - my $buffer = $contents; - while ($buffer =~ s/.*?^($pattern)//sm) { - my $lineno = offset_to_lineno($contents, $offset + $-[-1]); - $offset += $+[1]; - error("$filename:$lineno: $message"); + my $lineno = 0; + my $buffer; + foreach my $line (split(/\n/, $contents . "\n\n")) { + ++$lineno; + if ($line ne "") { + # Don't do whole file at once - see issue #4085 + # Build a buffer until a newline so we check a block at a time. + $buffer .= $line . "\n"; + next; + } + if ($buffer =~ s/.*?^($pattern)//sm) { + error("$filename:$lineno: $message"); + } + $buffer = ""; } } - -sub offset_to_lineno { - my $contents = shift; - my $offset = shift; - my $count = (substr $contents, 0, $offset) =~ tr/\n//; - return $count + 1; -}