[PATCH] automake: rewrite scan_variable_expansions regex

Jan Engelhardt <[email protected]>
Newsgroups gmane.comp.sysutils.automake.general
Message-ID <[email protected]>
The regex pattern in function scan_variable_expansions() fails to
report a portability warning when a dollar-escaped dollar sign
precedes the variable:

	foo_SOURCES = a.c $$$(patsubst a.c,a,b)
---
 lib/Automake/Variable.pm | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/Automake/Variable.pm b/lib/Automake/Variable.pm
index 4227baad9..4fe1e7284 100644
--- a/lib/Automake/Variable.pm
+++ b/lib/Automake/Variable.pm
@@ -746,9 +746,10 @@ sub scan_variable_expansions ($)
   $text =~ s/#.*$//;
 
   # Record each use of ${stuff} or $(stuff) that does not follow a $.
-  while ($text =~ /(?<!\$)\$(?:\{([^\}]*)\}|\(([^\)]*)\))/g)
+  while ($text =~ m{\$(?:\{([^\}]*)\}|\(([^\)]*)\)|(\$))}g)
     {
-      my $var = $1 || $2;
+      my $var = $1 || $2 || $3;
+      next if $var eq '$';
       # The occurrence may look like $(string1[:subst1=[subst2]]) but
       # we want only 'string1'.
       $var =~ s/:[^:=]*=[^=]*$//;
-- 
2.41.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.